-
-
Notifications
You must be signed in to change notification settings - Fork 367
add initial tox.ini #3196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add initial tox.ini #3196
Changes from all commits
4dfeac6
130ff64
bc0ed8d
a020836
eeef5bd
6d2a0f5
b10d700
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
[tox] | ||
envlist = py{39,310,311,312,313,314,py310} | ||
labels = | ||
check = typing, gen_exports, type_completeness, pip_compile | ||
cython = py39-cython2,py39-cython,py311-cython2,py313-cython | ||
|
||
# TODO: | ||
# * environment to check coverage | ||
# * replace ci.sh | ||
# * --verbose --durations=10 | ||
# * -p _trio_check_attrs_aliases | ||
# * mypy cache | ||
# * LSP | ||
# * apport | ||
# * use tox in CI | ||
# * switch to nox? | ||
# * move to pyproject.toml? | ||
# * this means conditional deps need to be replaced | ||
|
||
# protip: install uv-tox for faster venv generation | ||
|
||
[testenv] | ||
jakkdl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
description = "Base environment for running tests depending on python version." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jakkdl is configparser able to handle the quotes well? I think this is the first time I see them in this context.. Does the output of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ...no 😅
|
||
# use wheels instead of sdist, significantly faster install | ||
package = wheel | ||
wheel_build_env = .pkg | ||
deps = | ||
hypothesis: hypothesis | ||
-r test-requirements.txt | ||
set_env = | ||
slow: TOX_RUN_SLOW = '--run-slow' | ||
commands = | ||
pytest {env:TOX_RUN_SLOW:} {posargs} | ||
|
||
[testenv:no_test_requirements] | ||
description = "Run tests without optional test-requirements, to see we don't accidentally depend on a library not specified in depends." | ||
deps = | ||
pytest | ||
commands = | ||
pytest --skip-optional-imports {posargs} | ||
|
||
[testenv:docs] | ||
description = "Build documentation into docs/build." | ||
deps = | ||
-r docs-requirements.txt | ||
# base_python synced with .readthedocs.yml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can also make RTD just call tox in a follow-up. This is what I do these days. |
||
# To avoid syncing we can make RTD call the tox environment | ||
base_python = 3.11 | ||
commands = | ||
sphinx-build {posargs:--fresh-env} docs/source docs/build | ||
|
||
[testenv:py39-cython2,py39-cython,py311-cython2,py313-cython] | ||
description = "Run cython tests." | ||
deps = | ||
cython | ||
cython2: cython<3 | ||
setuptools ; python_version >= '3.12' | ||
commands_pre = | ||
python --version | ||
cython --version | ||
cythonize --inplace -X linetrace=True tests/cython/test_cython.pyx | ||
commands = | ||
python -m tests.cython.run_test_cython | ||
|
||
[testenv:gen_exports] | ||
description = "Run gen_exports.py, regenerating code for public API wrappers." | ||
deps = | ||
-r test-requirements.txt | ||
base_python = 3.13 | ||
commands = | ||
python ./src/trio/_tools/gen_exports.py --test | ||
|
||
[testenv:pip_compile] | ||
description = "Run pre-commit job pip-compile" | ||
base_python = 3.13 | ||
commands = | ||
pre-commit run pip-compile --all-files | ||
|
||
# TODO: allow specifying e.g. typing-3.11 to run with --python[-]version=3.11 | ||
[testenv:typing] | ||
description = "Run type checks: mypy on all platforms, and pyright on `src/trio[/_core]/_tests/type_tests/`." | ||
deps = | ||
-r test-requirements.txt | ||
exceptiongroup | ||
base_python = 3.13 | ||
set_env = | ||
PYRIGHT_PYTHON_IGNORE_WARNINGS=1 | ||
commands = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's also add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. python versions are specified in edit: ah you mean parametrizing the version |
||
# use mypy_annotate if running in CI? if not, should remove it | ||
mypy --platform linux | ||
mypy --platform darwin | ||
mypy --platform win32 | ||
Comment on lines
+90
to
+92
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hm. Maybe, but I'll procrastinate on it a little bit, and see what the output looks like in practice. I suspect the end result is going to be removing |
||
|
||
pyright src/trio/_tests/type_tests | ||
pyright src/trio/_core/_tests/type_tests | ||
|
||
[testenv:type_completeness] | ||
description = "Check type completeness, using our wrapper around pyright --verifytypes." | ||
deps = | ||
-r test-requirements.txt | ||
exceptiongroup | ||
base_python = 3.13 | ||
set_env = | ||
PYRIGHT_PYTHON_IGNORE_WARNINGS=1 | ||
commands = | ||
python src/trio/_tests/check_type_completeness.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to use
tox-uv
too. Though, it's okay to omit. Especially in the initial effort.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure there's much, if any, speedup when we're only running a single environment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't compared them, but I'd imagine that provisioning that env would be faster. You don't separate the provisioning step in this PR, so I can't see how much it takes. But it's probably not important enough right now.