-
Notifications
You must be signed in to change notification settings - Fork 0
separate out dev dependency groups and improve justfile recipe enviro… #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,32 @@ | ||
| repos: | ||
| - repo: local | ||
| hooks: | ||
| - id: lint | ||
| name: Lint | ||
| entry: just lint | ||
| language: system | ||
| pass_filenames: false | ||
| - id: format | ||
| name: Format | ||
| entry: just format | ||
| language: system | ||
| pass_filenames: false | ||
| - id: lint | ||
| name: Lint | ||
| entry: just lint | ||
| language: system | ||
| pass_filenames: false | ||
|
|
||
| - id: format | ||
| name: Format | ||
| entry: just format | ||
| language: system | ||
| pass_filenames: false | ||
|
|
||
| - id: typing | ||
| name: Typing | ||
| entry: just check-types | ||
| language: system | ||
| pass_filenames: false | ||
|
|
||
| - id: docs | ||
| name: Docs | ||
| entry: just check-docs | ||
| language: system | ||
| pass_filenames: false | ||
|
|
||
| - id: pip | ||
| name: Package | ||
| entry: just check-package | ||
| language: system | ||
| pass_filenames: false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import inspect | ||
|
|
||
|
|
||
| def first_breakable_line(obj) -> tuple[str, int]: | ||
| """ | ||
| Return the absolute line number of the first executable statement | ||
| in a function or bound method. | ||
| """ | ||
| import ast | ||
| import textwrap | ||
|
|
||
| func = obj.__func__ if inspect.ismethod(obj) else obj | ||
|
|
||
| source = inspect.getsource(func) | ||
| source = textwrap.dedent(source) | ||
| filename = inspect.getsourcefile(func) | ||
| assert filename | ||
| _, start_lineno = inspect.getsourcelines(func) | ||
|
|
||
| tree = ast.parse(source) | ||
|
|
||
| for node in tree.body[0].body: | ||
| if ( | ||
| isinstance(node, ast.Expr) | ||
| and isinstance(node.value, ast.Constant) | ||
| and isinstance(node.value.value, str) | ||
| ): | ||
| continue | ||
|
|
||
| return filename, start_lineno + node.lineno - 1 | ||
|
|
||
| # fallback: just return the line after the def | ||
| return filename, start_lineno + 1 | ||
|
|
||
|
|
||
| def pytest_runtest_call(item): | ||
| # --trace cli option does not work for unittest style tests so we implement it here | ||
| test = getattr(item, "obj", None) | ||
| if item.config.option.trace and inspect.ismethod(test): | ||
| from IPython.terminal.debugger import TerminalPdb | ||
|
|
||
| try: | ||
| file = inspect.getsourcefile(test) | ||
| assert file | ||
| dbg = TerminalPdb() | ||
| dbg.set_break(*first_breakable_line(test)) | ||
| dbg.cmdqueue.append("continue") | ||
| dbg.set_trace() | ||
| except (OSError, AssertionError): | ||
| pass | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -19,23 +19,22 @@ install-uv: | |||||
| install-uv: | ||||||
| powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" | ||||||
|
|
||||||
| # setup the venv and pre-commit hooks | ||||||
| # setup the venv, pre-commit hooks | ||||||
| setup python="python": | ||||||
| uv venv -p {{ python }} | ||||||
| @just run pre-commit install | ||||||
| @just install-precommit | ||||||
|
|
||||||
| # install git pre-commit hooks | ||||||
| install-precommit: | ||||||
| @just run pre-commit install | ||||||
| @just run --no-default-groups --group precommit --exact --isolated pre-commit install | ||||||
|
|
||||||
| # update and install development dependencies | ||||||
| install *OPTS: | ||||||
| @just install-precommit | ||||||
| uv sync {{ OPTS }} | ||||||
| @just run pre-commit install | ||||||
|
|
||||||
| # install documentation dependencies | ||||||
| install-docs: | ||||||
| uv sync --group docs --all-extras | ||||||
| _install-docs: | ||||||
| uv sync --no-default-groups --group docs --all-extras | ||||||
|
|
||||||
| [script] | ||||||
| _lock-python: | ||||||
|
|
@@ -48,16 +47,28 @@ _lock-python: | |||||
|
|
||||||
| # lock to specific python and versions of given dependencies | ||||||
| test-lock +PACKAGES: _lock-python | ||||||
| uv add {{ PACKAGES }} | ||||||
| uv add --no-sync {{ PACKAGES }} | ||||||
| uv sync --reinstall --no-default-groups --no-install-project | ||||||
|
|
||||||
| # run static type checking | ||||||
| check-types: | ||||||
| @just run mypy | ||||||
| @just run pyright | ||||||
| # run static type checking with mypy | ||||||
| check-types-mypy *RUN_ARGS: | ||||||
| @just run --no-default-groups --all-extras --group typing {{ RUN_ARGS }} mypy | ||||||
|
|
||||||
| # run static type checking with pyright | ||||||
| check-types-pyright *RUN_ARGS: | ||||||
| @just run --no-default-groups --all-extras --group typing {{ RUN_ARGS }} pyright | ||||||
|
|
||||||
| # run all static type checking | ||||||
| check-types: check-types-mypy check-types-pyright | ||||||
|
|
||||||
| # run all static type checking in an isolated environment | ||||||
| check-types-isolated: | ||||||
| @just check-types-mypy --exact --isolated | ||||||
| @just check-types-pyright --exact --isolated | ||||||
|
|
||||||
| # run package checks | ||||||
| check-package: | ||||||
| @just run pip check | ||||||
| uv pip check | ||||||
|
|
||||||
| # remove doc build artifacts | ||||||
| [script] | ||||||
|
|
@@ -80,11 +91,11 @@ clean-git-ignored: | |||||
| clean: clean-docs clean-env clean-git-ignored | ||||||
|
|
||||||
| # build html documentation | ||||||
| build-docs-html: install-docs | ||||||
| build-docs-html: _install-docs | ||||||
| @just run sphinx-build --fresh-env --builder html --doctree-dir ./doc/build/doctrees ./doc/source ./doc/build/html | ||||||
|
|
||||||
| # build pdf documentation | ||||||
| build-docs-pdf: install-docs | ||||||
| build-docs-pdf: _install-docs | ||||||
| @just run sphinx-build --fresh-env --builder latexpdf --doctree-dir ./doc/build/doctrees ./doc/source ./doc/build/pdf | ||||||
|
|
||||||
| # build the docs | ||||||
|
|
@@ -102,14 +113,14 @@ open-docs: | |||||
| webbrowser.open(f'file://{os.getcwd()}/doc/build/html/index.html') | ||||||
|
|
||||||
| # build and open the documentation | ||||||
| docs: install-docs build-docs-html open-docs | ||||||
| docs: _install-docs build-docs-html open-docs | ||||||
|
|
||||||
| # serve the documentation, with auto-reload | ||||||
| docs-live: install-docs | ||||||
| @just run sphinx-autobuild doc/source doc/build --open-browser --watch src --port 8000 --delay 1 | ||||||
| docs-live: | ||||||
| @just run --no-default-groups --group docs sphinx-autobuild doc doc/_build --open-browser --watch src --port 8000 --delay 1 | ||||||
|
||||||
| @just run --no-default-groups --group docs sphinx-autobuild doc doc/_build --open-browser --watch src --port 8000 --delay 1 | |
| @just run --no-default-groups --group docs sphinx-autobuild ./doc/source ./doc/build/html --open-browser --watch src --port 8000 --delay 1 |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check already includes check-docs-links, so check-all: check check-docs-links will run link checking twice. Either remove check-docs-links from check and keep it in check-all, or drop the redundant dependency in check-all.
| check-all: check check-docs-links | |
| check-all: check |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just test adds a bare --cov even though pytest is already configured with coverage options in pyproject.toml (--cov=enum_properties, --cov-branch). Passing --cov without a target can expand coverage collection to the whole environment and can change results/performance. Consider removing the extra --cov here (or replace it with --cov-append if the goal is to preserve data across multiple invocations with the same COVERAGE_FILE).
| @just run --no-default-groups --exact --group test --isolated pytest {{ TESTS }} --cov | |
| @just run --no-default-groups --exact --group test --isolated pytest {{ TESTS }} |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in comment: “debug an test” → “debug a test”.
| # debug an test | |
| # debug a test |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug-test passes --headed, but there’s no dependency/plugin in this repo that provides that pytest option (e.g., pytest-playwright). This will make just debug-test … error with “unrecognized arguments: --headed”. Either remove --headed or add the required plugin and document it as a dev dependency.
| --headed {{ TESTS }} | |
| {{ TESTS }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.