| 1 |
"""Configuration to automatically run jobs and tests via `nox`. |
| 2 |
|
| 3 |
For example, to build the documentation with a live server: |
| 4 |
|
| 5 |
nox -s docs -- live |
| 6 |
|
| 7 |
List available jobs: |
| 8 |
|
| 9 |
nox -l |
| 10 |
|
| 11 |
ref: https://nox.thea.codes/ |
| 12 |
""" |
| 13 |
|
| 14 |
from __future__ import annotations |
| 15 |
|
| 16 |
import nox |
| 17 |
|
| 18 |
nox.options.reuse_existing_virtualenvs = True |
| 19 |
|
| 20 |
|
| 21 |
@nox.session |
| 22 |
def docs(session: nox.Session) -> None: |
| 23 |
"""Build the documentation. Use `-- live` to build with a live server.""" |
| 24 |
session.install('--group', 'docs') |
| 25 |
session.install('-e', '.') |
| 26 |
common_args = '-M', 'html', 'docs', 'docs/build' |
| 27 |
if 'live' in session.posargs: |
| 28 |
session.install('ipython') |
| 29 |
session.install('sphinx-autobuild') |
| 30 |
session.run('sphinx-autobuild', *common_args) |
| 31 |
else: |
| 32 |
session.run('sphinx-build', *common_args, '-nW', '--keep-going') |
| 33 |
|
| 34 |
|
| 35 |
@nox.session |
| 36 |
def test(session: nox.Session) -> None: |
| 37 |
"""Run the test suite.""" |
| 38 |
session.install('-e', '.') |
| 39 |
session.install('--group', 'test') |
| 40 |
session.run('pytest', *session.posargs) |