Skip to content

Add support for PEP 792 project status markers - #14046

Open
miketheman wants to merge 2 commits into
pypa:mainfrom
miketheman:miketheman/13543-pep792
Open

Add support for PEP 792 project status markers#14046
miketheman wants to merge 2 commits into
pypa:mainfrom
miketheman:miketheman/13543-pep792

Conversation

@miketheman

@miketheman miketheman commented Jun 10, 2026

Copy link
Copy Markdown
Member

Parse the project-status key (JSON) and pypi:project-status meta tags (HTML) from Simple API project pages, record non-active statuses in PackageFinder, and warn after resolution for user-requested projects that are archived, deprecated, or quarantined. Resolution errors (single- and multi-cause) mention the status as well, since a quarantined project offers no distributions.

Statuses are only attributed from a project's own index page, never from shared --find-links pages. and malformed status data is treated as active per the specification.
Structurally invalid project-status data (e.g. a non-dict value, or a non-string status/reason) is an error; an unrecognized status value falls back to active with a warning, matching uv's behavior. The free-form reason is reduced to a single line of printable ASCII before display, since indexes are untrusted input.

The deprecated legacy resolver does not emit these warnings.

Resolves #13543

Comment on lines +248 to +253
@with_cached_index_content
def parse_links(page: IndexContent) -> Iterable[Link]:
"""
Parse a Simple API's Index Content, and yield its anchor elements as Link objects.
"""
return parse_index_response(page)[0]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Note on parse_links no longer being a generator

This PR changes parse_links from a generator to a function that returns a list (it now delegates to parse_index_response). That's safe: the generator's laziness hasn't reached a caller since 2019.

parse_links was originally a lazy generator (75c8bce). But when the with_cached_index_content decorator was added for PEP 691 (6f167b5), both of its branches wrap the call in list(fn(page)) - so the decorated parse_links has always returned a fully materialized list. The sole caller (process_project_url) then does list(parse_links(...)) again, and evaluate_links consumes it in full. No caller streams or breaks early.

Net effect: the find-links path takes one extra shallow copy of the list (benchmarked at +0.1%/+0.8%, within noise), and the index path drops a redundant copy.

@miketheman

Copy link
Copy Markdown
Member Author

Also tagging @woodruffw for review, as the author of the request.

Comment thread src/pip/_internal/index/collector.py Outdated
Comment thread src/pip/_internal/index/collector.py Outdated
Comment thread src/pip/_internal/index/collector.py
@woodruffw

Copy link
Copy Markdown
Member

This is super exciting!

@miketheman
miketheman requested a review from woodruffw June 11, 2026 23:48
@miketheman
miketheman marked this pull request as ready for review June 12, 2026 12:35
@notatallshaw
notatallshaw self-requested a review June 16, 2026 03:19
@ichard26 ichard26 added this to the 26.3 milestone Jul 24, 2026
@ichard26

Copy link
Copy Markdown
Member

Sorry for the lack of attention. Realistically, it'll probably be a while until we can take a look as we have many other competing priorities, including the upcoming pip 26.2 release. I'll tentatively add this to the 26.3 milestone, but I make no promises.

@miketheman

Copy link
Copy Markdown
Member Author

Thanks! Let me know if there's anything I can do in the meantime to make the review easier/simpler in any way.

Parse the project-status key (JSON) and pypi:project-status meta tags
(HTML) from Simple API project pages, record non-active statuses in
PackageFinder, and warn after resolution for user-requested projects
that are archived, deprecated, or quarantined. Resolution errors
(single- and multi-cause) mention the status as well, since a
quarantined project offers no distributions.

Statuses are only attributed from a project's own index page, never
from shared --find-links pages, and malformed status data is treated
as active per the specification. The deprecated legacy resolver does
not emit these warnings.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
- Use literal strings
- Warn when unknown status received
- Sanitize reason

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
@miketheman
miketheman force-pushed the miketheman/13543-pep792 branch from 7e9002c to f782db3 Compare July 24, 2026 20:11
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.

Support for PEP 792

3 participants