From 1de8b09743e7bb9c9ff9d5e6cae2e728653e6510 Mon Sep 17 00:00:00 2001 From: Nicolas Simonds Date: Wed, 28 Feb 2024 12:50:48 -0800 Subject: [PATCH] Add a build target for the docs Generate the documentation with `hatch run docs:build $TYPE` --- doc/hacking/contributing.rst | 21 ++++++++------------- pyproject.toml | 9 +++++++++ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/doc/hacking/contributing.rst b/doc/hacking/contributing.rst index 5de8940..21ddc4d 100644 --- a/doc/hacking/contributing.rst +++ b/doc/hacking/contributing.rst @@ -30,26 +30,22 @@ Python sources The code base follows `pep8 `_ guidelines with lines wrapping at the 79th character. You can verify that the code follows the conventions with:: - $ pycodestyle --ignore=E252,W503,W504 spinach tests + $ hatch run pep8 Running tests is an invaluable help when adding a new feature or when refactoring. Try to add the -proper test cases in ``tests/`` together with your patch. The test suite can be run with pytest:: +proper test cases in ``tests/`` together with your patch. Because the Redis broker tests require +a running Redis server, there is a convenience `pyproject.toml` that runs all the tests and pep8 +checks for you after starting Redis in a container via docker-compose. Simply running:: - $ pytest tests - -Because the Redis broker tests require a running Redis server, there is also a convenience -`tox.ini` that runs all the tests and pep8 checks for you after starting Redis in a container via -docker-compose. Simply running:: - - $ tox + $ hatch run py3 will build a virtualenv, install Spinach and its dependencies into it, start the Redis server in -the container, and run tests and pycodestyle, tearing down the Redis server container when done. +the container, and run tests and pep8, tearing down the Redis server container when done. Compatibility ------------- -Spinach runs on all versions of Python starting from 3.6. Tests are run via GitHub actions to +Spinach runs on all versions of Python starting from 3.8. Tests are run via GitHub actions to ensure that. Documentation sources @@ -61,7 +57,6 @@ with `Sphinx `_. If you modify the docs, make sure it builds without errors:: - $ cd doc/ - $ make html + $ hatch run docs:build html The generated HTML pages should land in ``doc/_build/html``. diff --git a/pyproject.toml b/pyproject.toml index 928f32d..b905b58 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,6 +86,15 @@ scripts.py3 = [ # A minimalist pytest runner for Github to use scripts.ci = ["pytest -v --cov=spinach tests {args}"] +[tool.hatch.envs.docs] +detatched = true +dependencies = [ + "sphinx", + "blinker" +] +path = ".hatch" +scripts.build = ["cd doc && make {args}"] + [tool.ruff.lint] select = ["B", "C9", "D", "E", "F", "S", "W"] ignore = [