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

Add --non-editable to allow syncing with non-editable workspace members #5792

Closed
charliermarsh opened this issue Aug 5, 2024 · 10 comments · Fixed by #7371
Closed

Add --non-editable to allow syncing with non-editable workspace members #5792

charliermarsh opened this issue Aug 5, 2024 · 10 comments · Fixed by #7371
Assignees
Labels
cli Related to the command line interface needs-decision Undecided if this should be done

Comments

@charliermarsh
Copy link
Member

Do we want to support this?

@charliermarsh charliermarsh added needs-decision Undecided if this should be done cli Related to the command line interface preview Experimental behavior labels Aug 5, 2024
@charliermarsh
Copy link
Member Author

(It's very easy to do.)

@charliermarsh
Copy link
Member Author

If no one objects I can add it, not too hard.

@zanieb
Copy link
Member

zanieb commented Aug 5, 2024

I don't fully understand what this means. I worry how close the flag is to --no-editable.

@charliermarsh
Copy link
Member Author

It would mean: install the project and any workspace members as non-editable. So, build them to sdists, and install them into the environment, rather than adding a .pth file.

@zanieb
Copy link
Member

zanieb commented Aug 5, 2024

Hm. --no-editable-project? I'm not sure. Makes sense as something to support though. Seems easy to defer to after stabilization.

@eruvanos
Copy link

eruvanos commented Aug 23, 2024

Hi,

I think I would need this flag, but maybe it is better to describe my use case, there might be another solution for it with uv:

I want to setup multiple AWS Lambda Functions, which all come with their own dependencies, some use flask, some don't, etc.

For local development it is convenient, to have one virtual environment, so I go with setting up a virtual workspace. I add multiple packages, one for each Lambda function.

I add one "shared" package, which I will use for code that is shared between all Lambdas.

I install the shared package into the other ones, which will create an entry like:

[tool.uv.sources]
shared = { workspace = true }

Next I create the Lambda artefact, by installing the package with --target

cd package_a
uv pip install -c ../uv.lock --target dist .

dist/ now contains everything I would have to ship, but the shared package is only referenced with .pth file, which will not work in the lambda environment.

From my point of view, --non-editable support in the uv pip install command could be used to fix this.

@pawamoy
Copy link

pawamoy commented Aug 30, 2024

I would use such a flag, yes, for the project itself (I don't use workspaces (yet)). Apologies if this not what this issue is about.

The initial use-case (a few years ago) was for multi-stage Docker builds: install every deps + project in a first stage, copy in a later stage. Editable installs of the project would not be working once the venv was copied in the final stage, since the sources were not present anymore.

The current use-case is to make CI more robust (to spot packaging issues early), with something like this:

if [ -n "${CI}" ]; then
  uv sync --no-editable-project
else
  uv sync
fi

@orf
Copy link

orf commented Sep 11, 2024

This would be very useful when building docker images with workspaces - you would be able to do something akin to:

RUN --mount=bind,from=project,source=src/,target=src/ \
   --mount=type=bind,from=project,source=pyproject.toml,target=pyproject.toml \
   --mount=type=bind,from=project,source=uv.lock,target=uv.lock \
   uv sync --frozen

and avoid having to copy the src/ directory into the image at all, and avoid multi-stage builds that in essence just try and emuate the above.

@bachya
Copy link

bachya commented Sep 11, 2024

@charliermarsh @zanieb Is there anything further the community could provide input on here? Noting that CM said this was relatively easy; this one feature is all that remains for us to move our large monorepo completely over to uv, so I'm excited to see it in action. I'd be happy to contribute if feedback/additional dialog would help drive a decision. No rush, of course—I'm sure many other priorities are going on.

(Unfortunately, my Rust is non-existent, and I'm not in a position to submit an actual PR. 🫠)

@charliermarsh
Copy link
Member Author

I think I can take this one on soon. It’s mostly about figuring the right names / UX / concepts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command line interface needs-decision Undecided if this should be done
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants