Skip to content

Using uv to simplify and speedup the CI#2673

Merged
Avasam merged 6 commits intomhammond:mainfrom
Avasam:using-uv-to-simplify-and-speedup-the-CI
Dec 9, 2025
Merged

Using uv to simplify and speedup the CI#2673
Avasam merged 6 commits intomhammond:mainfrom
Avasam:using-uv-to-simplify-and-speedup-the-CI

Conversation

@Avasam
Copy link
Copy Markdown
Collaborator

@Avasam Avasam commented Oct 26, 2025

uv is a fast and modern (mostly) drop-in replacement for setup-python, pip, build, venv, twine1, made by the same folks as Ruff.
I've been using uv for over a year and it's a game-changer for packaging and environment management. pywin32 is pretty simple, being Windows-only and having no runtime dependencies, but we can still benefit from a pretty significant speedup.

In the times below, I omitted the slowest and fastest times in a job matrix as outliers. The exact time save is hard to say, but the trend is clear:

  • The CI step of installing Python (all jobs except native builds) goes from (sometimes2) 50-60s down to 6-14.
  • The CI step of installing build for cross-compilations goes from 3-14s down to 0 (no need to install extra dep)
  • The CI step of installing checkers dependencies from ~9s down to ~2s
  • The CI step of installing type-checkers dependencies from 37-44s down to ~3s

Footnotes

  1. Whilst uv publish can be used to replace twine for publishing, there are no changes needed to your current workflow and you can keep using twine as you were.

  2. Most of the time, the actions/setup-python step takes 6-18s, which would be equivalent, but it also sometimes randomly take around a minute for unknown reasons.

Comment on lines -41 to -42
cache: pip
cache-dependency-path: .github/workflows/main.yml
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

There already was nothing to cache here.

I also kept setup-python to keep testing in a global user install (this can still be done with uv if you pre-install Python, but at this point having actions/setup-python + astral-sh/setup-uv wouldn't bring any benefit for this step if there's no dependency to quickly install.

Comment thread .github/workflows/main.yml Outdated
@Avasam Avasam requested a review from mhammond November 9, 2025 18:26
Copy link
Copy Markdown
Owner

@mhammond mhammond left a comment

Choose a reason for hiding this comment

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

uv looks great - I guess I don't really see a downside here and a few upsides - thanks!

@Avasam Avasam merged commit 50c8426 into mhammond:main Dec 9, 2025
28 checks passed
@Avasam Avasam deleted the using-uv-to-simplify-and-speedup-the-CI branch December 9, 2025 06:04
@Avasam
Copy link
Copy Markdown
Collaborator Author

Avasam commented Dec 9, 2025

Glad you think so!
And yeah I wouldn't wanna force a contributor to use uv if I can avoid it. (Especially since being a drop-in replacement for pip is a selling point)

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.

2 participants