forked from instructlab/instructlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
152 lines (138 loc) · 4.31 KB
/
tox.ini
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# SPDX-License-Identifier: Apache-2.0
[tox]
# py3-unit runs unit tests with 'python3'
# py311-unit runs the same tests with 'python3.11'
envlist = ruff, lint, mypy, spellcheck, py3-{unit, functional}, tomllint
minversion = 4.4
[testenv]
description = run tests (unit, unitcov, functional)
passenv =
CMAKE_ARGS
# Use PyTorch CPU build instead of CUDA build in test envs. CUDA dependencies
# are huge. This reduces venv from 5.7 GB to 1.5 GB.
setenv =
PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cpu
CMAKE_ARGS={env:CMAKE_ARGS:-DLLAMA_NATIVE=off}
ILAB_MAX_STABLE_VRAM_WAIT=0
package = wheel
wheel_build_env = pkg
# equivalent to `pip install instructlab[cpu]`
extras = cpu
deps =
pytest
pytest-asyncio
pytest-cov
pytest-html
commands =
ilab --version
{envpython} -m instructlab --version
unit: {envpython} -m pytest {posargs:tests}
unitcov: {envpython} -W error::UserWarning -m pytest --cov=instructlab --cov-report term --cov-report=html:coverage-{env_name} --cov-report=xml:coverage-{env_name}.xml --html=durations/{env_name}.html {posargs:tests -m "not (examples or slow)"}
functional: ./scripts/functional-tests.sh
allowlist_externals =
functional: ./scripts/functional-tests.sh
[testenv:py3]
basepython = python3.11
[testenv:py3-unit]
basepython = {[testenv:py3]basepython}
[testenv:py3-functional]
basepython = {[testenv:py3]basepython}
passenv =
{[testenv]passenv}
TEST_DIR
# format, check, and linting targets don't build and install the project to
# speed up testing.
[testenv:lint]
description = lint with pylint
basepython = {[testenv:py3]basepython}
deps =
pytest
pylint>=2.16.2,<4.0
pylint-pydantic
commands =
{envpython} -m pylint --load-plugins pylint_pydantic src/instructlab/ tests/
[testenv:fastlint]
description = fast lint with pylint (without 3rd party modules)
basepython = {[testenv:py3]basepython}
labels = fastverify
skip_install = true
skipsdist = true
deps = {[testenv:lint]deps}
commands =
{envpython} -m pylint \
--load-plugins pylint_pydantic \
--disable=import-error \
--ignored-modules=instructlab.dolomite,instructlab.eval,instructlab.schema,instructlab.sdg,instructlab.training \
src/instructlab/ tests/
[testenv:ruff]
description = lint and format check with ruff
basepython = {[testenv:py3]basepython}
labels = fastverify
skip_install = True
skipsdist = true
# keep in sync with .pre-commit-config.yaml
deps =
ruff==0.5.0
isort==5.11.5
commands =
ruff check .
ruff format --diff .
isort --check --diff .
[testenv:fix]
description = reformat and fix violations with ruff
basepython = {[testenv:py3]basepython}
skip_install = True
skipsdist = true
deps = {[testenv:ruff]deps}
commands =
ruff check {posargs:--fix} .
ruff format .
isort .
[testenv:tomllint]
description = lint and format pyproject.toml
skip_install = true
skipsdist = true
deps =
commands =
make toml-lint
make toml-fmt
sh -c 'git diff --exit-code || (echo "pyproject.toml formatting is incorrect. Please run \"make toml-fmt\" and commit the changes." && exit 1)'
allowlist_externals = make, sh
[testenv:spellcheck]
description = spell check (needs 'aspell' command)
basepython = {[testenv:py3]basepython}
labels = fastverify
skip_install = true
skipsdist = true
deps =
pyspelling
commands =
sh -c 'command -v aspell || (echo "aspell is not installed. Please install it." && exit 1)'
{envpython} -m pyspelling --config {toxinidir}/.spellcheck.yml --spellchecker aspell
allowlist_externals = sh
[testenv:docs]
description = sphinx docs and man pages
basepython = {[testenv:py3]basepython}
deps =
-r docs/requirements.txt
# TODO: switch to a release tag when it's cut
# We need https://github.com/click-contrib/click-man/pull/62 to handle hidden options
git+https://github.com/click-contrib/click-man@24ec8377e3c24378417f6fc4f571b4f585d7df6b
commands =
sphinx-build -M html docs docs/build -j auto --keep-going {posargs:--fail-on-warning --fresh-env -n}
click-man --target {toxinidir}/man ilab
[testenv:mypy]
description = Python type checking with mypy
basepython = {[testenv:py3]basepython}
deps =
mypy>=1.10.0,<2.0
types-PyYAML
types-requests
types-tqdm
pytest
commands =
mypy {posargs}
[gh]
python =
3.11 = py311-{unitcov, functional}
3.10 = py310-{unitcov, functional}