-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Unable to install direct path dependencies as editable #11881
Comments
Pip shouldn't reinstall anything it does not need to. If it does need to reinstall, then yes, it will install in "normal" (non-editable) mode - there's no way using standard metadata to say that a dependency must be in editable mode (that's the thing I presume is a Poetry specific feature), so that's all that pip can do. So I don't think there's a pip issue here, but if you believe there is, you'll need to provide a reproducible example demonstrating the problem without using poetry-specific features. |
path dependency: perhaps I didn't use the proper terminology but it ends up being a direct reference to the package directory. i.e. poetry does have the I see that when installing with |
The problem I'm having is that if I have multiple projects which depend on each other, regardless of the build system I'm using I would like to install them in editable mode, in which case installing just the root package editable and the rest non-editable is undesirable. |
OK, so that's not something pip supports currently. I don't know whether there is sufficient demand for such a feature to justify it (as far as I know, this is the first time anyone has ever requested it) but if someone were to demonstrate that it's a sufficiently useful feature to justify the maintenance costs, and was interested enough to contribute a PR, I guess it's something we could consider. Until there's a PR, I don't think there's much benefit in discussing details of the design of such a feature, though, so I'm going to add an "awaiting PR" label here. |
@mbway sorry I had not seen this issue before your PR. Have you considered declaring dependencies by name instead of path, and installing with Otherwise, I tend to think this feature request is a special case of the "dependency override" mechanism that is discussed elsewhere, and we may want to consider it in that broader context. |
you mean in the project specify And my PR explains another situation involving this approach to monorepo management where using path requirements is much easier to manage than custom installation procedures for each project. So unless I'm missing something, using named requirements isn't a good substitute |
Another alternative could be to install everything, and then use |
This still seems like a manual workaround for a missing feature. I mean I could just create a custom tool (and I have done for the time being) but I think this is a feature missing in pip |
I'm still not convinced this is worth adding. I get that you need this functionality, but we have to balance wider issues like maintainability and how many people would benefit. This feels more like a "workflow support" feature rather than a lower level "installer" feature. You mention that poetry supports this - maybe the answer should simply be that poetry is the right workflow tool for you? I don't understand what you mean by "poetry may not always be available" - it's absolutely reasonable to require that people working on your code use the project standard workflow tool, so it seems to me that your response to someone saying "I don't have poetry" should just be "you need to follow the instructions for setting up your development environment, and then you will have poetry". |
I don't mind if you don't think this feature is a good addition to pip. I opened the issue because I saw it as a missing feature that I thought would be useful and wanted to contribute. In terms of poetry 'not being available' I didn't want to get into the details but for the CI system I have set up there would be several drawbacks to using
by the way I'm not asking for solutions for the situation above. I have already found one. I presented it only as a motivating example for where this feature could be useful |
I have a similar issue like @mbway . My package(say package_a) has a optional dependency(package_b) which is laid out as a git submodule:
pyproject.toml:
I want to install both package_a and package_b in editable mode during development of the project, so I have to execute I tried to add an optional dependency in pyprojec.toml of package_a like below:
If pip allows editable option in dependency specification just like it does in the requirement file when executing Similar issue searched on Stackoverflow: pyproject-toml-listing-an-editable-package-as-a-dependency-for-an-editable-packa |
I agree that the package itself specifying that a requirement should be installed in editable mode would be nice (which I think is what you are suggesting?). The reason I went with the Adding additional metedata to track whether a requirement should be editable, and potentially adding additional syntax for specifying requirements that isn't covered by PEP 440 seems much less likely to get off the ground, especially since the initial response is that there is no issue with pip's current capabilities. |
the
and the [project]
# ...
dependencies = [ "a" ]
[tool.uv.sources]
a = { path = "../a", editable = true } This is also transitive so |
Description
pip install -e
does not install path dependencies as editable. This is OK as a default but there doesn't seem to be any way to configure this behaviour.I have seen this issue and this stack overflow post where others have wanted this behaviour (or similar behaviour) as well.
poetry install
does work as expected butpoetry
may not always be available.In
install_req_from_req_string()
where theInstallRequirement
for is constructed from the path requirement string I see that there is no way to have theeditable
attribute set.Expected behavior
I expected that
pip install -e
would install all the local/path dependency packages in editable mode likepoetry install
does.pip version
23.0.1
Python version
3.11
OS
Ubuntu 20.04.5 LTS
How to Reproduce
p1
andp2
p2
as a path dependency ofp1
:p2 = {path = "../p2", develop = true}
.pip install -e p1
Output
p1
is installed in editable mode butp2
is not. Even ifp2
is installed in editable mode beforehand it will be re-installed as non-editable.Code of Conduct
The text was updated successfully, but these errors were encountered: