Skip to content
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

Dedupe editable installs before building #2819

Closed
jaap3 opened this issue Apr 4, 2024 · 1 comment · Fixed by #2820
Closed

Dedupe editable installs before building #2819

jaap3 opened this issue Apr 4, 2024 · 1 comment · Fixed by #2820
Assignees
Labels
bug Something isn't working

Comments

@jaap3
Copy link

jaap3 commented Apr 4, 2024

I'm trying uv in a monorepo setup that has a few apps and many shared (interdependent) packages. When installing an application all it's dependencies (and their sub-dependencies etc.) that live in this monorepo are installed in editable mode. This is done by chaining requirements-dev.txt files. i.e. given the following directory structure:

.
├── apps
│   └── frobulator
│       ├── pyproject.toml
│       └── requirements-dev.txt
└── packages
    ├── bar
    │   ├── pyproject.toml
    │   └── requirements-dev.txt
    ├── foo
    │   ├── pyproject.toml
    │   └── requirements-dev.txt
    ├── foobar
    │   ├── pyproject.toml
    │   └── requirements-dev.txt
    └── qa
        └── pyproject.toml

frobulator/requirements-dev.txt might look like:

# This project
-e ../../apps/frobulator

# Local packages
-r ../../packages/foo/requirements-dev.txt
-r ../../packages/foobar/requirements-dev.txt

# QA
-e ../../packages/qa

and foobar/requirements-dev.txt might look like:

# This project
-e ../../packages/foobar

# Local packages
-r ../../packages/foo/requirements-dev.txt
-r ../../packages/bar/requirements-dev.txt

# QA
-e ../../packages/qa

Now when I run uv pip install -r requirements-dev.txt in the apps/frobulator directory uv will show something like this:

   Built file:///code/apps/frobulator
   Built file:///code/packages/foo
   Built file:///code/packages/qa
   Built file:///code/packages/foobar
   Built file:///code/packages/foo
   Built file:///code/packages/qa
   Built file:///code/packages/bar
   Built file:///code/packages/qa
   Built file:///code/packages/qa
   Built file:///code/packages/qa       
Built 10 editables in 793ms
Resolved 6 packages in 7ms
Downloaded 1 package in 665ms
Installed 6 packages in 246ms

As you can see, some packages are built multiple times. In this example this is still reasonably fast, but in our real world repository this step takes a long time.

Am I right in concluding that these packages are really built multiple times in the same step? Is it possible to dedupe the list of editable installs before building?

I was also able to reproduce this by repeating the -e flag multiple times with the same paths, i.e.:

uv pip install -e . -e . -e ../../packages/qa/ -e ../../packages/qa/ -e ../../packages/foo -e ../../packages/bar ../../packages/bar ../../packages/foo ../../packages/foobar
   Built file:///code/apps/frobulator
   Built file:///code/apps/frobulator
   Built file:///code/packages/qa
   Built file:///code/packages/qa
   Built file:///code/packages/foo
   Built file:///code/packages/bar
Built 6 editables in 1.01s
Resolved 6 packages in 120ms
   Built foobar @ file:///code/packages/foobar
Downloaded 2 packages in 501ms
Installed 6 packages in 237ms
 + bar==0.1.0 (from file:///code/packages/bar)
 + foo==0.1.0 (from file:///code/packages/foo)
 + foobar==0.1.0 (from file:///code/packages/foobar)
 + frobulator==0.1.0 (from file:///code/apps/frobulator)
 + qa==0.1.0 (from file:///code/packages/qa)
 + ruff==0.3.5

Here it seems some repeated packages are not built multiple time, not sure why?

uv --version
uv 0.1.28
@charliermarsh charliermarsh self-assigned this Apr 4, 2024
@charliermarsh charliermarsh added the bug Something isn't working label Apr 4, 2024
@charliermarsh
Copy link
Member

Makes sense, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants