ssg.requirement_specs module

Common functions for processing Requirements Specs in SSG

class ssg.requirement_specs.Requirement(obj)[source]

Bases: object

A class to represent a package requirement with version specifications.

_req

The parsed requirement object.

Type:

pkg_resources.Requirement

_specs

The set of version specifiers for the requirement.

Type:

utils.VersionSpecifierSet

property arg

Retrieve the first extra requirement if available.

Returns:

The first element in the extras list if it exists, otherwise None.

static get_base_for_parametrized(name)[source]

Extracts the base project name from a given parameterized package name.

Parameters:

name (str) – The parameterized package name to parse.

Returns:

The base project name of the package.

Return type:

str

has_version_specs()[source]

Check if the requirement has version specifications.

Returns:

True if there are version specifications, False otherwise.

Return type:

bool

static is_parametrized(name)[source]

Check if a package requirement is parametrized.

A parametrized package requirement includes extras, which are additional features or dependencies that can be optionally included.

Parameters:

name (str) – The name of the package requirement to check.

Returns:

True if the package requirement is parametrized (includes extras),

False otherwise.

Return type:

bool

property name

Retrieve the project name from the requirement specifications.

Returns:

The name of the project.

Return type:

str

property ver_specs

Retrieve the specifications.

Returns:

The specifications stored in the instance.

Return type:

dict