Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

add initial tox.ini #3196

wants to merge 5 commits into from

Conversation

jakkdl
Copy link
Member

@jakkdl jakkdl commented Jan 31, 2025

I started out on a tox.ini because it's handy to have; it's not complete enough to close #3170, but it should be sufficient for #2699 once the CI is updated to use it.

everybody's very welcome to push commits to this PR, but I don't think we should block merging it until the tox/nox config is perfect (leaving that for followup PRs) Cause I Wanna Use It ™️

@jakkdl
Copy link
Member Author

jakkdl commented Feb 14, 2025

ugh, native toml not supporting https://tox.wiki/en/latest/config.html#conditional-settings makes it a non-trivial conversion. I think the way to get around that is with more explicit environments + https://tox.wiki/en/latest/config.html#string-substitution-references; but... that's for another day/person

@jakkdl
Copy link
Member Author

jakkdl commented Feb 14, 2025

If you review ci.sh with ignoring whitespace: https://github.com/python-trio/trio/pull/3196/files?w=1
you see that it's solely just removing the CHECK_FORMATTING logic.

I propose delaying further CI/ci.sh/tox-gh stuff for future PR's, as that quickly gets very messy.

Copy link
Member

@CoolCat467 CoolCat467 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this mostly makes sense, wondering about mypy runs, and I thought there was some sort of tox github actions thing that was useful for some reason the last time I used tox.

Comment on lines +77 to +79
mypy --platform linux
mypy --platform darwin
mypy --platform win32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this use mypy_annotate?

@webknjaz
Copy link
Member

@jakkdl thanks for pinging! Love that it's being worked on. I'll review shortly :)

@webknjaz
Copy link
Member

  • I probably prefer having this in pyproject.toml

I'd vote for tox.toml since dumping multiple things into one terribly huge config is going to be difficult to maintain.

- name: Check Formatting
if: matrix.check_formatting == '1'
run:
python -m pip install tox &&
Copy link
Member

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.


# protip: install uv-tox for faster venv generation

[testenv]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add description = to every env? It should explain what they do and would be printed out via tox l or tox -av.

[testenv:docs]
deps =
-r docs-requirements.txt
# base_python synced with .readthedocs.yml
Copy link
Member

Choose a reason for hiding this comment

The 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.

Comment on lines +51 to +54
commands =
cythonize --inplace -X linetrace=True tests/cython/test_cython.pyx
python --version
cython --version
Copy link
Member

@webknjaz webknjaz Feb 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These aren't tests, semantically:

Suggested change
commands =
cythonize --inplace -X linetrace=True tests/cython/test_cython.pyx
python --version
cython --version
commands_pre =
python --version
cython --version
cythonize --inplace -X linetrace=True tests/cython/test_cython.pyx
commands =

base_python = 3.13
set_env =
PYRIGHT_PYTHON_IGNORE_WARNINGS=1
commands =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also add --python-version= in follow-ups.

@webknjaz
Copy link
Member

and I thought there was some sort of tox github actions thing that was useful for some reason the last time I used tox.

@CoolCat467 there's a plugin: https://github.com/tox-dev/tox-gh. It also demonstrates separating the invocation into preparation and testing. But I think this is something to look into separately, beyond the initial effort. I don't exactly like how the jobs are mixed up right now, but I believe this is out of the scope, so I choose not to start those discussions just yet.

Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is ready to be merged and can be iterated on separately. Though, if you have a minute to accept the commands_pre thing and add descriptions, it'd be nice to include into the scope of this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace check.sh and/or ci.sh with tox/nox
3 participants