From 192f6455aaccc633206519be0ba2a417bacaff9c Mon Sep 17 00:00:00 2001 From: Frank Sachsenheim Date: Mon, 14 Oct 2024 11:08:48 +0200 Subject: [PATCH] Simplifies development tools invokation by using `pipx run` for implicit installations, and yes updates --- .github/workflows/linkcheck.yml | 3 +-- .github/workflows/publish.yml | 1 - .github/workflows/quality-checks.yml | 3 --- Justfile | 26 +++++++++++++------------- docs/installation.rst | 22 ++++++++++------------ pyproject.toml | 8 ++------ 6 files changed, 26 insertions(+), 37 deletions(-) diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index 5752e75..41188e0 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -14,7 +14,6 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.x" - - run: pipx install hatch - - run: hatch run docs:linkcheck + - run: pipx run hatch run docs:linkcheck ... diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5c6ad53..35cc4df 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -47,7 +47,6 @@ jobs: cache: pip python-version: 3.x - uses: extractions/setup-just@v2 - - run: pipx install hatch - run: just docs - run: pip install panflute pypandoc sphinx - run: >- diff --git a/.github/workflows/quality-checks.yml b/.github/workflows/quality-checks.yml index dd4af15..c53d638 100644 --- a/.github/workflows/quality-checks.yml +++ b/.github/workflows/quality-checks.yml @@ -40,7 +40,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: extractions/setup-just@v2 - - run: pipx install hatch - uses: actions/download-artifact@v4 with: name: Packages @@ -67,7 +66,6 @@ jobs: cache: pip python-version: ${{ matrix.python-version }} - uses: extractions/setup-just@v2 - - run: pipx install hatch - uses: actions/download-artifact@v4 with: name: Packages @@ -94,7 +92,6 @@ jobs: cache: pip python-version: "3.x" - uses: extractions/setup-just@v2 - - run: pipx install hatch - run: just ${{ matrix.target }} ... diff --git a/Justfile b/Justfile index 757ff16..8ec7475 100644 --- a/Justfile +++ b/Justfile @@ -10,39 +10,39 @@ _assert_no_dev_version: # run benchmarks benchmarks: - hatch run benchmarks:run + pipx run hatch run benchmarks:run # normalize Python code black: - black benchmarks _delb delb integration-tests tests + pipx run black benchmarks _delb delb integration-tests tests # runs tests (except loaders) and reports uncovered lines coverage-report: - hatch run unit-tests:coverage-report + pipx run hatch run unit-tests:coverage-report # generate Sphinx HTML documentation, including API docs docs: - hatch run docs:clean - hatch run docs:build-html + pipx run hatch run docs:clean + pipx run hatch run docs:build-html # verifies testable code snippets in the HTML documentation doctest: - hatch run docs:clean - hatch run docs:doctest + pipx run hatch run docs:clean + pipx run hatch run docs:doctest # code & data & document linting with doc8 & flake8 & yamllint lint: pipx run doc8 --max-line-length=80 docs - hatch run linting:check + pipx run hatch run linting:check pipx run yamllint $(find . -name "*.yaml" -or -name "*.yml") # run static type checks with mypy mypy: - hatch run mypy:check + pipx run hatch run mypy:check # run the complete testsuite pytest: - hatch run unit-tests:check + pipx run hatch run unit-tests:check # release the current version on github & (transitively) the PyPI release: _assert_no_dev_version tests @@ -55,7 +55,7 @@ release: _assert_no_dev_version tests # watch, build and serve HTML documentation at 0.0.0.0:8000 serve-docs: - hatch run docs:serve + pipx run hatch run docs:serve # build and open HTML documentation show-docs: docs @@ -66,8 +66,8 @@ tests: black lint mypy pytest doctest # run the testsuite against a wheel (installed from $WHEEL_PATH); intended to run on a CI platform test-wheel $WHEEL_PATH: - hatch run test-wheel:check + pipx run hatch run test-wheel:check # Generates and validates CITATION.cff update-citation-file: - hatch run citation-file:cff-from-621 + pipx run cff-from-621 diff --git a/docs/installation.rst b/docs/installation.rst index 41504ff..7d04714 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -52,8 +52,7 @@ Developer toolbox ----------------- The repository includes configurations so that beside a suited Python -interpreter three tools need to be available globally. pipx_ is the recommended -facilitation to install the Python implemented tools *black* and *hatch*. +interpreter two tools need to be available globally. just ~~~~ @@ -68,18 +67,19 @@ the default recipe:: …/delb-py $ just -black -~~~~~ +Both, the recipes in the ``Justfile`` as well as various sections in the +``pyproject.toml``, are prescriptive how different aspects are to be applied or +tested. -It's recommended to configure the used editors and IDEs to enforce black_'s code -style, but it can also be applied with:: +pipx +~~~~ - …/delb-py $ just black +pipx_, often available from distributions' repositories, is required to invoke +various Python tools without explicitly installing them. -hatch -~~~~~ -Several of the *just* recipes rely on hatch_. +Development guidelines +---------------------- pytest ~~~~~~ @@ -88,9 +88,7 @@ You can skip some long running tests by invoking pytest in a context where the environment variable ``SKIP_LONG_RUNNING_TESTS`` is defined. -.. _black: https://black.readthedocs.io/ .. _editable: https://packaging.python.org/guides/distributing-packages-using-setuptools/#working-in-development-mode -.. _hatch: https://hatch.pypa.io/ .. _just: https://just.systems/ .. _pip: https://pip.pypa.io/ .. _pipx: https://pipx.pypa.io/stable/ diff --git a/pyproject.toml b/pyproject.toml index ae61b97..1af4be1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -139,10 +139,6 @@ run = """ --benchmark-timer=time.process_time benchmarks """ -[tool.hatch.envs.citation-file] -dependencies = ["cff-from-621"] -detached = true - [tool.hatch.envs.docs] dependencies = [ "autodocsumm", @@ -186,11 +182,11 @@ check = "flake8 benchmarks _delb delb integration-tests tests" [tool.hatch.envs.mypy] dependencies = [ "lxml-stubs", - "mypy~=1.0" + "mypy" ] skipinstall = true [tool.hatch.envs.mypy.scripts] -check = "mypy _delb delb" +check = "mypy _delb delb" [tool.hatch.envs.unit-tests] dependencies = [