-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 first-class support for virtual projects #6511
Comments
There's an argument to be made that this should be the default if you don't define a build system. I'm also open to that. |
I am going to prototype this later today. |
Thanks Charlie. This will definitely help users working in monorepos and legacy codebases that contain many nested packages/scripts without clear boundaries for various components of their applications/libraries. It’s an architectural issue for sure, and outside of massively refactoring products/projects, not really solvable in the short term, so it is nice to see |
Yeah I think this is something we missed on slightly in the initial release. I'm gonna prioritize it. |
Rather than the venv-in-project approach (which I personally prefer), lot of users just set up various OCI images for various “environments” that have the python dependencies pre-installed in a custom virtual environment location. These are effectively virtual projects, and it goes hand in hand with being able to define custom virtual environment locations (several issues about it #1495 / #5229 / #6504). Conda is strong enabler of this type of workflow so having compatibility with it would ease migration for thousands of users. |
Please see #1495 for that — let's try to avoid expanding the scope of this discussion :) |
Highly unlikely that this ships today, but I'm starting to work on it. |
Coming together in #6585. |
Using uv to "just manage my environment of dependencies" sounds natural and useful. There was one kind of friction seen with Rye users with virtual projects, where they enable virtual project to achieve some goal (like not installing the root package, or not having to define how to create a proper wheel) but other things they want (pytest? editor support?) would benefit from installing the project as a python package in an environment. I'm just wondering how to make it very clear what's happening so that the trade-offs are apparent to the user? Are pipx and uv tool good points for why uv virtual project is not <=> "application", because you need applications distributed through pipx/uv tool to be "pip-installable"? |
Hi, @charliermarsh does the above PR fix the "issue 2" mentioned in the first message so that you can have dev and non-dev dependencies? I started porting my application from poetry using |
v0.4.0 is a massive jump for those of us working on "application" projects, thank you! But I still can't see how to install dev dependencies in my local virtualenv. From the docs I see I can do [tool.uv]
dev-dependencies = [
"ruff",
] But I don't know how to install them along with the non-dev $ uv pip install -r pyproject.toml --dev but that's not a valid argument. |
You should use |
@philgyford the |
Ah, thank you! I obviously got confused, and am still not really clear about the difference. I'll have to read through all the docs again. I was probably thrown by how I use pip-tools locally (although maybe I'm doing that wrong too!). |
A lot of users don't want to structure their projects as valid Python packages -- perhaps they're creating a web application, or a collection of scripts, etc. These all can be structured as valid Python packages, but users tend not to do this. Requiring that projects are valid Python packages makes it harder for existing users to adopt uv.
Today, we allow "virtual projects" (i.e., without a build system) for workspace roots, but only for workspace roots.
This has several issues...
[tool.uv.workspace]
which is confusing for users.[project]
table. For example, there's no way to define a required python version in a "virtual project" (i.e., a virtual workspace root with no members).pyproject.toml
to virtual, you have to remove basically everything, move things around, etc.What I want to do is, allow users to set:
If set, they can have a
[project]
table, they don't need a workspace definition, etc. And in this case, we don't build or install the project, just like a virtual workspace root today.In the future, we'd like to write our own build system that handles these cases better by default. But for now, this will help a lot of users.
The text was updated successfully, but these errors were encountered: