thoth.adviser.sieves package

Submodules

thoth.adviser.sieves.abi_compat module

Filter out stacks which have require non-existent ABI symbols.

class thoth.adviser.sieves.abi_compat.AbiCompatibilitySieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

Remove packages if the image being used doesn’t have necessary ABI.

image_symbols
pre_run() → None[source]

Initialize image_symbols.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

If package requires non-present symbols remove it.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Include sieve which checks for abi compatability.

thoth.adviser.sieves.filter_index module

A sieve to filter out packages based on Python package index configured.

class thoth.adviser.sieves.filter_index.FilterIndexSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

A sieve to filter out packages based on Python package index configured.

The filtering is done based on configuration supplied - per package-version. The sieve is configured using the following pipeline configuration entry:

{

“package_name”: “tensorflow”, “index_url”: [

]

}

CONFIGURATION_DEFAULT = {'index_url': None, 'package_name': None}
CONFIGURATION_SCHEMA = <Schema({'package_name': <class 'str'>, 'index_url': [<class 'str'>]}, extra=PREVENT_EXTRA, required=False) object>
run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Filter out packages based on Python package index configured for the given package.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Register self, never.

thoth.adviser.sieves.index_enabled module

A sieve for filtering out disabled Python package indexes.

class thoth.adviser.sieves.index_enabled.PackageIndexSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None, cached_records: Dict[str, Optional[bool]] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

Filter out disabled Python package indexes.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Filter out package versions based on disabled Python package index.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Remove indexes which are not enabled in pipeline configuration.

thoth.adviser.sieves.locked module

A step to filter out packages that are pinned to a specific version.

class thoth.adviser.sieves.locked.CutLockedSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

Cut-off packages that are locked to a specific version.

If a project pins down a package to a specific release, respect that. Otherwise resolver does not need to find any resolved stack, especially considering only N latest versions and the pinned version is >=N+1 version.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Cut-off locked versions to a specific version.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Include cut-locked pipeline sieve for adviser or Dependency Monkey, always.

thoth.adviser.sieves.prereleases module

A sieve to filter out pre-releases in direct dependencies.

class thoth.adviser.sieves.prereleases.CutPreReleasesSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

Cut-off pre-releases if project does not explicitly allows them.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Cut-off pre-releases if project does not explicitly allows them.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Include cut-prereleases pipeline sieve for adviser or Dependency Monkey if pre-releases are not allowed.

thoth.adviser.sieves.solved module

A sieve for filtering out build time/installation errors of Python packages.

class thoth.adviser.sieves.solved.SolvedSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

Filter out build time/installation errors of Python packages.

CONFIGURATION_DEFAULT = {'without_error': True}
pre_run() → None[source]

Initialize this pipeline unit before each run.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Filter out packages based on build time/installation issues..

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Include solved pipeline sieve for adviser or Dependency Monkey on pipeline creation.

thoth.adviser.sieves.version_constraint module

A sieve for filtering packages based on constraints.

This sieve will filter out packages in specific versions if they occur in the resolved stack.

class thoth.adviser.sieves.version_constraint.VersionConstraintSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

Filter out packages based on version constraints if they occur in the stack.

CONFIGURATION_DEFAULT = {'package_name': None, 'version_specifier': None}
pre_run() → None[source]

Parse and initialize specifier used.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Filter out packages based on build time/installation issues..

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Include this sieve only if user explicitly asks for it.

Module contents

Implementation of sieves used in adviser pipeline.

class thoth.adviser.sieves.CutPreReleasesSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

Cut-off pre-releases if project does not explicitly allows them.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Cut-off pre-releases if project does not explicitly allows them.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Include cut-prereleases pipeline sieve for adviser or Dependency Monkey if pre-releases are not allowed.

class thoth.adviser.sieves.CutLockedSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

Cut-off packages that are locked to a specific version.

If a project pins down a package to a specific release, respect that. Otherwise resolver does not need to find any resolved stack, especially considering only N latest versions and the pinned version is >=N+1 version.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Cut-off locked versions to a specific version.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Include cut-locked pipeline sieve for adviser or Dependency Monkey, always.

class thoth.adviser.sieves.PackageIndexSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None, cached_records: Dict[str, Optional[bool]] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

Filter out disabled Python package indexes.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Filter out package versions based on disabled Python package index.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Remove indexes which are not enabled in pipeline configuration.

class thoth.adviser.sieves.SolvedSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

Filter out build time/installation errors of Python packages.

CONFIGURATION_DEFAULT = {'without_error': True}
pre_run() → None[source]

Initialize this pipeline unit before each run.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Filter out packages based on build time/installation issues..

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Include solved pipeline sieve for adviser or Dependency Monkey on pipeline creation.

class thoth.adviser.sieves.VersionConstraintSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

Filter out packages based on version constraints if they occur in the stack.

