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

DEP: make pyproject.toml the one source of truth for test-only dependencies #532

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

Conversation

neutrinoceros
Copy link
Member

This PR does 3 things:

One source of truth

Dependency groups

Move dev-only dependency specifications from tox.ini to pyproject.toml as PEP 735 Dependency Groups.

The PEP was accepted a couple weeks ago and is already supported by tox as well as uv, which allow running tests without tox as, for instance

uv run --group test pytest

Rely on uv's dependency resolver to test with pinned versions

Avoid duplication of metadata for oldest supported versions of our dependencies by switching dependency resolution strategy. This is supported by uv (via tox-uv).
Notes:

  • this also means that test dependencies (e.g. pytest) are pinned as well (good)
  • using this strategy requires setting explicit minimal requirements everywhere (otherwise one gets the oldest version in existence, which in a very general way is completely broken)
  • in order to properly test this on my setup (Apple Silicon), I needed to add a layer of requirements specifically for this platform (as our absolute-oldest supported versions work on ubuntu but are generally lacking support for Apple Silicon)

Drop pytest-cov

I removed pytest-cov from our testing pipeline, as it's a completely unnecessary layer of indirection between pytest and coverage. I switched to direct invokes to coverage.

While I was at it, I also re-organized tox.ini a bit (mostly moving lines around).

@neutrinoceros neutrinoceros force-pushed the dep/pep735_test_deps branch 2 times, most recently from 8ee31ff to b1745fc Compare October 29, 2024 11:14
@neutrinoceros
Copy link
Member Author

Apparently something I did broke tox env selection in CI so every job runs every env. I don't know yet if that's the reason it's failing, or if that's a different problem.

@neutrinoceros neutrinoceros force-pushed the dep/pep735_test_deps branch 2 times, most recently from a7ab028 to 45c2d57 Compare October 29, 2024 12:05
@neutrinoceros neutrinoceros changed the title DEP: make pyproject.toml the one source of truth for test-only dependencies" DEP: make pyproject.toml the one source of truth for test-only dependencies Oct 29, 2024
@neutrinoceros
Copy link
Member Author

I resolved the problem mentioned above by using tox-gh (first party plugin) instead of tox-gh-actions (third party plugin). This could probably be avoided or simplified but I already spent > 3hrs on this so I'll quit while I'm ahead.

@neutrinoceros neutrinoceros marked this pull request as ready for review October 29, 2024 12:07
@neutrinoceros
Copy link
Member Author

an interesting side effect of using tox-uv in CI is that it saves a surprising amount of CPU time.
See for instance usage pages

  • before (total CPU time: 16m23s)
  • after (total CPU time: 11m2s)

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.

1 participant