Loading
docs(specs): specify PyPI hosted (S39)
Summary
- Problem: Python teams cannot move their packages onto Artifact Registry, because it does not serve PyPI.
- Impact: publishers using
twine,uv publishorpoetry publish, and installers usingpip, uv or Poetry. Platform teams cannot retire a JFrog or Nexus PyPI repository. - Change: S39 defines hosted PyPI repositories. It covers the legacy upload API, the Simple Repository API in HTML and JSON, the PEP 658 metadata file for wheels, upload validation, yank and un-yank, and the management API. It also adds the PyPI rows to S01, S08, S09 and S23.
- Downsides: some upload rules are stricter than pypi.org's (see Decisions), so a few uploads that pypi.org accepts get
409or422here. Remote and virtual PyPI, and PEP 740 attestations, are left for later.
Checklist
- Gaps: remote and virtual PyPI need their own specs. Provenance (PEP 740) is tracked in #363, and an upload that carries attestations gets
400. Project status markers (PEP 792) come after GA. Audit events wait for S21. The registry-conformance PyPI suite exists only on itssummit2026branch, so moving it tomainis a follow-up. - Least sure: the file identity rule. A version holds one file per canonical identity (normalized name, canonical version, build tag, sorted tags), which is stricter than pypi.org. If real publishers hit
409for respelled wheel names, the rule can relax to exact file names. - Compatibility: nothing existing changes.
pypiis a newrepositories.formatvalue, and the management API rejects it with400until the schema, the OpenAPI contract, the monolith enum and the Snowplow schema all accept it. - Agreement: the monolith (repository-format enum and client) and the Snowplow schema must accept
pypibefore rollout. S01, S08, S09 and S23 get only the rows that S37 added for Go. No ADR change is needed, because ADR-004, ADR-007 and ADR-009 now leave per-format values to the format specs. - Simplicity: I rejected a separate per-repository setting for local versions, plain-HTTP refusal inside AR, and PUT or POST yank routes. Each added a new pattern with no gain over a
PATCHand the existing deployment edge.
Decisions
| Topic | Decision | Reason |
|---|---|---|
| Spec ID | S39 | S35 belongs to the closed generic-hosted MR !3427 (closed), and S36 to S38 are claimed. |
| File URL | /files/{sha256}/{file_name} |
uv.lock records file URLs. A future virtual repository serves exactly the bytes its page advertised, which avoids the integrity mismatch S31 accepts for npm. |
| Plain HTTP | A deployment concern, not S39 | Cloudflare answers plain HTTP with 301 for every format before AR sees it (measured on 2026-11-02). |
| Deletes | Project and version, plus S17 bulk deletes. No single-file delete. | A file delete leaves a partial release, and pip may fall back to another file of it. |
| Yank | PATCH /pypi/versions/{version_id} with yanked and yanked_reason |
No existing API to copy (AR formats, GitLab Rails, pypi.org UI only). PATCH is S17's pattern for changing a resource's fields. |
| Attestations on upload | 400 attestations_unsupported |
The publisher learns at once that AR keeps no provenance, and accepting them later is additive. |
| Conformance gate | registry-conformance PyPI suite | Same as Maven, npm and OCI. |
| Error body | RFC 9457 everywhere | uv parses it. Go's net/http cannot set pypi.org's custom reason phrase. |
| sdist check | Read PKG-INFO, and the form, file name and PKG-INFO must agree |
Same rule as wheels. pypi.org reads PKG-INFO but does not compare the names. |
1.0 and 1.0.0 |
One version, keyed on the canonical form | They are equal by the version spec. Same as pypi.org. |
| File identity | One file per canonical identity per version | Two files with the same tags make pip's choice depend on page order. |
| Local versions | Accepted | The version spec allows them on private indexes. |
| Late uploads | pypi.max_version_upload_age, default 14d |
Stops a stolen token from adding a more specific wheel to an old, pinned version. Same window as pypi.org. |
| Re-creating a deleted version | Allowed at once | Same as AR npm and pypi.org. Security states that the 14-day window does not cover it. |
Follow-ups
- Move the registry-conformance PyPI catalog and client from
summit2026tomain, re-checked against S39. - Decide whether the Cloudflare zones should refuse plain HTTP instead of redirecting it, for every format.
- Update #363, which still calls this spec S34.
- Add a non-partial parent index on
pypi_projects.pypi_repository_idandgo_modules, in S39 and S37 together.
Related to #365