Skip to content

Conversation

@ichard26
Copy link
Member

@ichard26 ichard26 commented Jul 20, 2025

This is crucial for the deprecation of non-bare egg URL fragments as they used to be the sole way to request an extra for a VCS editable install.

I've also removed all references to egg fragments from the user docs and added further explanation of the Direct URL form in the VCS support topic.

Getting the error handling right was a pain. That's why I extracted the two parsing flows into their own functions.

Towards #13157.
Towards #1289.
Supersedes #9471.

@ichard26 ichard26 added this to the 25.2 milestone Jul 20, 2025
@ichard26 ichard26 force-pushed the feat/direct-editables branch from 4164131 to 47e7040 Compare July 20, 2025 19:50
@ichard26 ichard26 force-pushed the feat/direct-editables branch from 47e7040 to fcae387 Compare July 20, 2025 20:18
@ichard26
Copy link
Member Author

Ugh, why is everything filled with so many exceptions and undocumented extensions. There is a backwards compatibility break here. I'll fix it, but I do want to take a closer look at why it's happening.

@ichard26 ichard26 marked this pull request as draft July 20, 2025 20:36
This is crucial for the deprecation of non-bare egg URL fragments as they
used to be the sole way to request an extra for a VCS editable install.

I've also removed all references to egg fragments from the user docs and
added further explanation of the Direct URL form in the VCS support
topic.

Getting the error handling right was a pain. That's why I extracted the
two parsing flows into their own functions.

Co-authored-by: Tzu-ping Chung <[email protected]>
@ichard26 ichard26 force-pushed the feat/direct-editables branch from fcae387 to 8850376 Compare July 21, 2025 21:12
@ichard26 ichard26 marked this pull request as ready for review July 21, 2025 21:31
@ichard26 ichard26 modified the milestones: 25.2, 25.3 Jul 22, 2025
@notatallshaw
Copy link
Member

@ichard26 is this ready for review? Hard to tell from your last comment.

@ichard26
Copy link
Member Author

@notatallshaw short of the one outstanding documentation change that's noted above, this is indeed ready for review.

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.

Thanks for this work @ichard26. I made a pass on this and did a few tests. Everything works as I expected.

A few minor comments, some of which for possible followups.

I noticed a remaining #egg mention in a warning message:

pip install -e "pkgb @ file://$PWD/pkga"

WARNING: Generating metadata for package pkgb produced metadata for project name pkga. Fix your #egg=pkgb fragments.

name = req.name
return (name, req.url, req.extras)

raise ValueError
Copy link
Member

Choose a reason for hiding this comment

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

Note: it could be convenient to support pkgname[extras] @ ./localdir as an alternative to ./localdir[extras]. But that can be discussed separately.

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'd rather not add extensions to standard requirement syntax, but yes, this would be a follow up.


package_name = link.egg_fragment
if not package_name:
# The project name can be inferred from local file URIs easily.
Copy link
Member

Choose a reason for hiding this comment

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

What do you mean with this comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

With the extraction of _parse_pip_syntax_editable(), now every editable requirement is checked that there is a known project name. This is problematic for local editable reqs like -e . or -e /local/path. Previously these cases would return early in parse_editable() skipping this check, but now they fail it. However, pip can and will infer the project name for local file URIs so we skip the check if that's the case.

@ichard26
Copy link
Member Author

@notatallshaw I do want to get this into the 25.3 release. I'll aim to get this updated by EOD tomorrow.

@notatallshaw
Copy link
Member

notatallshaw commented Oct 19, 2025

@ichard26 👍, I'll try and do a quick pass over this today, but as it's so far outside my expertise it's unlikely I'll have any additional comments.

@ichard26 ichard26 requested a review from sbidoul October 20, 2025 22:47
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.

Don't forget to postpone the #egg deprecation:

if not self._project_name_re.match(project_name):
deprecated(
reason=f"{self} contains an egg fragment with a non-PEP 508 name.",
replacement="to use the req @ url syntax, and remove the egg fragment",
gone_in="25.3",
issue=13157,
)

At some point this warning will also need addressing to be complete:

logger.warning(
"Generating metadata for package %s "
"produced metadata for project name %s. Fix your "
"#egg=%s fragments.",
self.name,
metadata_name,
self.name,

Resolved conflict in tests/functional/test_install_reqs.py by keeping the
test_nonpep517_setuptools_import_failure test and TestEditableDirectURL class
from the PR branch.
The --no-use-pep517 option has been removed from pip as part of the move
to PEP 517-only builds. This test is no longer valid and was causing
failures. Also removed the no-longer-needed make_wheel import.
@notatallshaw notatallshaw merged commit 4ad1828 into pypa:main Oct 24, 2025
28 checks passed
@notatallshaw
Copy link
Member

Thanks @ichard26 ! I'll follow up in a moment with a PR that bumps any remaining gone_ins.

@ichard26 ichard26 deleted the feat/direct-editables branch October 24, 2025 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants