Skip to content

Commit

Permalink
Simplifies development tools invokation
Browse files Browse the repository at this point in the history
by using `pipx run` for implicit installations, and yes updates
  • Loading branch information
funkyfuture committed Oct 14, 2024
1 parent 62469e8 commit 192f645
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 37 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

...
1 change: 0 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >-
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/quality-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -94,7 +92,6 @@ jobs:
cache: pip
python-version: "3.x"
- uses: extractions/setup-just@v2
- run: pipx install hatch
- run: just ${{ matrix.target }}

...
26 changes: 13 additions & 13 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
22 changes: 10 additions & 12 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
~~~~
Expand All @@ -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
~~~~~~
Expand All @@ -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/
8 changes: 2 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 = [
Expand Down

0 comments on commit 192f645

Please sign in to comment.