-
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
fix: create path dependencies relative to package rather than lockfile (#4245) #4246
Conversation
@@ -176,20 +176,26 @@ def locked_repository( | |||
package.marker = parse_marker(split_dep[1].strip()) | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we need to handle file
source types too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 libC
is 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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! 0 Bugs No Coverage information |
@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