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

Introducing tox-uv #2667

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft

Introducing tox-uv #2667

wants to merge 20 commits into from

Conversation

emdneto
Copy link
Member

@emdneto emdneto commented Jul 5, 2024

uv makes pip install faster. It works like this: uv pip install and we can have tests running faster locally and in CI. The tool is from the creators of ruff.

The main improvement I see here is the Dependency caching and fast resolution of packages during pip install. We can benefit from this for local development to avoid slow tests, mainly the git clones in contrib tests.

This PR also introduces the usage of tox-uv which is a tox plugin that supports venv runner with uv.

At this first moment, I'm proposing an opt-in usage, so you need to pass an environment variable to make use of the UV feature.

@emdneto emdneto changed the title testing uv WIP uv Jul 5, 2024
tox.ini Outdated Show resolved Hide resolved
Copy link
Contributor

@zhihali zhihali left a comment

Choose a reason for hiding this comment

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

The result is quite interesting, the uv indeed quicker than pip. I run 6 times for asgi and wsgi, and got these results. Maybe the times I try not enough, but we could roughly say this is a good optimization.

WSGI Results

Tool Run Setup Time Command Time Total Time
pip 1 0.19s 25.32s 25.65s
pip 3 0.34s 23.51s 23.99s
pip 4 0.05s 24.17s 24.35s
uv 2 4.50s 1.68s 6.31s
uv 5 0.71s 0.97s 1.81s
uv 6 0.04s 1.03s 1.19s

WSGI Average Times:

  • pip: 24.66s
  • uv: 3.10s (excluding first run: 1.50s)

ASGI Results

Tool Run Setup Time Command Time Total Time
pip 2 0.05s 25.21s 25.39s
pip 3 0.05s 22.62s 22.80s
pip 4 0.05s 20.53s 20.71s
uv 1 1.12s 14.28s 15.53s
uv 5 0.05s 8.48s 8.67s
uv 6 0.05s 8.04s 8.22s

ASGI Average Times:

  • pip: 22.97s
  • uv: 10.81s (excluding first run: 8.45s)

@emdneto
Copy link
Member Author

emdneto commented Jul 9, 2024

The result is quite interesting, the uv indeed quicker than pip. I run 6 times for asgi and wsgi, and got these results. Maybe the times I try not enough, but we could roughly say this is a good optimization.

WSGI Results

Tool Run Setup Time Command Time Total Time
pip 1 0.19s 25.32s 25.65s
pip 3 0.34s 23.51s 23.99s
pip 4 0.05s 24.17s 24.35s
uv 2 4.50s 1.68s 6.31s
uv 5 0.71s 0.97s 1.81s
uv 6 0.04s 1.03s 1.19s
WSGI Average Times:

  • pip: 24.66s
  • uv: 3.10s (excluding first run: 1.50s)

ASGI Results

Tool Run Setup Time Command Time Total Time
pip 2 0.05s 25.21s 25.39s
pip 3 0.05s 22.62s 22.80s
pip 4 0.05s 20.53s 20.71s
uv 1 1.12s 14.28s 15.53s
uv 5 0.05s 8.48s 8.67s
uv 6 0.05s 8.04s 8.22s
ASGI Average Times:

  • pip: 22.97s
  • uv: 10.81s (excluding first run: 8.45s)

Yeah got similar results here. Thanks for that @zhihali. Greatly appreciated. The ASGI is slower because I left the test requirements install using pure pip purposely to see the difference

@xrmx
Copy link
Contributor

xrmx commented Jul 10, 2024

8wgjxj

@emdneto emdneto added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jul 17, 2024
@emdneto emdneto changed the title WIP uv Introducing tox-uv Jul 17, 2024
@emdneto emdneto marked this pull request as ready for review July 17, 2024 21:09
@emdneto emdneto requested a review from a team July 17, 2024 21:09
Copy link
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

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

I like this, is there a reason you stopped converting halfway tox.ini?

@emdneto
Copy link
Member Author

emdneto commented Jul 18, 2024

I like this, is there a reason you stopped converting halfway tox.ini?

No big reason. Just wanted to get some opinions before moving forward with all the changes

CONTRIBUTING.md Outdated Show resolved Hide resolved
Copy link
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

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

There are also docs and docker-tests environments that can be converted

@emdneto emdneto marked this pull request as draft July 19, 2024 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants