fix: create path dependencies relative to package rather than lockfile (#4245)#4246
Conversation
| for dep_name, constraint in info.get("dependencies", {}).items(): | ||
|
|
||
| root_dir = self._lock.path.parent | ||
| if package.source_type == "directory": |
There was a problem hiding this comment.
Not sure if we need to handle file source types too
abn
left a comment
There was a problem hiding this comment.
In addition to the comments in the reivew, I wonder if this is going to cause issues if libB from your issue is also a dependency of libC, I suspect not if libC is at the same location as libA, however could get a bit hairy if it is not and/or libCis nested in libA.
poetry/packages/locker.py
Outdated
| if package.source_type == "directory": | ||
| # root dir should be the source of the package relative to the lock path | ||
| root_dir = Path( | ||
| os.path.relpath( |
There was a problem hiding this comment.
Couple of points;
- Move to using pathlib if possible.
- We cannot always be sure a "directory" package is relative as it could also be an absolute path.
|
Kudos, SonarCloud Quality Gate passed!
|
|
@abn to test this, I created a new project with the following structure I created nested libraries across directories like you suggested. I was able to install and import all the libs from I hope no-one would do such a thing as this though 😉 |
|
@abn it turns out that we already calculate the relative path poetry/poetry/packages/locker.py Line 119 in 97e63f6 You commented before that a directory source url could be an absolute path. Does that line need to be changed? |
|
Thanks! |
fix: create path dependencies relative to package rather than lockfile (#4245)
fix: create path dependencies relative to package rather than lockfile (#4245)
fix: create path dependencies relative to package rather than lockfile (#4245)
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Resolves path dependencies relative to the package and lockfile rather than just the lockfile.
Resolves: #4245