CONFIGURATION_DEFAULT = {'package_name': None, 'version_specifier': None}
pre_run() → None[source]

Parse and initialize specifier used.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Filter out packages based on build time/installation issues..

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Include this sieve only if user explicitly asks for it.

class thoth.adviser.sieves.AbiCompatibilitySieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

Remove packages if the image being used doesn’t have necessary ABI.

image_symbols
pre_run() → None[source]

Initialize image_symbols.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

If package requires non-present symbols remove it.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Include sieve which checks for abi compatability.

class thoth.adviser.sieves.FilterIndexSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

A sieve to filter out packages based on Python package index configured.

The filtering is done based on configuration supplied - per package-version. The sieve is configured using the following pipeline configuration entry:

{

“package_name”: “tensorflow”, “index_url”: [

]

}

CONFIGURATION_DEFAULT = {'index_url': None, 'package_name': None}
CONFIGURATION_SCHEMA = <Schema({'package_name': <class 'str'>, 'index_url': [<class 'str'>]}, extra=PREVENT_EXTRA, required=False) object>
run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Filter out packages based on Python package index configured for the given package.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Register self, never.

class thoth.adviser.sieves.Enum34BackportSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

Remove backport of enum34, available in the standard library starting Python 3.4.

https://pypi.org/project/enum34/ https://docs.python.org/3/library/enum.html

pre_run() → None[source]

Initialize self before running.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Remove dependency enum34 for newer Python versions.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Include for Python 3.5 and above for adviser and dependency monkey runs.

class thoth.adviser.sieves.Functools32BackportSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

Remove backport of functools, available in the standard library starting Python 3.2.

https://pypi.org/project/functools32/ https://docs.python.org/3/library/functools.html

pre_run() → None[source]

Initialize self before running.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Remove dependency functools32 for newer Python versions.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Include for Python 3.3 and above for adviser and dependency monkey runs.

class thoth.adviser.sieves.ImportlibMetadataBackportSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

Remove backport of importlib-metadata, available in the standard library starting Python 3.8.

https://pypi.org/project/importlib-metadata/ https://docs.python.org/3/library/importlib.metadata.html

pre_run() → None[source]

Initialize self before running.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Remove dependency importlib-metadata for newer Python versions.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Include for Python 3.8 and above for adviser and dependency monkey runs.

class thoth.adviser.sieves.ImportlibResourcesBackportSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

Remove backport of importlib-resources, available in the standard library starting Python 3.8.

https://pypi.org/project/importlib-resources/ https://docs.python.org/3/library/importlib.html https://docs.python.org/3/library/importlib.metadata.html

pre_run() → None[source]

Initialize self before running.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Remove dependency importlib-resources for newer Python versions.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Include for Python 3.8 and above for adviser and dependency monkey runs.

class thoth.adviser.sieves.MockBackportSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

Remove backport of unittest.mock, available in the standard library starting Python 3.3.

https://pypi.org/project/mock/ https://docs.python.org/3/library/unittest.mock.html

pre_run() → None[source]

Initialize self before running.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Remove dependency mock for newer Python versions.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Include for Python 3.3 and above for adviser and dependency monkey runs.

class thoth.adviser.sieves.Py36SetuptoolsSieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

Filter out old setuptools that do not work with Python 3.6.

https://github.com/pypa/setuptools/issues/378 https://github.com/thoth-station/solver/issues/350

pre_run() → None[source]

Initialize this pipeline unit before each run.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Filter out old setuptools that do not work with Python 3.6.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Include for Python 3.6 and adviser/dependency monkey runs.

class thoth.adviser.sieves.TensorFlowCUDASieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

A sieve that makes sure the right TensorFlow version is used when CUDA is present in the runtime environment.

See supported matrix at https://www.tensorflow.org/install/source#linux

pre_run() → None[source]

Initialize this pipeline unit before each run.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Use specific TensorFlow release based on CUDA version present in the runtime environment.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Register this pipeline unit for adviser when CUDA is present.

class thoth.adviser.sieves.PandasPy36Sieve(*, configuration: Dict[str, Any] = NOTHING, name: str = None)[source]

Bases: thoth.adviser.sieve.Sieve

A sieve that makes sure Pandas>=1.2 is not used on Python 3.6 or older.

See https://github.com/pandas-dev/pandas/pull/35214

pre_run() → None[source]

Initialize this pipeline unit before each run.

run(package_versions: Generator[[thoth.python.package_version.PackageVersion, None], None]) → Generator[[thoth.python.package_version.PackageVersion, None], None][source]

Do not use Pandas>=1.2 on Python 3.6.

classmethod should_include(builder_context: PipelineBuilderContext) → Optional[Dict[str, Any]][source]

Register this pipeline unit for adviser when Python 3.6 is used, not latest/testing recommendations.