Requires
Stub module for specifying dependencies for Autopilot objects.
Draft for now, to be integrated in v0.5.0
Classes:
|
Base class for different kinds of requirements |
|
Specify a git repository or its subcomponents: branch, commit, or tag |
|
|
|
System-level package |
|
Dataclass for a collection of requirements for a particular object. |
- class Requirement(name: str, version: ~packaging.specifiers.SpecifierSet = <SpecifierSet('')>)[source]
Bases:
ABCBase class for different kinds of requirements
Attributes:
Check if a requirement is met
Methods:
resolve()Try and resolve a requirement by getting packages, changing system settings, etc.
- version: SpecifierSet = <SpecifierSet('')>
- class Git_Spec(url: URL, branch: str | None = None, commit: str | None = None, tag: str | None = None)[source]
Bases:
objectSpecify a git repository or its subcomponents: branch, commit, or tag
Attributes:
- class Python_Package(name: str, version: ~packaging.specifiers.SpecifierSet = <SpecifierSet('')>, package_name: str | None = None, repository: ~autopilot.utils.types.URL = 'https://pypi.org/simple', git: ~autopilot.utils.requires.Git_Spec | None = None)[source]
Bases:
Requirement- Variables:
package_name (str) – If a package is named differently in package repositories than it is imported, specify the
package_name(default ispackage_name == name). Thenamewill be used to test whether the package can be imported, andpackage_nameused to install from the specifiedrepositoryif notrepository (
URL) – The URL of a python package repository to use to install. Defaults to pypi(class (git) – .Git_Spec): Specify a package comes from a particular git repository, commit, or branch instead of from a package repository. If
gitis present,repositoryis ignored.
Attributes:
The
importlib.machinery.ModuleSpecforname, if present, otherwise FalseThe version of the installed package, if found.
Return
Trueif python package is found in the PYTHONPATH that satisfies theSpecifierSetMethods:
resolve()We're not supposed to Returns:
- property import_spec: ModuleSpec | bool
The
importlib.machinery.ModuleSpecforname, if present, otherwise False- Returns:
importlib.machinery.ModuleSpecor False
- property package_version: str | bool
The version of the installed package, if found. Uses
package_name(name when installing, eg.auto-pi-lot) which can differ from thename(eg.autopilot) of a package (used when importing)- Returns:
‘x.x.x’ or False if not found
- Return type:
- class System_Library(name: str, version: ~packaging.specifiers.SpecifierSet = <SpecifierSet('')>)[source]
Bases:
RequirementSystem-level package
Warning
not implemented
Attributes:
- class Requirements(requirements: List[Requirement])[source]
Bases:
objectDataclass for a collection of requirements for a particular object. Each object should have at most one
Requirementsobject, which may have many sub-requirements- Variables:
requirements (list[Requirement]) – List of requirements. (a singular requirement should have an identical API to requirements, the met and resolve methods)
Attributes:
Checks if the specified requirements are met
Methods:
resolve()__add__(other)Add requirement sets together
- requirements: List[Requirement]