Repository navigation
Conversation
|
this looks good to me. Could you please make the ultra minor nit requests, then we'll merge. |
| - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | ||
| with: | ||
| python-version: ${{ matrix.version }} | ||
| - uses: astral-sh/setup-uv@v3 |
There was a problem hiding this comment.
please use a hash for the version.
| pip install -r requirements/build_requirements.txt | ||
| pip install pytest pytest-xdist hypothesis | ||
| - name: Build and test | ||
| run: spin test No newline at end of file |
rgommers
left a comment
There was a problem hiding this comment.
Thanks @ngoldbaum!
+1 for moving to setup-uv. I think moving from the python.org binaries to the python-build-standalone ones should not matter in principle, so no worries there.
I'd avoid using a venv by default unless there's a compelling reason to do so (see my inline comment for more details).
In the step where the build environment is set up, there's an issue visible:
Defaulting to user installation because normal site-packages is not writeable
Perhaps that will also go away when dropping the venv usage.
| uv python install ${{ matrix.version }} | ||
| uv venv --python ${{ matrix.version }} | ||
| . .venv/bin/activate | ||
| echo PATH=$PATH >> $GITHUB_ENV |
There was a problem hiding this comment.
This seems like either a misunderstanding in how to use setup-uv, or a bug in setup-uv. Its docs claim that it's a drop-in replacement for setup-python, and we don't need this kind of path manipulation with setup-python.
It's possible that the cause is trying to use a venv. That is not what we do in CI jobs usually, and is not necessary / just extra overhead. Is there a reason for doing this?
There was a problem hiding this comment.
uv doesn't yet support setting up a global python environment (see the "important" note below the spot I linked), so I either need to use a virtualenv or I need to replace direct python invocations with uv run. That means I need to update meson_actions/action.yml, which means I also need to update the linux SIMD tests, since those tests use meson_actions/action.yml. I'm poking around at doing that and hopefully that's not too bad, but I hope you see why I tried using a virtualenv first.
There was a problem hiding this comment.
So I poked at this, and it looks like uv really doesn't want me to directly use the global uv environment. If I try to force it to do that, I get errors like:
error: The interpreter at /home/runner/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu is externally managed, and indicates the following:
This Python installation is managed by uv and should not be modified.
Consider creating a virtual environment with `uv venv`.
Error: Process completed with exit code 2.
I opened an issue to ask about this on the setup-uv repo: astral-sh/setup-uv#124
But for now, I think if we want to use setup-uv, we're more-or-less forced to use a virtualenv. I'll try to figure out where the "Defaulting to user installation because normal site-packages is not writeable" message is coming from.
There was a problem hiding this comment.
If a virtualenv is needed, having the user mess with $GITHUB_ENV is pretty bad UX. setup-pixi does this in a nicer way, by simply adding activate-environment: true: https://github.com/prefix-dev/setup-pixi?tab=readme-ov-file#environment-activation. That shouldn't be too hard to implement, so I hope setup-uv will gain that as well.
[skip azp] [skip cirrus]
|
Well, unfortunately, nothing is ever as easy as I'd like. The issue Ralf pointed out was caused by me unintentionally using the system pip. After making sure there's a pip in the uv python environment I was able to get the tests to run, but there are some issues that look like they're caused by using the python-build-standalone python instead of a python.org python.
See this CI run if you're curious for more details about these failures. This is getting complicated enough I think I'm going to give up on completely replacing |
|
Also worth noting that I can reproduce all these failures locally on Python 3.11 on Linux using UV's python install. |
|
Might be worth reporting the bugs to |
Yup, reporting these issues is on my backlog now.
So I'd still like to get the free-threaded Mac CI, which does seem to be working. I'd also like to replace deadsnakes with uv for the linux free-threaded job since I have that figured out. The issues all seem to be in old versions of python.
Agreed. |
19ad5ee to
b20541b
Compare
|
This is cool to see! I'm happy to help unblock ya'll with changes to |
|
Closing in favor of #27707 |
This adds testing on MacOS for free-threaded Python and streamlines the linux tests.
In both cases I'm using
setup-uvto get python. It turns out to be trivial to replacesetup-pythonwith it. The main advantage is it has native support for free-threaded Python.Unfortunately I'm hitting some issues with spin on Windows (see scientific-python/spin#241 for an upstream fix) when I install python with the setup-uv action, so I'm holding off on adding Windows CI for now.