ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Registry.PyPI.Project

Description

Project decoded PyPI files into releases keyed by canonical PEP 440 versions. The same filename parser supplies coordinates for upstream projection and inbound routes. An upload's file name passes a stricter form of it.

Synopsis

Projection

projectSimpleIndex :: PackageName -> [InvalidEntry] -> [ProjectedFile] -> PackageInfo Source #

Group files supplied in reverse source order, keeping artifact and diagnostic order. Decode errors come first.

data ProjectedFile Source #

A file's domain facts or identity diagnostic, independent of its decoded wire record.

projectFile :: IndexFile -> Maybe FileCoordinate -> ProjectedFile Source #

Project before retaining a file, so distribution hash maps and wire-only fields can be released.

projectedEntryKey :: ProjectedFile -> EntryKey Source #

The original array coordinate remains available for replay, including rejected filenames.

File coordinates

data FileCoordinate Source #

A filename's canonical release and distribution kind.

Constructors

FileCoordinate 

Fields

fcVersionKey :: FileCoordinate -> Text Source #

The release key: the file's version in canonical PEP 440 form.

data DistributionKind Source #

Whether a file is a source distribution, whose install runs its own build, or a wheel.

Constructors

Sdist 
Wheel 

fileCoordinate :: PackageName -> Text -> Maybe FileCoordinate Source #

Read a filename's coordinate, rejecting another project, an unknown archive, or invalid PEP 440.

builtFileCoordinate :: PackageName -> Text -> Maybe FileCoordinate Source #

Read as fileCoordinate does, refusing a name no current build tool writes: a non-PEP 625 sdist, or a version not led by a digit or holding -.

data FilenameMemo Source #

One read's PEP 440 versions by version text, so the files of one release parse their version once.

filenameMemo :: PackageName -> FilenameMemo Source #

Start a memo for one index read. It ends with the read, so no request inherits its versions.

readCoordinate :: FilenameMemo -> Text -> (Maybe FileCoordinate, FilenameMemo) Source #

Read a coordinate as fileCoordinate does, parsing each distinct version text once.

readLatestCoordinate :: FilenameMemo -> Text -> (Maybe FileCoordinate, FilenameMemo) Source #

Read as readCoordinate does, retaining only the latest version text for this read.

Name validation

projectName :: Text -> Either ParseError PackageName Source #

Parse one PyPI name component under the shared floor and PEP 508 grammar.

canonicalName :: PackageName -> Text Source #

The PEP 503 key used for filename comparison and upstream Simple-index URLs.

isCanonicalName :: Text -> Bool Source #

Whether the route can claim this name without a canonical-spelling redirect.

isNameSeparator :: Char -> Bool Source #

The characters PEP 503 treats as one separator when it normalises a name.

pypiNameLeadChars :: [Char] Source #

Initial characters for partitioning canonical PyPI names during a store walk.