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:
abc.ABC
Base 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: packaging.specifiers.SpecifierSet = <SpecifierSet('')>
- class Git_Spec(url: autopilot.utils.types.URL, branch: Optional[str] = None, commit: Optional[str] = None, tag: Optional[str] = None)[source]
Bases:
object
Specify a git repository or its subcomponents: branch, commit, or tag
Attributes:
- class Python_Package(name: str, version: packaging.specifiers.SpecifierSet = <SpecifierSet('')>, package_name: typing.Optional[str] = None, repository: autopilot.utils.types.URL = 'https://pypi.org/simple', git: typing.Optional[autopilot.utils.requires.Git_Spec] = None)[source]
Bases:
autopilot.utils.requires.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
). Thename
will be used to test whether the package can be imported, andpackage_name
used to install from the specifiedrepository
if 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
git
is present,repository
is ignored.
Attributes:
The
importlib.machinery.ModuleSpec
forname
, if present, otherwise FalseThe version of the installed package, if found.
Return
True
if python package is found in the PYTHONPATH that satisfies theSpecifierSet
Methods:
resolve
()We're not supposed to Returns:
- repository: autopilot.utils.types.URL = 'https://pypi.org/simple'
- git: Optional[autopilot.utils.requires.Git_Spec] = None
- property import_spec: Union[ModuleSpec, bool]
The
importlib.machinery.ModuleSpec
forname
, if present, otherwise False- Returns
importlib.machinery.ModuleSpec
or False
- property package_version: Union[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:
autopilot.utils.requires.Requirement
System-level package
Warning
not implemented
Attributes:
- class Requirements(requirements: List[autopilot.utils.requires.Requirement])[source]
Bases:
object
Dataclass for a collection of requirements for a particular object. Each object should have at most one
Requirements
object, 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[autopilot.utils.requires.Requirement]