thoth.solver.python package

Submodules

thoth.solver.python.base module

Classes for resolving dependencies as specified in each ecosystem.

class thoth.solver.python.base.DependencyParser[source]

Bases: object

Base class for Dependency parsing.

abstract parse(specs)[source]

Abstract method for dependency parsing.

class thoth.solver.python.base.ReleasesFetcher[source]

Bases: object

A base class for fetching package releases.

abstract fetch_releases(package)[source]

Abstract method for getting list of releases versions.

abstract index_url()[source]

Get URL to index from where releases are fetched.

class thoth.solver.python.base.Solver(*, dependency_parser: thoth.solver.python.base.DependencyParser, releases_fetcher: thoth.solver.python.base.ReleasesFetcher)[source]

Bases: object

Base class for resolving dependencies.

dependency_parser
releases_fetcher
solve(dependencies, graceful=True)[source]

Solve dependencies against a repository.

thoth.solver.python.base.get_ecosystem_solver(ecosystem_name)[source]

Get Solver subclass instance for particular ecosystem.

Parameters

ecosystem_name – name of ecosystem for which solver should be get

Returns

Solver

thoth.solver.python.instrument module

Functions which are executed inside virtual environment.

These functions are used to gather characteristics about installed packages which are analyzed.

All the functions are executed in a virtualenv - they should print information to stdout, if any error occurs they should print error messages to stderr and call sys.exit with non-zero value. All necessary functions should be either from standard virtualenv packages or from standard library to remove any dependency inference.

thoth.solver.python.instrument.execute_env_function(python_bin, function, *, env=None, raise_on_error=True, is_json=False, **function_arguments)[source]

Execute the given function in Python interpreter.

thoth.solver.python.instrument.find_distribution_name(python_bin, package_name)[source]

Find distribution name based on the package name.

thoth.solver.python.instrument.get_package_metadata(python_bin, package_name)[source]

Get metadata information from the installed package.

thoth.solver.python.python module

Dependency requirements solving for Python ecosystem.

thoth.solver.python.python.extract_metadata(metadata, index_url)[source]

Extract and enhance information from metadata.

thoth.solver.python.python.get_environment_packages(python_bin)[source]

Get information about packages in environment where packages get installed.

thoth.solver.python.python.parse_requirement_str(requirement_str)[source]

Parse a string representation of marker.

thoth.solver.python.python.resolve(requirements, index_urls, python_version, exclude_packages, transitive, virtualenv)[source]

Resolve given requirements for the given Python version.

thoth.solver.python.python_solver module

Classes for resolving dependencies as specified in each ecosystem.

class thoth.solver.python.python_solver.PythonDependencyParser[source]

Bases: thoth.solver.python.base.DependencyParser

Python Dependency parsing.

parse(specs)[source]

Parse specs.

static parse_python(spec)[source]

Parse PyPI specification of a single dependency.

Parameters

spec – str, for example “Django>=1.5,<1.8”

Returns

requirement for the Python package

class thoth.solver.python.python_solver.PythonReleasesFetcher(*, source: thoth.python.source.Source)[source]

Bases: thoth.solver.python.base.ReleasesFetcher

A releases fetcher based on PEP compatible simple API (also supporting Warehouse API).

fetch_releases(package_name)[source]

Fetch package and index_url for a package_name.

property index_url

Get URL to package source index from where releases are fetched.

source
class thoth.solver.python.python_solver.PythonSolver(*, dependency_parser: thoth.solver.python.python_solver.PythonDependencyParser, releases_fetcher: thoth.solver.python.python_solver.PythonReleasesFetcher)[source]

Bases: thoth.solver.python.base.Solver

PyPI dependencies solver.

dependency_parser
releases_fetcher

Module contents

Implementation of ecosystem specific solvers.

thoth.solver.python.get_ecosystem_solver(ecosystem_name)[source]

Get Solver subclass instance for particular ecosystem.

Parameters

ecosystem_name – name of ecosystem for which solver should be get

Returns

Solver

class thoth.solver.python.PythonReleasesFetcher(*, source: thoth.python.source.Source)[source]

Bases: thoth.solver.python.base.ReleasesFetcher

A releases fetcher based on PEP compatible simple API (also supporting Warehouse API).

fetch_releases(package_name)[source]

Fetch package and index_url for a package_name.

property index_url

Get URL to package source index from where releases are fetched.

source
class thoth.solver.python.PythonDependencyParser[source]

Bases: thoth.solver.python.base.DependencyParser

Python Dependency parsing.

parse(specs)[source]

Parse specs.

static parse_python(spec)[source]

Parse PyPI specification of a single dependency.

Parameters

spec – str, for example “Django>=1.5,<1.8”

Returns

requirement for the Python package

class thoth.solver.python.PythonSolver(*, dependency_parser: thoth.solver.python.python_solver.PythonDependencyParser, releases_fetcher: thoth.solver.python.python_solver.PythonReleasesFetcher)[source]

Bases: thoth.solver.python.base.Solver

PyPI dependencies solver.

dependency_parser
releases_fetcher
thoth.solver.python.resolve(requirements, index_urls, python_version, exclude_packages, transitive, virtualenv)[source]

Resolve given requirements for the given Python version.