-
Notifications
You must be signed in to change notification settings - Fork 40
/
tox.ini
97 lines (87 loc) · 3.04 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
# 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}
minversion = 4.4
[testenv]
description = run tests (unit, unitcov, functional)
# 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
package = wheel
wheel_build_env = pkg
deps = -r requirements-dev.txt
commands =
unit: {envpython} -m pytest {posargs:tests --ignore=tests/functional}
unitcov: {envpython} -W error::UserWarning -m pytest --cov=instructlab.sdg --cov-report term --cov-report=html:coverage-{env_name} --cov-report=xml:coverage-{env_name}.xml --html=durations/{env_name}.html {posargs:tests --ignore=tests/functional -m "not (examples or slow)"}
functional: {envpython} -m pytest {posargs:tests/functional}
allowlist_externals =
functional: ./scripts/functional-tests.sh
[testenv:py3-functional]
setenv =
OPENAI_API_BASE={env:OPENAI_API_BASE:http://localhost:8000/v1}
OPENAI_API_KEY={env:OPENAI_API_KEY:EMPTY}
# format, check, and linting targets don't build and install the project to
# speed up testing.
[testenv:lint]
description = lint with pylint
skip_install = true
skipsdist = true
deps = -r requirements-dev.txt
commands =
{envpython} -m pylint --load-plugins pylint_pydantic src/instructlab/sdg/
[testenv:fastlint]
description = fast lint with pylint (without 3rd party modules)
skip_install = true
skipsdist = true
deps =
pylint
pylint-pydantic
commands =
{envpython} -m pylint --load-plugins pylint_pydantic {posargs:--disable=import-error src/instructlab/sdg/}
[testenv:ruff]
description = reformat and fix code with Ruff (and isort)
skip_install = True
skipsdist = true
# keep in sync with .pre-commit-config.yaml
deps =
ruff==0.3.4
isort==5.11.5
# supports 'fix', 'check', or abitrary args to 'ruff' command
commands =
./scripts/ruff.sh {posargs:fix}
allowlist_externals = ./scripts/ruff.sh
[testenv:spellcheck]
description = spell check (needs 'aspell' command)
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:mypy]
description = Python type checking with mypy
# Note: 'mypy<1.14' by default pulls the latest 'pydantic' release as a dependency, but 'pydantic>=2.10' does not
# work with 'mypy<1.14', so for compatibility purposes, we set 'pydantic<=2.9.2'
deps =
mypy>=1.10.0,<1.14
types-PyYAML
pytest
pydantic<=2.9.2
commands =
mypy src
[testenv:validate-pipelines]
description = Validate pipeline yaml configs
skip_install = true
skipsdist = true
deps = -r requirements-dev.txt
commands =
{envpython} ./scripts/validate_pipelines.py
[gh]
python =
3.11 = py311-{unitcov, functional}
3.10 = py310-{unitcov, functional}