ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Registry.PyPI.Request

Description

PyPI's own request facts, composed through the agnostic mechanics in Ecluse.Core.Registry.Request.

Two protocol details are load-bearing. The index path carries its trailing slash, and its project segment the PEP 503 canonical name, because PyPI redirects both and no data-plane request follows a redirect. The index read asks for gzip while an artifact request advertises no encoding at all, so the bytes a client verifies against the served sha256 are the bytes that arrived.

Synopsis

The ecosystem's artifact hosts

pypiArtifactHosts :: [Text] Source #

PyPI's canonical artifact hosts, declared to the artifact-host gate so the same-host default admits the files host without an operator naming it.

Request building

simpleIndexRequest :: Text -> Maybe ClientCredential -> PackageName -> Either UrlFormationError Request Source #

Build the Simple-index GET for a project. It fails only when the URL cannot be formed, which here means an empty base URL.

artifactRequestByFile :: Text -> Maybe ClientCredential -> PackageName -> Text -> Either UrlFormationError Request Source #

Build the artifact GET at {baseUrl}/simple/{canonical-name}/{filename}, the spelling this mount serves and a private index addresses its own files under.

artifactRequestByUrl :: Maybe ClientCredential -> Text -> Either UrlFormationError Request Source #

Build PyPI's artifact GET for the absolute url the projection preserved from the index's own files[].url, so it names no base URL of its own.

URL building

simpleIndexUrl :: Text -> PackageName -> Either UrlFormationError Text Source #

The Simple-index URL {baseUrl}/simple/{canonical-name}/.

artifactFileUrl :: Text -> PackageName -> Text -> Either UrlFormationError Text Source #

The artifact URL {baseUrl}/simple/{canonical-name}/{encoded-filename}.

artifactPath :: Text -> Text -> Text Source #

simple/{canonical-project}/{file}, relative to an index root. Each component is percent-encoded, so a decoded escape cannot reach upstream raw.