-
Notifications
You must be signed in to change notification settings - Fork 2.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
Bug: poetry install
fails with transitive path dependencies via git
#8765
Comments
layered path dependencies are pretty much always a bad idea - if you search this issue tracker you will find plenty of examples. In this case you can see that what poetry has put into its lockfile for [package.source]
type = "directory"
url = ".venv/src/python-monorepo/poetry/workspaces/lib" which probably was true at time of locking. But if it's not true at time of install - well, too bad. Similarly look at the dependency in the lockfile from namespace-cli on namespace-lib: [package.dependencies]
namespace-lib = {path = "../lib"} well of course, what else should it say? but in the new context this just doesn't mean anything useful. (This sort of thing is the reason that you cannot upload wheels containing path dependencies to pypi: if you use relative paths then the metadata becomes meaningless, if you use absolute paths then it only works on your machine) This is doomed. Find some other way! |
Perhaps the point is this is less of a bug and more of a feature request. It's pretty common to work in monorepos with path dependencies, then find you need to install something via git in some other repo. It's true that someone could find another way, but it doesn't seem that unreasonable to me to feature request that when adding a git dependency poetry could detect that there are path dependencies and resolve them (or raise a helpful error warning that this is impossible). In my opinion, the expected behavior when adding a git dependency that itself contains path dependencies would be to resolve them as multiple git dependencies with different subdirs from the same repo (which would require solving #6958 ). Maybe there are flaws to this idea, I didn't think too carefully about it yet. |
I just found this because I ran into this issue. Funnily enough though, running poetry add "https://github.com/adriangb/python-monorepo.git#subdirectory=poetry/workspaces/cli" This does add the entry to the |
Same same here, this is a more than common problem I have seen and is a PITB to work around. The option that works is instead of using path component to use github again, but that brings one into a Goedelian hell of self-referential updates, because poetry.lock needs to refer to the same git commit hash it tries to change. Add a chain of dependency and the ONLY option is hand-editing poetry.lock file. |
-vvv
option) and have included the output below.Issue
Poetry fails to correctly install when it has a transitive path dependency, via a git subdirectory dependency.
For example, see https://github.com/jpugliesi/poetry-git-local-dep-bug where the
example
package's pyproject.toml contains a git dependencynamespace-cli
:The
namespace-cli
package then has a relative path dependency on another project in the same repo asnamespace-cli
: (namespace-lib
):Installing the original
example
package will produce an error:Error:
It seems poetry is resolving the path of the transitive
namespace-lib
relative to the root directory of the poetry-managed virtualenv, whereas it should be resolving the path relative to thesubdirectory
of the git dependency.The text was updated successfully, but these errors were encountered: