pypa

lib.pypa.normalizePackageName

Normalize package name as documented in https://packaging.python.org/en/latest/specifications/name-normalization/#normalization

Type:

string -> string

Example

readPyproject "Friendly-Bard"
->
"friendly-bard"

lib.pypa.parsePythonTag

Parse Python tags.

As described in https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#python-tag.

Type: parsePythonTag :: string -> AttrSet

Example

parsePythonTag "cp37"
->
{
  implementation = "cpython";
  version = "37";
}

lib.pypa.parseABITag

Parse ABI tags.

As described in https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#python-tag.

Type

string -> AttrSet


## `lib.pypa.isSdistFileName` {#function-library-lib.pypa.isSdistFileName}

Check whether string is a sdist file or not.

### Type
`string -> bool`

### Example:
```nix
isSdistFileName "cryptography-41.0.1.tar.gz"
->
true

lib.pypa.matchWheelFileName

Regex match a wheel file name, returning a list of match groups. Returns null if no match.

Type

string -> [ string ]

lib.pypa.isWheelFileName

Check whether string is a wheel file or not.

Type

string -> bool

Example:

isWheelFileName "cryptography-41.0.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl"
->
true

lib.pypa.parseWheelFileName

Parse PEP-427 wheel file names.

Type

string -> AttrSet

Example:

parseFileName "cryptography-41.0.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl"
->
{
 abiTag = {  # Parsed by pypa.parseABITag
   implementation = "abi";
   version = "3";
   rest = "";
 };
 buildTag = null;
 distribution = "cryptography";
 languageTags = [  # Parsed by pypa.parsePythonTag
   {
     implementation = "cpython";
     version = "37";
   }
 ];
 platformTags = [ "manylinux_2_17_aarch64" "manylinux2014_aarch64" ];
 version = "41.0.1";
}

lib.pypa.isABITagCompatible

Check whether an ABI tag is compatible with this python interpreter.

Type

derivation -> string -> bool

Example:

isABITagCompatible pkgs.python3 (pypa.parseABITag "cp37")
->
true

lib.pypa.isPlatformTagCompatible

Check whether a platform tag is compatible with this python interpreter.

Type

AttrSet -> derivation -> string -> bool

Example:

isPlatformTagCompatible pkgs.python3 "manylinux2014_x86_64"
->
true

lib.pypa.isPythonTagCompatible

Check whether a Python language tag is compatible with this Python interpreter.

Type

derivation -> AttrSet -> bool

Example:

isPythonTagCompatible pkgs.python3 (pypa.parsePythonTag "py3")
->
true

lib.pypa.isWheelFileCompatible

Check whether wheel file name is compatible with this python interpreter.

Type

derivation -> AttrSet -> bool

Example:

isWheelFileCompatible pkgs.python3 (pypa.parseWheelFileName "Pillow-9.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl")
->
true

lib.pypa.selectWheels

Select compatible wheels from a list and return them in priority order.

Type

AttrSet -> derivation -> [ AttrSet ] -> [ AttrSet ]

Example:

selectWheels (lib.systems.elaborate "x86_64-linux") [ (pypa.parseWheelFileName "Pillow-9.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl") ]
->
[ (pypa.parseWheelFileName "Pillow-9.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl") ]