Add support for PEP 792 project status markers - #14046
Conversation
| @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] |
There was a problem hiding this comment.
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.
|
Also tagging @woodruffw for review, as the author of the request. |
|
This is super exciting! |
|
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. |
|
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>
7e9002c to
f782db3
Compare
Parse the
project-statuskey (JSON) andpypi:project-statusmeta tags (HTML) from Simple API project pages, record non-active statuses inPackageFinder, 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-linkspages.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