pimlico.core.dependencies.base module

Base classes for defining software dependencies for module types and routines for fetching them.

exception pimlico.core.dependencies.base.InstallationError[source]

Bases: exceptions.Exception

class pimlico.core.dependencies.base.LegacyDatatypeDependencies(datatype)[source]

Bases: pimlico.core.dependencies.base.SoftwareDependency

Wrapper for datatypes that still use the old check_runtime_dependencies() method to specify their dependencies. A single instance of this represents all of a datatype’s dependencies. None of them are automatically installable, but notes/installation instructions are provided.

Can also be applied to datatypes, which also have a check_runtime_dependencies() method.

This will be removed when the deprecated check_runtime_dependencies() method is removed.

installable()[source]
installation_instructions()[source]
problems()[source]
class pimlico.core.dependencies.base.LegacyModuleDependencies(module)[source]

Bases: pimlico.core.dependencies.base.SoftwareDependency

Wrapper for modules that still use the old check_runtime_dependencies() method to specify their dependencies. A single instance of this represents all of a module’s dependencies. None of them are automatically installable, but notes/installation instructions are provided.

This will be removed when the deprecated check_runtime_dependencies() method is removed.

installable()[source]
installation_instructions()[source]
problems()[source]
class pimlico.core.dependencies.base.SoftwareDependency(name, url=None, dependencies=None)[source]

Bases: object

Base class for all Pimlico module software dependencies.

all_dependencies()[source]

Recursively fetch all dependencies of this dependency (not including itself).

available()[source]

Return True if the dependency is satisfied, meaning that the software/library is installed and ready to use.

dependencies()[source]

Returns a list of instances of :class:SoftwareDependency subcalsses representing this library’s own dependencies. If the library is already available, these will never be consulted, but if it is to be installed, we will check first that all of these are available (and try to install them if not).

install(trust_downloaded_archives=False)[source]

Should be overridden by any subclasses whose library is automatically installable. Carries out the actual installation.

You may assume that all dependencies returned by :method:dependencies have been satisfied prior to calling this.

installable()[source]

Return True if it’s possible to install this library automatically. If False, the user will have to install it themselves. Instructions for doing this may be provided by installation_instructions(), which will only generally be called if installable() returns False.

This might be the case, for example, if the software is not available to download freely, or if it requires a system-wide installation.

installation_instructions()[source]

Where a dependency can’t be installed programmatically, we typically want to be able to output instructions for the user to tell them how to go about doing it themselves. Any subclass that doesn’t provide an automatic installation routine should override this to provide instructions.

problems()[source]

Returns a list of problems standing in the way of the dependency being available. If the list is empty, the dependency is taken to be installed and ready to use.

Overriding methods should call super method.

class pimlico.core.dependencies.base.SystemCommandDependency(name, test_command, **kwargs)[source]

Bases: pimlico.core.dependencies.base.SoftwareDependency

Dependency that tests whether a command is available on the command line. Generally requires system-wide installation.

installable()[source]

Usually not automatically installable

problems()[source]
pimlico.core.dependencies.base.check_and_install(deps, trust_downloaded_archives=False)[source]

Check whether dependencies are available and try to install those that aren’t. Returns a list of dependencies that can’t be installed.

pimlico.core.dependencies.base.install(dep, trust_downloaded_archives=False)[source]
pimlico.core.dependencies.base.recursive_deps(dep)[source]

Collect all recursive dependencies of this dependency. Does a depth-first search so that everything comes later in the list than things it depends on.