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

Relative paths improvements for editable installs #5896

Merged
merged 5 commits into from
Aug 31, 2023

Conversation

matteius
Copy link
Member

@matteius matteius commented Aug 30, 2023

Thank you for contributing to Pipenv!

The issue

Relative paths are preferable for editable installs.

The fix

Fixes #5858

The checklist

  • Associated issue
  • A news fragment in the news/ directory to describe this fix with the extension .bugfix.rst, .feature.rst, .behavior.rst, .doc.rst. .vendor.rst. or .trivial.rst (this will appear in the release changelog). Use semantic line breaks and name the file after the issue number or the PR #.

# appending the non-common parts of the absolute path
rel_parts = up_levels + list(abs_path.parts[common_parts:])
relative_path = Path(*rel_parts)
return relative_path.as_posix()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

Is it possible that Path.cwd() is not the virtual environment root path (i.e typically where the Pipfile is located?). I thought all paths were always relative to the Pipfile etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it has to be where the Pipfile is located because pipenv changes directories to that location when its invoked, if we ever change that assumption this here will break.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So when pipenv is executed it changes the current working directory for the process to the location of the Pipfile? If so, I get it now, I just don't understand why the code path that manually constructs a relative code path is required if that's the case.

@matteius matteius changed the title try to make relative paths better for editable installs Relative paths improvements for editable installs Aug 31, 2023
@matteius matteius merged commit 90714e2 into main Aug 31, 2023
2 checks passed
@matteius matteius deleted the editable-relative-refinment branch August 31, 2023 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2023.8.19 through to 2023.8.22 break editable package installation
2 participants