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

Allow PEP 508 URL spec as editable #9471

Closed
wants to merge 4 commits into from

Conversation

uranusjr
Copy link
Member

Copy link
Member

@sbidoul sbidoul left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!.

src/pip/_internal/req/constructors.py Outdated Show resolved Hide resolved
src/pip/_internal/req/constructors.py Outdated Show resolved Hide resolved
src/pip/_internal/req/constructors.py Show resolved Hide resolved
@uranusjr
Copy link
Member Author

Updated for review comments.

@uranusjr uranusjr force-pushed the editable-pep-508 branch 2 times, most recently from bc6fecd to 457f8a6 Compare January 18, 2021 11:09
@sbidoul
Copy link
Member

sbidoul commented Jan 18, 2021

Do we have a natural place in the documentation for that ?

@uranusjr
Copy link
Member Author

There’s a section in pip install on editable installs, I’ll update it to use the PEP 508 format. (Should we keep the #egg= format? I’m inclined not to because our next step is to deprecate it.)

@sbidoul
Copy link
Member

sbidoul commented Jan 18, 2021

Should we keep the #egg= format? I’m inclined not to because our next step is to deprecate it.

👍 to drop #egg= references from the doc now. That's a good way to check that we have an alternative for all documented use cases.

name = f"{req.name} ; {req.marker}"
else:
name = req.name
return (name, req.url, req.extras)
Copy link
Member

Choose a reason for hiding this comment

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

Hm, on second look... this will let non VCS URLs go through ? So we need to merge #9436 first and see how we can do the link.is_vcs here too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, good point, Requirement() does not check if the URL is actually valid.

Copy link
Member Author

Choose a reason for hiding this comment

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

One thing we ca do here is to add an extra check, and only treat the string as PEP 508 if the URL part contains ://. This means pseudo URL strings will automatically fall back to the old parsing logic, and can be handled independently to this new logic.

Copy link
Member Author

Choose a reason for hiding this comment

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

@sbidoul I added an additional check to prevent pseudo-URLs from going through here. Do you think it’d help?

Copy link
Member

Choose a reason for hiding this comment

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

@uranusjr I have not tested (I whish I had more time for pip...) but this version would accept any URLs ? Editables URLs must be file:// or vcs+...:// urls only, correct ? And even file URLs must point to a local directory, not a file.

Copy link
Member Author

@uranusjr uranusjr Feb 25, 2021

Choose a reason for hiding this comment

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

Correct. There are already checks in a later stage to error out on invalid URL values, so I think it’s fine to pass them through here.

raise InstallationError(
f'{editable_req} is not a valid editable requirement. '
f'It should either be a path to a local project or a VCS URL '
f'(beginning with {backends}).'

@uranusjr
Copy link
Member Author

I did a mass find-and-replace on the documentation (and rewrote a couple of paragraphs) to ditch egg= for PEP 508. The documentation now contains no mention of egg= at all.

@BrownTruck
Copy link
Contributor

Hello!

I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the master branch into this pull request or rebase this pull request against master then it will be eligible for code review and hopefully merging!

@BrownTruck BrownTruck added the needs rebase or merge PR has conflicts with current master label Feb 4, 2021
@sbidoul
Copy link
Member

sbidoul commented Mar 20, 2021

@uranusjr this does not seem to work, unfortunately:

$ pip install -e "pip-test-package @ git+https://github.com/pypa/pip-test-package" 
ERROR: Could not detect requirement name for 'git+https://github.com/pypa/pip-test-package', please specify one with #egg=your_package_name

Somehow parse_editable is being invoked twice: first with name @ url and then a second time with url only.

@uranusjr
Copy link
Member Author

Thanks for catching this. A code path is building editables incorrectly with a bare URL instead of the whole requirement string. This “works” right now because the URL is the requirement string, but not anymore.

@uranusjr
Copy link
Member Author

uranusjr commented Mar 21, 2021

Hmm, turns out packaging actually contains some restriction on the URL and does not accept git+file:///.... This means it’s very difficult to write tests for pip install -e "NAME @ VCS+URL" without depending on network access. I’ve opened pypa/packaging#412 for this.


Update: Need to first resolve pypa/packaging#264.

@BrownTruck
Copy link
Contributor

Hello!

I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the master branch into this pull request or rebase this pull request against master then it will be eligible for code review and hopefully merging!

@BrownTruck BrownTruck added the needs rebase or merge PR has conflicts with current master label Mar 29, 2021
@pradyunsg
Copy link
Member

FWIW, I suggest filing a new PR for this, since our CI pipeline changed significantly; and the existing test results would likely contribute to "noise" in the checks view. :)

@pradyunsg pradyunsg added the S: awaiting response Waiting for a response/more information label Apr 2, 2021
@uranusjr
Copy link
Member Author

uranusjr commented Apr 2, 2021

The needed upstream fix in packaging is also taking a long time, and there’s no point working on this before that’s done.

@uranusjr uranusjr closed this Apr 2, 2021
@sbidoul
Copy link
Member

sbidoul commented Apr 2, 2021

there’s no point working on this before that’s done.

Why ? Implementing pip install -e "pip-test-package @ git+https://github.com/pypa/pip-test-package" is not blocked by the packaging issue. I personally could live with a test that needs the network for this.

@uranusjr
Copy link
Member Author

uranusjr commented Apr 2, 2021

My wording was bad, it’s more like I don’t think it’s a good investment of my time right now 😓

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs rebase or merge PR has conflicts with current master S: awaiting response Waiting for a response/more information
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants