-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathtox.ini
More file actions
150 lines (135 loc) · 3.9 KB
/
tox.ini
File metadata and controls
150 lines (135 loc) · 3.9 KB
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
# SPDX-License-Identifier: Apache-2.0
[tox]
requires =
tox>=4
tox-uv
envlist = ruff, lint, mypy, py3-unit
minversion = 4.4
[testenv]
description = run tests
package = wheel
wheel_build_env = pkg
# Use uv for package installation and management
runner = uv-venv-runner
uv_seed = true
deps =
pytest
install_command = uv pip install \
-c constraints-dev.txt \
{opts} {packages}
passenv =
PATH
[testenv:py3]
basepython = python3.11
[testenv:py3-unit]
description = run unit tests with pytest
basepython = python3.11
passenv =
PATH
HF_HOME
INSTRUCTLAB_NCCL_TIMEOUT_MS
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:-DGGML_NATIVE=off}
deps =
-r requirements-dev.txt
commands = {envpython} -m pytest tests/unit {posargs}
# NOTE: {posargs} is a placeholder for input positional arguments
# such as `tox -e py3-unit -- --pdb` if we wanted to run pytest with pdb enabled.
# `--` delimits flags that are meant for tox vs. those that are positional arguments for
# the command that's being run in the environment.
[testenv:py3-smoke]
description = run accelerated smoke tests with pytest
basepython = python3.11
passenv =
PATH
HF_HOME
INSTRUCTLAB_NCCL_TIMEOUT_MS
deps =
-r requirements-dev.txt
-r requirements-cuda.txt
commands = {envpython} -m pytest tests/smoke {posargs}
# 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}
skip_install = true
skipsdist = true
deps = -r requirements-dev.txt
commands =
{envpython} -m pylint --load-plugins pylint_pydantic src/instructlab/training/
[testenv:fastlint]
description = fast lint with pylint (without 3rd party modules)
basepython = {[testenv:py3]basepython}
skip_install = true
skipsdist = true
deps =
pylint
pylint-pydantic
commands =
{envpython} -m pylint --load-plugins pylint_pydantic {posargs:--disable=import-error src/instructlab/training/}
[testenv:ruff]
description = reformat and fix code with Ruff (and isort)
basepython = {[testenv:py3]basepython}
skip_install = True
skipsdist = true
# keep in sync with .pre-commit-config.yaml
deps =
ruff
isort
# supports 'fix', 'check', or abitrary args to 'ruff' command
commands =
./scripts/ruff.sh {posargs:fix}
allowlist_externals = ./scripts/ruff.sh
[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:mypy]
description = Python type checking with mypy
basepython = {[testenv:py3]basepython}
skip_install = true
skipsdist = true
deps =
mypy
types-tqdm
types-PyYAML
pytest
pydantic
commands =
mypy {posargs:src}
[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 .
# Used by `update-constraints` `ci-actions` reusable action, see:
# https://github.com/instructlab/ci-actions/blob/main/actions/update-constraints/update-constraints.md
#
# To re-generate the constraints file locally, run:
# `tox -e constraints -- ./ci-actions/update-constraints/generate_constraints.sh`
[testenv:constraints]
description = Generate new constraints file(s)
basepython = {[testenv:py3]basepython}
skip_install = True
skipsdist = true
deps =
uv==0.7.8
torch # work around flash-attn not listing its build dependencies in package metadata
commands = {posargs}
allowlist_externals = *