feat: emit PEP 691 JSON simple repository pages - #140
Draft
aiolibsbot wants to merge 3 commits into
Draft
Conversation
Adds index.v1_json alongside each index.html so pip 22.0+ clients can consume the JSON Simple Repository API (application/vnd.pypi.simple.v1+json) when the serving web server is configured for Accept-header content negotiation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Write
index.v1_jsonalongside eachindex.htmlso the generated tree alsoserves the PEP 691 JSON Simple Repository API
(
application/vnd.pypi.simple.v1+json).Why
Pip 22.0+ negotiates for JSON via the
Acceptheader — it's smaller, fasterto parse, and now the de-facto API for modern installers. The HTML pages
remain the source of truth for older clients.
How
json_generator.pybuilds the root index and per-project payloads usingthe same canonicalisation/natsort ordering as the HTML generator. Optional
fields (
requires-python,core-metadata,size) are emitted only whenset, and
core-metadata: trueis preserved.IndexMaker.generate_index_pageswrites both files atomically via theexisting
write_utf8_filehelper.Accept-header rewrite needed for static hosting.Testing
tests/test_json_generator.pycover canonicalisation,optional-field omission, and the
core-metadata: truepassthrough.tests/test_index.pyverifies the JSON filesexist with correct mode and content for both root and project pages.
20 passed.🤖 Generated with Claude Code
Quality Report
Changes: 5 files changed, 212 insertions(+), 6 deletions(-)
Code scan: clean
Tests: failed (command not found)
Branch hygiene: 1 issue(s)
Generated by Kōan post-mission quality pipeline