pimlico.core.dependencies.python module

Tools for Python library dependencies.

Provides superclasses for Python library dependencies and a selection of commonly used dependency instances.

class pimlico.core.dependencies.python.PythonPackageDependency(package, name, **kwargs)[source]

Bases: pimlico.core.dependencies.base.SoftwareDependency

Base class for Python dependencies. Provides import checks, but no installation routines. Subclasses should either provide install() or installation_instructions().

get_installed_version()[source]

Tries to import a __version__ variable from the package, which is a standard way to define the package version.

import_package()[source]

Try importing package_name. By default, just uses __import__. Allows subclasses to allow for special import behaviour.

Should raise an ImportError if import fails.

problems()[source]
class pimlico.core.dependencies.python.PythonPackageOnPip(package, name=None, pip_package=None, **kwargs)[source]

Bases: pimlico.core.dependencies.python.PythonPackageDependency

Python package that can be installed via pip. Will be installed in the virtualenv if not available.

get_installed_version()[source]
install(trust_downloaded_archives=False)[source]
installable()[source]
class pimlico.core.dependencies.python.PythonPackageSystemwideInstall(package_name, name, pip_package=None, apt_package=None, yum_package=None, **kwargs)[source]

Bases: pimlico.core.dependencies.python.PythonPackageDependency

Dependency on a Python package that needs to be installed system-wide.

installable()[source]
installation_instructions()[source]