Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamline simple repository API specification #1442

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
653cbc6
WIP: simple repository API spec
EpicWink Dec 5, 2023
4d2f865
Merge remote-tracking branch 'upstream/main' into simple-repo-api
EpicWink Dec 8, 2023
d99bb40
Convert history to list
EpicWink Dec 8, 2023
62a3514
Add PEP 503
EpicWink Dec 8, 2023
3d895a8
Link to spec for OpenAPI
EpicWink Dec 8, 2023
6d057b3
Add history for requires-python
EpicWink Dec 8, 2023
f8d34f7
Add PEP 592
EpicWink Dec 8, 2023
8f22157
More glossary linking
EpicWink Dec 8, 2023
944c4f9
Add API version scheme and metadata element
EpicWink Dec 8, 2023
cbf3770
Add project-details HTML example
EpicWink Dec 8, 2023
39c56f2
Fix spelling
EpicWink Dec 8, 2023
c5d962e
Fix references
EpicWink Dec 8, 2023
fa0788c
Add PEP 658
EpicWink Dec 8, 2023
6a82b48
Remove extra space
EpicWink Dec 8, 2023
381203d
Common HTML5 spec link
EpicWink Dec 8, 2023
c5e579a
Add core-metadata to HTML example
EpicWink Dec 8, 2023
5adcc7c
Add PEP 691
EpicWink Dec 8, 2023
8d727fe
Add PEP 700
EpicWink Dec 8, 2023
9810653
Document files-list unordered
EpicWink Dec 8, 2023
602d0b4
Hashlib references with intersphinx
EpicWink Dec 8, 2023
c6cec4e
Single-underscore OpenAPI spec reference
EpicWink Dec 11, 2023
c53b9a9
Make reference names consistent
EpicWink Dec 11, 2023
2bc32e2
Fix grammar
EpicWink Dec 11, 2023
e016b32
Replace PEP 440 reference with guide ref
EpicWink Dec 11, 2023
2154e29
Remove license from OpenAPI doc
EpicWink Dec 14, 2023
f6ff452
Move 'yanked' intention to footnote
EpicWink Dec 14, 2023
1d3c63e
Add content-type format description as a footnote
EpicWink Dec 14, 2023
62fd78e
Remove redundant adjective
EpicWink Dec 18, 2023
f26cb15
Use 'versionadded' directive
EpicWink Dec 18, 2023
ec1068a
Remove unnecessary hyphen
EpicWink Jan 2, 2024
7e583aa
Fix representation-specific content-types
EpicWink Jan 2, 2024
f622a75
Refer to representation-specific details for core-metadata file exist…
EpicWink Jan 2, 2024
2eff730
Merge remote-tracking branch 'upstream/main' into simple-repo-api
EpicWink Jan 17, 2024
6c5e05f
Merge remote-tracking branch 'upstream/main' into simple-repo-api
EpicWink Jan 22, 2024
3ba0284
Merge remote-tracking branch 'upstream/main' into simple-repo-api
EpicWink Jan 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
199 changes: 199 additions & 0 deletions source/specifications/simple-repository-api.openapi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
openapi: '3.1.0'

info:
title: Simple Repository API
version: '1.1'
summary: A protocol for tools to list and and download Python packages

paths:
/:
get:
summary: Projects list
description: List all projects provided by this package index
responses:
200:
description: Success
content:
text/html:
schema:
title: HTML response
type: string
application/vnd.pypi.simple.v1+html:
schema:
title: HTML response
type: string
application/vnd.pypi.simple.v1+json:
schema:
title: JSON response
type: object
required:
- meta
- projects
properties:
meta:
$ref: '#/components/schemas/meta'
projects:
title: Projects list
type: array
items:
title: Project reference
type: object
required:
- name
properties:
name:
title: Project name
type: string
example:
meta:
api-version: '1.0'
projects:
- name: Frob
- name: spamspamspam

/{project}/:
parameters:
- name: project
in: path
description: Project normalised name
required: true
example: numpy
schema:
type: string
pattern: ^[a-z0-9](-?[a-z0-9])*[a-z0-9]?$

get:
summary: Project details
description: Some project details and all package files in the index for
the project
responses:
200:
description: Success
content:
text/html:
schema:
title: HTML response
type: string
application/vnd.pypi.simple.v1+html:
schema:
title: HTML response
type: string
application/vnd.pypi.simple.v1+json:
schema:
title: JSON response
type: object
required:
- meta
- name
- files
properties:
meta:
$ref: '#/components/schemas/meta'
name:
title: Project name (normalised)
type: string
pattern: ^[a-z0-9](-?[a-z0-9])*[a-z0-9]?$
files:
title: Project package files
type: array
items:
title: Package file details
type: object
required:
- filename
- url
- hashes
properties:
filename:
title: Package filename
type: string
url:
title: File download URL
type: string
format: uri-reference
hashes:
$ref: '#/components/schemas/hashes'
requires-python:
title: Python requirement
description: Value of distribution's
`Requires-Python` metadata field
type: string
dist-info-metadata:
title: Distribution metadata file details
description: Indicates whether the distribution
metadata file exists. This file is located at the
URL equal to the package file's URL appended with
`.metadata`
oneOf:
- title: Metadata file existence
type: boolean
- $ref: '#/components/schemas/hashes'
gpg-sig:
title: File GPG signature file existence
description: Indicates whether the GPG signature
file exists. This file is located at the URL equal
to the package file's URL appended with `.asc`
type: boolean
yanked:
title: Distribution yanked details
description: Indicates whether the distribution has
been yanked
oneOf:
- title: Yanked status
type: boolean
- title: Yanked reason
type: string
example:
meta:
api-version: '1.0'
name: holygrail
files:
- filename: holygrail-1.0.tar.gz
url: https://example.com/files/holygrail-1.0.tar.gz
hashes:
sha256: ...
blake2b: ...
requires-python: '>=3.7'
yanked: Had a vulnerability
- filename: holygrail-1.0-py3-none-any.whl
url: https://example.com/files/holygrail-1.0-py3-none-any.whl
hashes:
sha256: ...
blake2b: ...
requires-python: '>=3.7'
dist-info-metadata: true

404:
description: Project not known by the index

components:
schemas:
meta:
title: Response meta-details
type: object
properties:
api-version:
type: string
enum: ['1.0', '1.1', '1.2']

hashes:
title: File hashes
type: object
additionalProperties:
title: Hash value
description: Hexadecimal encoding of hash value
type: string
pattern: ^[0-9a-f]+$
propertyNames:
title: Hash name
description: Name of hash algorithm in `hashlib`, lower-case,
preferably `sha256`
pattern: ^[a-z0-9_]+$
examples:
- sha256: 4e388ab32b10dc8dbc7e28144f552830adc74787c1e2c0824032078a79f227fb

servers:
- url: https://pypi.org/simple/
description: PyPI, the default package index used by most Python packaging
tools. It runs [Warehouse](https://warehouse.pypa.io/) as the index
server.
Loading