-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
feat: support for uv-installed pythons #842
Conversation
I think it makes sense, especially if it's roughly this easy. :) |
@henryiii i've updated this a bit, but there is a failing test locally |
im not happy about ignoring the uv-python cases for those windows tests, but i am not familiar with how nox works on windows to touch that part, so if anyone has any ideas it'll be helpful |
@saucoide Just want to express my appreciation for this PR. This has already made my life way easier! |
caused problems with pypy
thanks but tbh i wouldn't use it just yet 😅 there is still something wrong with it, the tox-to-nox tests fails mixing up the interpreter depending on which order the tests are run, so there is something broken still |
ok so this may be an issue with uv (or with how i thought it would behave) looks like if you run
and then later on
uv will go ahead and use the existing pypy to make the venv, will try to figure out if this is intended from uv's side or not |
I wonder if we could make pythonX -> cpythonX for uv? Just a thought. |
yes I think we might have to, originally i thought passing it as-is to uv would be nice, because you can then specify the python with uv's own version syntax, and whatever versions they support e.g. ill try to test tomorrow with replacing python/cpython |
remove if statement & handle missing uv in the function
looks the uv people were faster so it works without changes now, this latest version seems ok |
@henryiii could you review and let me know if you think this approach is ok? |
I think this is great, my only question is if we should have some control for this. We could in theory add downloading to the other backends (similar to how PDM and Hatch download Pythons - and it comes from the same place as uv's), so maybe we should have |
do you mean nox doing the downloading itself, or checking if hatch/pdm/uv are in path and use whatever is available to get the version requested? |
I believe PDM’s downloader is a standalone Python library we could use. But yes, nox downloading it itself. |
yeah that sounds useful, what would be the behaviors of
i can try to experiment a bit next week and see if i get something working (this week's a bit busy for me) |
Yes, that's exactly what I was thinking. The current behavior is "auto" for uv, and "never" for the other backends. (Actually, not sure about conda, that might be "always"). |
This caught me completely by surprise in CI when I pre-installed Python with uv, only to have nox install and run my tests under a different version because I omitted the "t" suffix and even though I'd passed |
@layday |
Thanks for the hint. |
Another issue I've noticed: this will install some uv pythons. Then subsequent uses of uv like
Simi-related, we should also make sure we fully support |
I tried to reproduce that but for me:
That works for me and this project doesn't have a
So I think if no what version of 3.13 was it? for me it currently installs an ps: i still want to try to add the options to control download + with other backends too but im currently travelling on vacations so i haven't found the time yet |
A question more than a PR, now that
uv
supports bringing its own pythons, i wanted to try simplify a CI and not have to install python from other sources, butnox
is currently now able to find uv-installed pythons (someone else's issue @UV about this same thing astral-sh/uv#6579 )would it make sense to add a more fleshed out version of this? meaning passing the desired interpreter to
uv venv -p {interpreter}
, or should this be done by other mechanism that adds uv's python interpreters to$PATH
?note: this is just a draft to show an example, kind of works but also breaks tests and probably breaks
uv|virtualenv
and other things