Use uv for installing dependencies on all Linux-only CI jobs#11515
Conversation
JelleZijlstra
left a comment
There was a problem hiding this comment.
I'm OK with doing this, thanks! A few questions.
| - uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: "3.11" | ||
| cache: pip |
There was a problem hiding this comment.
Does losing this cache have a significant cost?
There was a problem hiding this comment.
With pip + the cache it took 10s. With uv without the cache it takes 1s. So I think we just don't need to worry about caching installs anymore with uv?
There was a problem hiding this comment.
It only cached the download, not the install anyway. It probably helped avoid connection issues with PyPI more than anything
| run: echo "$PWD/.venv/bin" >> $GITHUB_PATH | ||
| - name: List 3rd-party stub dependencies installed | ||
| run: pip freeze --all | ||
| run: uv pip freeze |
There was a problem hiding this comment.
Does uv not do the thing where setuptools etc. are only listed if you pass --all?
There was a problem hiding this comment.
uv doesn't install setuptools/pip/wheel into environments the way the stdlib venv module does, unless you explicitly ask for them with --seed (because, the theory goes, you don't need any of them if you have uv). Newly created environments come completely empty. So even if uv had a --all flag for uv pip freeze (it doesn't currently), we wouldn't need to use it
There was a problem hiding this comment.
And I assume that it does, by default, list setuptools/pip etc if they are installed into an environment. Though I haven't checked.
hauntsaninja
left a comment
There was a problem hiding this comment.
Hooray! It'll be great when we use uv in mypy_primer too
Using
uvrather than pip means our requirements are installed almost instantly in CI, compared to around 10s to install ourrequirements.txtfile currently on each job.I've only changed the jobs that are Linux-only in this PR.
uvworks fine on Windows, but it's slightly fiddly to installuvin a workflow that runs on both Windows and Linux without using pip (which is slow, defeating the point of the exercise). It's possible to install uv in a cross-platform workflow without using pip, but I wasn't sure it was worth the added complexity for us here.