httk.core.requirements

Parse and check minimum-version requirements on installed distributions.

Manifests declare requires = ["httk-workflow>=2.2.0", ...]. Only the >= operator is supported, with a plain release N(.N)* on the right. Installed versions are compared in PEP 440 order without a packaging dependency: a pre or dev release of the required release does not satisfy it, while a post release or local label does.

Exceptions

RequirementError

Report that installed distributions do not meet declared requirements.

Classes

Requirement

Describe one minimum-version requirement.

Functions

parse_requirements(values, where)

Parse a requires list of NAME>=VERSION strings.

unmet_requirements(requirements)

Describe the requirements the running interpreter does not meet.

check_requirements(requirements, what)

Require every requirement to be met by the running interpreter.

Module Contents

exception httk.core.requirements.RequirementError

Bases: ValueError

Report that installed distributions do not meet declared requirements.

class httk.core.requirements.Requirement

Describe one minimum-version requirement.

Parameters:
  • name – Name the distribution, normalized per PEP 503.

  • minimum – Give the minimum release segments.

  • text – Give the requirement as declared, without whitespace.

name: str
minimum: tuple[int, ...]
text: str
httk.core.requirements.parse_requirements(values, where)

Parse a requires list of NAME>=VERSION strings.

Parameters:
  • values (object) – Supply the raw manifest value.

  • where (str) – Name the manifest key in error messages.

Returns:

The parsed requirements in declaration order.

Raises:

ValueError – If the value is not a list of valid, distinct requirement strings.

Return type:

tuple[Requirement, …]

httk.core.requirements.unmet_requirements(requirements)

Describe the requirements the running interpreter does not meet.

Parameters:

requirements (collections.abc.Iterable[Requirement]) – Check these requirements.

Returns:

One message per unmet requirement, e.g. "httk-workflow>=2.2.0 (installed: 2.1.1)".

Return type:

tuple[str, …]

httk.core.requirements.check_requirements(requirements, what)

Require every requirement to be met by the running interpreter.

Parameters:
Raises:

RequirementError – If any requirement is unmet; the message lists every one.