Skip to content

Commit

Permalink
Add a build target for the docs
Browse files Browse the repository at this point in the history
Generate the documentation with `hatch run docs:build $TYPE`
  • Loading branch information
nisimond committed Feb 28, 2024
1 parent af9b6ff commit b895af1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
21 changes: 8 additions & 13 deletions doc/hacking/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,22 @@ Python sources
The code base follows `pep8 <https://www.python.org/dev/peps/pep-0008/>`_ 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
Expand All @@ -61,7 +57,6 @@ with `Sphinx <http://www.sphinx-doc.org/en/stable/index.html>`_.

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``.
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit b895af1

Please sign in to comment.