Documentation
¶
Overview ¶
Package pypi serves PyPI repositories at /artifactory/api/pypi/{repoKey}/ through the router kit (decisions 0032 and 0037): the simple repository API that pip, uv and Poetry install from, in HTML (PEP 503) and, when pypi.simple_json is on, JSON (PEP 691), with the wheels' core metadata files (PEP 658) when pypi.core_metadata is on, and the files themselves through the item routes' download, so redirects, Range and download counts apply to them as to any file. The pages are built on each request from what the PyPI format keeps in the package index; nothing is stored for them.
Index ¶
- func JSONMetadata(ctx context.Context, st store.Store, key, name, version, base string, ...) (map[string]any, error)
- func Protocol(o Options) pkgroute.Protocol
- func RepoURL(base, key string) string
- func WriteMetadata(w http.ResponseWriter, doc map[string]any, head bool) error
- type Options
- type Reads
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JSONMetadata ¶
func JSONMetadata( ctx context.Context, st store.Store, key, name, version, base string, reads Reads, ) (map[string]any, error)
JSONMetadata builds the Warehouse-shaped document from the caller's visible index. Filtering precedes version and metadata selection, so neither a hidden newer release nor the metadata of a hidden earlier file can leak.
func Protocol ¶
Protocol is the PyPI protocol. Its errors are in Artifactory's envelope, as every 7.x answer under /api/pypi/ is (decision 0037); pip, uv and twine read only the status. The reindex is not reserved: a GET of "reindex" names a file at the repository's root, while the operation's own POST reaches the generated server ahead of the kit.
func RepoURL ¶
RepoURL is the URL of the repository key under /api/pypi/ at base, the server's base URL.
func WriteMetadata ¶
WriteMetadata gives generated GET and kit HEAD the same representation headers, including its byte length even when no body is sent.
Types ¶
type Options ¶
type Options struct {
// Format are the PyPI format's settings, whose SimpleJSON and
// CoreMetadata decide what the simple index answers.
Format pypifmt.Settings
// RemoteSources opts the native protocol into remote metadata and artifact reads.
RemoteSources *source.Service
}
Options are the PyPI protocol's settings.