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.

Synopsis

Projection

projectSimpleIndex :: PackageName -> [InvalidEntry] -> [(IndexFile, Maybe FileCoordinate)] -> PackageInfo Source #

Group decoded files by the coordinates their read produced. The decode's invalid entries come first, then one for each file without a coordinate.

File coordinates

data FileCoordinate Source #

A filename's canonical release and distribution kind.

Constructors

FileCoordinate 

Fields

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.

data FileProject Source #

A project's PEP 503 key, prepared once for reading many of its filenames.

fileProject :: PackageName -> FileProject Source #

Prepare a project for reading its filenames.

fileVersionKey :: FileProject -> Text -> Maybe Text Source #

Read a filename's release key, with the same refusals as fileCoordinate.

data FilenameMemo Source #

One read's PEP 440 results 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.

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.