-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Is there a setting similar to the package-mode
in poetry?
#6434
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
Comments
We don't support this yet, but there's discussion about excluding the project from installation in various issues. What's your use-case for this? Why does it matter if the project is installed? |
This is a blocker, or at the very least annoying. I can workaround with a shim src dir that just has an empty init. Lots of people may need to manage a bunch of python dependencies outside the context of having a top-level package they themselves are trying to install. Hence why poetry created the package-mode=false. It lets everyone benefit from the lockfile, resolver, and toolchain. A simple example is https://github.com/apache/airflow which has huge adoption and use at large companies -- but there are obv tons of cases where you need to manage libraries that (may) operate in a context independent of a structured python package. |
Just to clarify, are you citing Airflow as an example of a project that is not structured as a package? Or an example of something you might use outside of a package? |
The latter. |
More random data-oriented examples @charliermarsh https://github.com/dbt-labs/dbt-core We can imagine all the AI / ML / data pipeline / automation code (disparate python scripts in a repository, NOT a src application) we'd like to have lockfiles and uv tooling for. EDIT: for clarity, these are all things a developer may depend on in a repo that is not otherwise structured as a python application itself. |
It sounds like you're looking for a virtual project, which I believe we support if you enumerate everything as a development dependency? As described in https://docs.astral.sh/uv/concepts/workspaces/#workspace-roots |
No, as far as I can tell (and I just tried it) you still need a pyproject.toml somewhere in the repo with In all my examples, dbt or sqlmesh being really straightforward ones, you will not have a |
Worked fine for me? Did you encounter an error?
|
My use case in particular is a Django application. In some cases, it may be desired to package a django app, but in most cases, the root project will never be packaged, however a cross platform lockfile is very useful for CI pipelines, and a better workflow than pip in my opinion. It looks like the virtual project may work, I will take a look into this. |
NVM I see, workspace members can be empty. I am working with an existing project at work and trying to adapt it to That worked for me! Q I suppose. Does this give us a single layer of dependencies? Whereas with the |
I'm going to go out on a limb and say, while we can potentially achieve our goal (creating a cross-platform lockfile from pyproject.toml without a BTW really excited for |
Appreciate the kind words :) Personally I still feel we can do better with what we're calling "virtual" projects. I'm not a big fan of using virtual workspaces to solve this problem. But I'm mostly focusing on correctness issues in the immediate term so we need a bit of time to step back and think about where to improve. |
Wrote up an idea here: #6511 |
This exists now as of v0.4.0! Projects that omit [tool.uv]
package = false |
uv version: 0.3.1
uv platform: linux
Poetry supports what they call operating modes (https://python-poetry.org/docs/basic-usage/#operating-modes), where if you are not planning on publishing your project, you can specify
package-mode = false
, which only installs the dependencies listed, but does not install the project into the virtual environment.I was unable to find something like this mentioned in the docs for projects, is it unsupported or perhaps missing from the docs (or perhaps documented somewhere I couldn't see it).
The text was updated successfully, but these errors were encountered: