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

Local path is treated as version due to packaging feature change #1070

Closed
FlavioAmurrioCS opened this issue Oct 2, 2023 · 2 comments · Fixed by #1071
Closed

Local path is treated as version due to packaging feature change #1070

FlavioAmurrioCS opened this issue Oct 2, 2023 · 2 comments · Fixed by #1071

Comments

@FlavioAmurrioCS
Copy link

Describe the bug
Today I reinstall pipx and noticed that when I was installing a local package I was constantly getting ⚠️ Ignoring --editable install option. pipx disallows it for anything but a local path, to avoid having to create a new src/ directory.

How to reproduce

# Install latest pipx

cd ~/dev/my-python-project
pipx install --editable --force .
# Gets message about --editable being ignore

Expected behavior
--editable should not be ignore.

Investigation
After some debugging the issue seems to be coming from this commit from packaging pypa/packaging#684 where they removed URL validation. Because there is no longer an InvalidRequirement being thrown, in the following block the else branch gets executed which erroneously sets valid_url as '.'

https://github.com/pypa/pipx/blob/main/src/pipx/package_specifier.py#L80-L87

Because valid_url is set to something, valid_local_path is no longer being set and therefore pipx thinks . is not a local package and therefore ignores the --editable flag.
https://github.com/pypa/pipx/blob/main/src/pipx/package_specifier.py#L89-L95

packaging released this change on 23.2 which was releases Oct1. Reverting packaging to 23.1 fixes the issue.

@uranusjr uranusjr changed the title Breaking change from packaging depedency Local path is treated as version due to packaging feature change Oct 2, 2023
@uranusjr
Copy link
Member

uranusjr commented Oct 2, 2023

I’ve merged a change into main that should fix the issue. Anyone landing here with the same issue please feel free to download and test code in main and give feedback so we know if the fix works!

@alasdairnicol
Copy link

@uranusjr I have tested the latest main branch and it fixed the issue 🎉

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 a pull request may close this issue.

4 participants
@uranusjr @alasdairnicol @FlavioAmurrioCS and others