Debian Codegraph @

tox.ini

raw
1 [tox]
2 envlist = python
3 isolated_build = true
4 minversion = 3.21.0
5
6 [testenv]
7 description = Run test suite
8 commands =
9 {envpython} -m \
10 pytest \
11 {tty:--color=yes} \
12 {posargs:}
13 deps =
14 pytest
15 pytest-cov
16 pytest-xdist
17
18 # Ref: https://github.com/tox-dev/tox/issues/1199
19 towncrier
20 isolated_build = true
21 package = wheel
22 wheel_build_env = .pkg
23 usedevelop = false
24
25 [testenv:build-dists]
26 description =
27 Build dists and put them into the dist{/} folder
28 basepython = python3
29 isolated_build = true
30 # NOTE: `package_env = none` is needed so it's possible to use `--installpkg`
31 # NOTE: with the main `testenv`.
32 # Ref: https://github.com/tox-dev/tox/issues/2442
33 package_env = ❌ DUMMY NON-EXISTENT ENV NAME ❌
34 # `usedevelop = true` overrides `skip_install` instruction, it's unwanted
35 usedevelop = false
36 skip_install = true
37 deps =
38 build ~= 1.0.0
39 commands =
40 {envpython} -c \
41 "import shutil; \
42 shutil.rmtree('{toxinidir}{/}dist{/}', ignore_errors=True)"
43
44 {envpython} -m build \
45 --outdir '{toxinidir}{/}dist{/}' \
46 {posargs:} \
47 '{toxinidir}'
48
49
50 [testenv:lint]
51 description = Run the quality checks
52 basepython = python3
53 commands =
54 {envpython} -m \
55 pre_commit run \
56 --show-diff-on-failure \
57 --hook-stage manual \
58 {posargs:--all-files}
59
60 # Print out the advice on how to install pre-commit from this env into Git:
61 -{envpython} -c \
62 'cmd = "{envpython} -m pre_commit install"; \
63 scr_width = len(cmd) + 10; \
64 sep = "=" * scr_width; \
65 cmd_str = " $ \{cmd\}";' \
66 'print(f"\n\{sep\}\nTo install pre-commit hooks into the Git repo, run:\n\n\{cmd_str\}\n\n\{sep\}\n")'
67 deps =
68 {[testenv]deps}
69 {[testenv:build-docs]deps}
70 pre-commit >= 2.6.0
71 pylint ~= 2.15.0
72 isolated_build = true
73
74
75 [testenv:build-docs]
76 allowlist_externals =
77 git
78 basepython = python3
79 depends =
80 make-changelog
81 deps =
82 # -r{toxinidir}{/}docs{/}requirements.txt
83 # FIXME: re-enable the "-r" + "-c" paradigm once the pip bug is fixed.
84 # Ref: https://github.com/pypa/pip/issues/9243
85 -r{toxinidir}{/}docs{/}requirements.in
86 # -c{toxinidir}{/}docs{/}requirements.txt
87 description = Build The Docs
88 commands =
89 # Retrieve possibly missing commits:
90 -git fetch --unshallow
91 -git fetch --tags
92
93 # Build the html docs with Sphinx:
94 {envpython} -m sphinx \
95 -j auto \
96 -b html \
97 {tty:--color} \
98 -a \
99 -n \
100 -W --keep-going \
101 -d "{temp_dir}{/}.doctrees" \
102 {posargs:} \
103 . \
104 "{envdir}{/}docs_out"
105
106 # Print out the output docs dir and a way to serve html:
107 -{envpython} -c\
108 'import pathlib;\
109 docs_dir = pathlib.Path(r"{envdir}") / "docs_out";\
110 index_file = docs_dir / "index.html";\
111 print("\n" + "=" * 120 +\
112 f"\n\nDocumentation available under:\n\n\
113 \tfile://\{index_file\}\n\nTo serve docs, use\n\n\
114 \t$ python3 -m http.server --directory \
115 \N\{QUOTATION MARK\}\{docs_dir\}\N\{QUOTATION MARK\} 0\n\n" +\
116 "=" * 120)'
117 changedir = {toxinidir}{/}docs
118 isolated_build = true
119 passenv =
120 SSH_AUTH_SOCK
121 skip_install = false
122 # whitelist_externals is a compatibility alias for allowlist_externals @ old tox
123 whitelist_externals =
124 git