From fcbd96e4a9466a03463ae615e2f7fa36560be154 Mon Sep 17 00:00:00 2001 From: Buck Evan Date: Wed, 27 Sep 2023 17:20:02 +0000 Subject: [PATCH] in code review --- .pre-commit-config.yaml | 8 +- Makefile | 6 - README.md | 1 + TODO.md | 42 +++++++ sentry_jsonish/.envrc | 1 + sentry_jsonish/Makefile | 1 + sentry_jsonish/pyproject.toml | 105 ++++++++++++++++++ .../requirements-dev.in | 0 sentry_jsonish/requirements-dev.txt | 6 + {jsonish => sentry_jsonish}/requirements.in | 0 .../src/sentry_jsonish.py | 0 11 files changed, 160 insertions(+), 10 deletions(-) create mode 100644 TODO.md create mode 120000 sentry_jsonish/.envrc create mode 120000 sentry_jsonish/Makefile create mode 100644 sentry_jsonish/pyproject.toml rename {jsonish => sentry_jsonish}/requirements-dev.in (100%) create mode 100644 sentry_jsonish/requirements-dev.txt rename {jsonish => sentry_jsonish}/requirements.in (100%) rename jsonish/src/jsonish.py => sentry_jsonish/src/sentry_jsonish.py (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4094f32..c86d42d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,15 +1,15 @@ repos: - repo: https://github.com/pycqa/isort - rev: 5.8.0 + rev: 5.12.0 hooks: - id: isort name: isort (python) - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 23.9.1 hooks: - id: black - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.4.0 + rev: v4.4.0 hooks: - id: check-case-conflict - id: check-merge-conflict @@ -22,7 +22,7 @@ repos: - id: fix-encoding-pragma args: ["--remove"] - repo: https://github.com/pycqa/flake8 - rev: 3.8.4 + rev: 6.1.0 hooks: - id: flake8 language_version: python3.8 diff --git a/Makefile b/Makefile index 643b364..d3b6f11 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,3 @@ setup-git: pip install pre-commit==2.13.0 pre-commit install --install-hooks - -venv-binding: - sbin/make-venv binding - -venv-tester: - sbin/make-venv tester diff --git a/README.md b/README.md index e392809..55d4845 100644 --- a/README.md +++ b/README.md @@ -16,3 +16,4 @@ make ``` make test ``` + diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..0ed5323 --- /dev/null +++ b/TODO.md @@ -0,0 +1,42 @@ +# TODO + + * [ ] goal: allow sentaurs to use jsonnet in a fully-tested manner + * [ ] submit ops/jsonnet integration: + https://github.com/getsentry/ops/pull/7245/files + * [ ] test getsentry deployment + https://github.com/getsentry/getsentry/blob/master/gocd/templates/backend.jsonnet + * [ ] rework tests of application to gocd + https://github.com/getsentry/gocd-jsonnet + * [ ] DRY pyproject.toml, in this repo + * [ ] we're creating three new python libraries + * [ ] sentry-jsonish -- mostly just typing + * [x] pypi packaging exists + * [x] unit testing + * [ ] readme + * [ ] sentry-jsonnet + * [x] pypi packaging exists + * [ ] update to gojsonnet + * [ ] blocked by: figure out why our pypi GHA has no `go` + * [ ] depends on sentry-jsonish + * [ ] readme + * [ ] test harness: jsonnet-tester + * [ ] refactor pytest to a library + * [ ] extract three functions from jsonnet-private-libs make_port_test.py + * [ ] some unit testing of those three functions + * [ ] later: use those three functions in a pytest extension + * [ ] readme + * [ ] depends on sentry-jsonnet + * sentry-jsonnet-lib + * [ ] add it to this repo + * [ ] repo scope: + * [ ] set up autoreleasing + * [ ] GHA "release" action -- prepares assets and creates an issue in github.com/getsentry/publish + * [ ] blocked by: add all three packages to this repo + * [ ] delete the old getsentry/private-jsonnet-libs + +# out of scope + + * private shared jsonnet functions: getsentry/getsentry-jsonnet-lib.private + * don't need it, for the forseeable future + * anything private can be modeled as parmeters' values in private repos (e.g. ops) + * would need to be a new repo, since this one's public diff --git a/sentry_jsonish/.envrc b/sentry_jsonish/.envrc new file mode 120000 index 0000000..8d4ff23 --- /dev/null +++ b/sentry_jsonish/.envrc @@ -0,0 +1 @@ +../sentry_jsonnet/.envrc \ No newline at end of file diff --git a/sentry_jsonish/Makefile b/sentry_jsonish/Makefile new file mode 120000 index 0000000..f739260 --- /dev/null +++ b/sentry_jsonish/Makefile @@ -0,0 +1 @@ +../sentry_jsonnet/Makefile \ No newline at end of file diff --git a/sentry_jsonish/pyproject.toml b/sentry_jsonish/pyproject.toml new file mode 100644 index 0000000..a373ea6 --- /dev/null +++ b/sentry_jsonish/pyproject.toml @@ -0,0 +1,105 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.packages.find] +where = ["src"] +exclude = ["test"] + +[project] +dynamic = ["dependencies"] +name = "sentry_jsonish" +version = "0.0.1" +description = "Sentry wrapper to the go-jsonnet library" +readme = "README.md" +requires-python = ">=3.8" +classifiers = [ + "Programming Language :: Python :: 3", + "Operating System :: OS Independent", +] + +[tool.setuptools.dynamic] +dependencies = {file = ["requirements.in"]} + +[tool.black] +line-length = 79 +target-version = ['py38'] +skip-magic-trailing-comma = true + +[tool.isort] +profile = "black" +line_length = 79 +use_parentheses = true +force_single_line = true +multi_line_output = 3 +include_trailing_comma = true +add_imports=[ + "from __future__ import annotations", +] + +[tool.pytest.ini_options] +minversion = "6.0" +markers = ["slow_integration"] +addopts = "--durations=3 -vv --doctest-modules" +testpaths = ["."] +norecursedirs = [ + # runtime-only deps + "**/vendor", # jsonnet-bundle symlinks + "**/venv", + + # cache files + "**/__pycache__", + "**/.*", + + # dirty hacks + "tmp*", + "*tmp", + "*bak", + "**/trash", +] +python_files = ["*.py"] +python_classes = ["Test", "Describe"] +python_functions = ["test_", "it_"] +enable_assertion_pass_hook = true + +[tool.pyright] +include = ["."] +exclude = [ + "**/.venv", + + # cache files + "**/__pycache__", + "**/.*", + + # dirty hacks + "tmp*", + "*tmp", + "*bak", + "**/trash", +] +extraPaths = [ + "src", + ".venv/lib/*/site-packages/", +] + +pythonPlatform = "Linux" +pythonVersion = "3.8" + +typeCheckingMode = "strict" + +# don't flag arguments as long as its type is known +reportMissingParameterType = "none" +reportUnknownParameterType = "error" + +# turn on all the checks not already enabled by "strict": +reportCallInDefaultInitializer = "error" +reportImplicitStringConcatenation = "error" +reportMissingSuperCall = "error" +reportPropertyTypeMismatch = "error" +reportUninitializedInstanceVariable = "error" +reportUnnecessaryTypeIgnoreComment = "error" +reportUnusedCallResult = "none" # too noisy + +# enable PEP 484 indication that a function parameter assigned a default value +# of None is implicitly Optional +strictParameterNoneValue = false diff --git a/jsonish/requirements-dev.in b/sentry_jsonish/requirements-dev.in similarity index 100% rename from jsonish/requirements-dev.in rename to sentry_jsonish/requirements-dev.in diff --git a/sentry_jsonish/requirements-dev.txt b/sentry_jsonish/requirements-dev.txt new file mode 100644 index 0000000..f52bbd6 --- /dev/null +++ b/sentry_jsonish/requirements-dev.txt @@ -0,0 +1,6 @@ +# +# This file is autogenerated by pip-compile with Python 3.8 +# by the following command: +# +# pip-compile --output-file=requirements-dev.txt --strip-extras requirements-dev.in +# diff --git a/jsonish/requirements.in b/sentry_jsonish/requirements.in similarity index 100% rename from jsonish/requirements.in rename to sentry_jsonish/requirements.in diff --git a/jsonish/src/jsonish.py b/sentry_jsonish/src/sentry_jsonish.py similarity index 100% rename from jsonish/src/jsonish.py rename to sentry_jsonish/src/sentry_jsonish.py