pypa

lib.pypa.normalizePackageName

Type: normalizePackageName :: string -> string

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

::: {.example #function-library-example-lib.pypa.normalizePackageName}

lib.pypa.normalizePackageName usage example

# readPyproject "Friendly-Bard"
"friendly-bard"

:::

lib.pypa.parsePythonTag

Type: parsePythonTag :: string -> AttrSet

Parse Python tags.

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

tag

: Function argument

::: {.example #function-library-example-lib.pypa.parsePythonTag}

lib.pypa.parsePythonTag usage example

# parsePythonTag "cp37"
{
  implementation = "cpython";
  version = "37";
}

:::

lib.pypa.parseABITag

Type: parseABITag :: string -> AttrSet

Parse ABI tags.

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

tag

: Function argument

::: {.example #function-library-example-lib.pypa.parseABITag}

lib.pypa.parseABITag usage example

# parseABITag "cp37dmu"
{
  rest = "dmu";
  implementation = "cp";
  version = "37";
}

:::

lib.pypa.isSdistFileName

Type: isSdistFileName :: string -> bool

Check whether string is a sdist file or not.

name

: The filename string

::: {.example #function-library-example-lib.pypa.isSdistFileName}

lib.pypa.isSdistFileName usage example

# isSdistFileName "cryptography-41.0.1.tar.gz"
true

:::

lib.pypa.matchWheelFileName

Type: matchWheelFileName :: string -> [ string ]

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

name

: Function argument

lib.pypa.isWheelFileName

Type: isWheelFileName :: string -> bool

Check whether string is a wheel file or not.

name

: The filename string

::: {.example #function-library-example-lib.pypa.isWheelFileName}

lib.pypa.isWheelFileName usage example

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

:::

lib.pypa.parseWheelFileName

Type: parseFileName :: string -> AttrSet

Parse PEP-427 wheel file names.

name

: The wheel filename is {distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl.

::: {.example #function-library-example-lib.pypa.parseWheelFileName}

lib.pypa.parseWheelFileName usage 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

Type: isABITagCompatible :: derivation -> string -> bool

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

python

: Python interpreter derivation

abiTag

: ABI tag string

::: {.example #function-library-example-lib.pypa.isABITagCompatible}

lib.pypa.isABITagCompatible usage example

# isABITagCompatible pkgs.python3 (pypa.parseABITag "cp37")
true

:::

lib.pypa.isPlatformTagCompatible

Type: isPlatformTagCompatible :: AttrSet -> derivation -> string -> bool

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

platform

: Platform attrset (lib.systems.elaborate "x86_64-linux")

libc

: Libc derivation

platformTag

: Python tag

::: {.example #function-library-example-lib.pypa.isPlatformTagCompatible}

lib.pypa.isPlatformTagCompatible usage example

# isPlatformTagCompatible pkgs.python3 "manylinux2014_x86_64"
true

:::

lib.pypa.isPythonTagCompatible

Type: isPythonTagCompatible :: derivation -> AttrSet -> bool

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

python

: Python interpreter derivation

pythonTag

: Python tag

::: {.example #function-library-example-lib.pypa.isPythonTagCompatible}

lib.pypa.isPythonTagCompatible usage example

# isPythonTagCompatible pkgs.python3 (pypa.parsePythonTag "py3")
true

:::

lib.pypa.isWheelFileCompatible

Type: isWheelFileCompatible :: derivation -> AttrSet -> bool

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

platform

: Platform attrset (lib.systems.elaborate "x86_64-linux")

libc

: Libc derivation

python

: Python interpreter derivation

file

: The parsed wheel filename

::: {.example #function-library-example-lib.pypa.isWheelFileCompatible}

lib.pypa.isWheelFileCompatible usage 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

Type: selectWheels :: AttrSet -> derivation -> [ AttrSet ] -> [ AttrSet ]

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

platform

: Platform attrset (lib.systems.elaborate "x86_64-linux")

python

: Python interpreter derivation

files

: List of files as parsed by parseWheelFileName

::: {.example #function-library-example-lib.pypa.selectWheels}

lib.pypa.selectWheels usage 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") ]

:::