Requires

Stub module for specifying dependencies for Autopilot objects.

Draft for now, to be integrated in v0.5.0

Classes:

Requirement(name, version)

Base class for different kinds of requirements

Git_Spec(url[, branch, commit, tag])

Specify a git repository or its subcomponents: branch, commit, or tag

Python_Package(name, version, package_name, ...)

ivar package_name

If a package is named differently in package repositories than it is imported,

System_Library(name, version)

System-level package

Requirements(requirements)

Dataclass for a collection of requirements for a particular object.

class Requirement(name: str, version: ~packaging.specifiers.SpecifierSet = <SpecifierSet('')>)[source]

Bases: ABC

Base class for different kinds of requirements

Attributes:

name

version

met

Check if a requirement is met

Methods:

resolve()

Try and resolve a requirement by getting packages, changing system settings, etc.

name: str
version: SpecifierSet = <SpecifierSet('')>
abstract property met: bool

Check if a requirement is met

Returns

True if met, False otherwise

Return type

bool

abstract resolve() bool[source]

Try and resolve a requirement by getting packages, changing system settings, etc.

Returns

True if successful!

Return type

bool

class Git_Spec(url: 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:

url

branch

commit

tag

url: URL
branch: Optional[str] = None
commit: Optional[str] = None
tag: Optional[str] = None
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: Requirement

Variables
  • package_name (str) – If a package is named differently in package repositories than it is imported, specify the package_name (default is package_name == name). The name will be used to test whether the package can be imported, and package_name used to install from the specified repository if not

  • repository (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:

package_name

repository

git

import_spec

The importlib.machinery.ModuleSpec for name , if present, otherwise False

package_version

The version of the installed package, if found.

met

Return True if python package is found in the PYTHONPATH that satisfies the SpecifierSet

Methods:

resolve()

We're not supposed to Returns:

package_name: Optional[str] = None
repository: URL = 'https://pypi.org/simple'
git: Optional[Git_Spec] = None
property import_spec: Union[ModuleSpec, bool]

The importlib.machinery.ModuleSpec for name , 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 the name (eg. autopilot ) of a package (used when importing)

Returns

‘x.x.x’ or False if not found

Return type

str

property met: bool

Return True if python package is found in the PYTHONPATH that satisfies the SpecifierSet

resolve() bool[source]

We’re not supposed to Returns:

name: str
class System_Library(name: str, version: ~packaging.specifiers.SpecifierSet = <SpecifierSet('')>)[source]

Bases: Requirement

System-level package

Warning

not implemented

Attributes:

name: str
class Requirements(requirements: List[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:

requirements

met

Checks if the specified requirements are met

Methods:

resolve()

__add__(other)

Add requirement sets together

requirements: List[Requirement]
property met: bool

Checks if the specified requirements are met

Returns

True if requirements are met, False if not

Return type

bool

resolve() bool[source]
__add__(other)[source]

Add requirement sets together

Warning

Not Implemented

Parameters

other ()

Returns: