File: noxfile.py

package info (click to toggle)
sphinxext-opengraph 0.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,200 kB
  • sloc: python: 1,130; makefile: 11; sh: 8
file content (40 lines) | stat: -rw-r--r-- 1,014 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""Configuration to automatically run jobs and tests via `nox`.

For example, to build the documentation with a live server:

  nox -s docs -- live

List available jobs:

  nox -l

ref: https://nox.thea.codes/
"""

from __future__ import annotations

import nox

nox.options.reuse_existing_virtualenvs = True


@nox.session
def docs(session: nox.Session) -> None:
    """Build the documentation. Use `-- live` to build with a live server."""
    session.install('--group', 'docs')
    session.install('-e', '.')
    common_args = '-M', 'html', 'docs', 'docs/build'
    if 'live' in session.posargs:
        session.install('ipython')
        session.install('sphinx-autobuild')
        session.run('sphinx-autobuild', *common_args)
    else:
        session.run('sphinx-build', *common_args, '-nW', '--keep-going')


@nox.session
def test(session: nox.Session) -> None:
    """Run the test suite."""
    session.install('-e', '.')
    session.install('--group', 'test')
    session.run('pytest', *session.posargs)