-
Notifications
You must be signed in to change notification settings - Fork 752
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
Add --no-install-*
to add
/remove
/run
and add env vars
#6578
Comments
Can you share more about the use-case here? We added I'm not necessarily opposed, but I think we should be careful here — we moved fast to deliver that feature because it's critical for Docker workflows but I'm not sure I understand this use-case as much. |
I also need this feature. Our use case is that we are frequently not creating python packages like this pattern assumes, but we are instead defining the dependencies using UV that are packaged alongside our source code which gets deployed into lambdas as part of serverless infrastructure. The .egg-info file that gets created for the project is unnecessary, especially since the various lambdas that compose the service will each independently define their own entry points (a single "handler" function) within the same src folder. I'd also prefer to have the ability to set |
I don't think you're looking for |
Yep agree with not providing too many options unless they really make sense. My use case is for https://github.com/fpgmaas/deptry, where we use In the CI, we have a dedicated job that validates documentation with But when we run We technically have other options, so it's not a blocker at all. For instance I guess we could:
Of course, since |
Thanks for the details! We have the same problem here in the uv repository. We do
right now. Obviously this isn't ideal though. I think "project-level" tools is what you're looking for here (#3560) but we don't support that yet and need to do some design work first. I think |
Ah! I think I'm just making some assumptions based on my unfamiliarity with the terminology in this project so far - thank you for pointing out that PR! I'll just patiently wait for that one. |
No prob, I mostly just think we can do a better job of solving your problem that way :) |
@jfgordon2 the alternate approach is available in uv 0.4.0 now. |
The change in uv 0.4.0 still doesn't fix the scenario when running |
There's |
Yes, it runs normally. |
There is --frozen but is there a uv run --no-sync? Just something to say don't do anything, just use the venv as it is (but it's not no-project, I'm running w.r.t the current project's workspace and virtualenv) |
edit: The above is wrong, I misunderstood. |
I thought frozen would be it, but it installs packages if they are missing. To clarify I'm looking for a flag that makes uv run never modify the virtualenv. Here's a minimal reproducer. Yes I am deleting the venv -- making it empty -- in this example. uv init --package testrun
# Initialized project `testrun` at `/home/user/testrun`
cd testrun/
uv sync
# Using Python 3.12.3
# Creating virtualenv at: .venv
# ...
uv venv
# Using Python 3.12.3
# Creating virtualenv at: .venv
# Activate with: source .venv/bin/activate
uv run --frozen hello
# Installed 1 package in 1ms
# Hello from testrun! It would install more (dev-deps, other missing deps) if those existed in the example. |
|
Some options were added in #4028 to avoid the installation of some packages, including the project itself. Taking
--no-install-project
as an example, it works great when runninguv sync --no-install-project
, but as soon as we want to run a script/entrypoint throughuv run
later on, we'll still end up installing the project at some point.For instance, if we want to build documentation for a project, running
uv run mkdocs build
will install the project itself, which could take some time if the project is using Rust.Current workaround I found is to use
uv run --no-project mkdocs build
to avoid project discovery (assuming thatuv sync --no-install-project
was run beforehand), but I wonder if the 3 options added touv sync
should not also:do_sync
(add
,remove
,run
)The text was updated successfully, but these errors were encountered: