ssg.requirement_specs module
Common functions for processing Requirements Specs in SSG
- class ssg.requirement_specs.Requirement(obj)[source]
Bases:
objectA class to represent a package requirement with version specifications.
- Attributes:
_req (pkg_resources.Requirement): The parsed requirement object. _specs (utils.VersionSpecifierSet): The set of version specifiers for the requirement.
- 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.
- Args:
name (str): The parameterized package name to parse.
- Returns:
str: The base project name of the package.
- has_version_specs()[source]
Check if the requirement has version specifications.
- Returns:
bool: True if there are version specifications, False otherwise.
- 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.
- Args:
name (str): The name of the package requirement to check.
- Returns:
- bool: True if the package requirement is parametrized (includes extras),
False otherwise.
- property name
Retrieve the project name from the requirement specifications.
- Returns:
str: The name of the project.
- property ver_specs
Retrieve the specifications.
- Returns:
dict: The specifications stored in the instance.