-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
Support for uv.lock #841
Comments
Would astral-sh/uv#6834 support this use case? It adds One thing to note about this is they expect to add a warning when VIRTUAL_ENV is set in a follow up PR: astral-sh/uv#6864. But even this only warns if UV_PROJECT_ENVRIONMENT and VIRTUAL_ENV don't match. I'll be looking forward to that support happening. |
JFTR |
seems like we could just make sure to export |
After experimenting with this it kind of breaks to do this via |
That seems a bit convoluted, it would make more sense to write up a proper bug report to Astral and ask them – they're usually quite receptive. What exactly is nox doing there? Could it already be fixed using |
I haven't had a chance to dig too far into the behavior to see how this is supposed to work. I don't consider it a bug just yet. maybe nox is using a different python version than I expect? |
nox-poetry does cc @cjolowicz |
Tangent: We don't really support plugins here - ideally, you nox would be able to install it's own plugins, rather than assuming people can inject an extra plugin into wherever nox is installed. I'd like to eventually support these better. |
I would like to contribute |
Could you describe your ideas first? You can start with a PR if that's easier. I was sort of waiting until the dependency groups and standardize lock file PEPs get resolution. |
Any news on this? |
My current prefered way is to use something like from the cookbook: https://nox.thea.codes/en/stable/cookbook.html#using-a-lockfile |
I think the environment feature will likely be pushed to the next release, but it still is the next major thing I want to work on. Recipes like the cookbook one should be fine until then. |
As @edgarrmondragon mentioned above, for me the use case I'm looking for is similar to what Specifically, any time This is also where supporting dependency groups would come in So that we could do something like: def test(session: Session):
session.install(".", groups=["test"])
... And this would install the |
I mean this is certainly more ergonomic than what I do but I just wrote an installer method that runs |
As existing work, |
@henryiii is there an issue to track plugin support? |
Plugin support is implemented in #881 but it's been stuck waiting for a review since October. |
@henryiii Now that the reference MR is merged Do you have recommendations for how can move tighter |
I think there are two possibilities. One would be to do a plugin, much like nox-poetry. (And that plugin should update examples to show how to use with the current system). That could be done at any time. The other is work I have planned (but haven't/wont start for a while), which would provide a new "environment" concept, where you could make an environment then define sessions on it. Combining that with lock support makes sense, IMO, and since uv is an integrated backend, it could be natively supported there. What I was thinking was something like this: @nox.env(path=".venv")
def dev(env: nox.Env) -> None:
env.install("some", "deps")
@dev.session
def test(session: nox.Session) -> None:
session.run("pytest") And native locking support could be something like this: @nox.env(path=".venv")
def dev(env: nox.Env) -> None:
env.sync()
... |
Given uv's native support for transient environments is there even any need for sessions at all? I've been able to run Nox with a disabled Python installation using just |
@henryiii I've been working on porting my projects from
nox.options.default_venv_backend = "uv|virtualenv"
I'll try to update this post for others as I go in case it's helpful. |
The only other one I can think of directly is sometimes you need |
Another
You cannot yet configure this (e.g., cannot opt out), however, and that is tracked in |
I have created a small tool that may be useful to others wanting to facilitate using |
Reminder, you can include the new PEP 723 support in your docs on how to use your plugin. If you have /// script
dependencies = ["nox>=2025", "nox-uv"]
/// The nox will download your plugin automatically before running! |
I noticed that the new PEP 723 support creates the python environment from whichever python is |
We need to support the Python range statement first (then it would be easy). #814 |
alright i'll keep an eye on that ticket then. |
How would this feature be useful?
uv added a cross-platform lock format in 0.3.0. I can see this to become a standard for packages to keep CI stable.
Given that
uv sync
doesn't have target-installations (yet), it's trickyDescribe the solution you'd like
I think it would be really cool if
session.install(".[tests]")
automatically discovered auv.lock
file and ranuv sync --extra tests
but I could live withsession.sync("extras")
too.Either would improve the overall Python DX tremendously.
Describe alternatives you've considered
Hand-craft it, I guess? One has to do manual change directories etc tho.
Anything else?
No response
The text was updated successfully, but these errors were encountered: