thoth.adviser.sieves package

Subpackages

Submodules

thoth.adviser.sieves.experimental_filter_conf_index module

A sieve to filter out packages coming from other indexes than the ones configured.

class thoth.adviser.sieves.experimental_filter_conf_index.FilterConfiguredIndexSieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

A sieve to filter out packages coming from other indexes than the ones configured.

CONFIGURATION_DEFAULT = {'allowed_indexes': None, 'package_name': None}
CONFIGURATION_SCHEMA = <Schema({'package_name': None, 'allowed_indexes': {<class 'str'>}}, extra=PREVENT_EXTRA, required=False) object>
packages_seen
pre_run() → None[source]

Initialize this unit before each run.

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

Cut-off packages that are not coming from an allowed index.

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

Enable this pipeline unit if the adjustment is enabled.

to_dict() → Dict[str, Any][source]

Turn this pipeline step into its dictionary representation, override to have unit JSON serializable.

thoth.adviser.sieves.experimental_package_index module

A sieve to filter out packages based on index configuration.

class thoth.adviser.sieves.experimental_package_index.PackageIndexConfigurationSieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

A sieve to filter out packages based on index configuration.

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>
packages_seen
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]

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

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

Register for each package.

thoth.adviser.sieves.experimental_prereleases module

A sieve to filter out pre-releases, selectively.

class thoth.adviser.sieves.experimental_prereleases.SelectiveCutPreReleasesSieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

Enable or disable specific pre-releases for the given set of packages..

CONFIGURATION_DEFAULT = {'allow_prereleases': None, 'package_name': None}
CONFIGURATION_SCHEMA = <Schema({'package_name': None, 'allow_prereleases': <Schema({<class 'str'>: <class 'bool'>}, extra=PREVENT_EXTRA, required=False) object>}, extra=PREVENT_EXTRA, required=False) object>
packages_seen
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]

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

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

Enable or disable specific pre-releases for the given set of packages..

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(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[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) → Generator[Dict[str, Any], None, None][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(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING, cached_records: Dict[str, Optional[bool]] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

Filter out disabled Python package indexes.

CONFIGURATION_DEFAULT = {'package_name': None}
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) → Generator[Dict[str, Any], None, None][source]

Remove indexes which are not enabled in pipeline configuration.

thoth.adviser.sieves.legacy_version module

A sieve to filter out legacy versions.

class thoth.adviser.sieves.legacy_version.LegacyVersionSieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

A sieve to filter out legacy versions.

This sieve assumes no recent projects use legacy versions hence we can simply skip them in the resolution process.

CONFIGURATION_DEFAULT = {'package_name': None}
run(package_versions: Generator[thoth.python.package_version.PackageVersion, None, None]) → Generator[thoth.python.package_version.PackageVersion, None, None][source]

Cut-off legacy versions from the resolution process.

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

Include this sieve once, always.

thoth.adviser.sieves.locked module

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

class thoth.adviser.sieves.locked.CutLockedSieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[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.

CONFIGURATION_DEFAULT = {'package_name': None}
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) → Generator[Dict[str, Any], None, None][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(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

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

CONFIGURATION_DEFAULT = {'package_name': None}
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) → Generator[Dict[str, Any], None, None][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(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

Filter out build time/installation errors of Python packages.

CONFIGURATION_DEFAULT = {'package_name': None, 'without_error': True}
CONFIGURATION_SCHEMA = <Schema({'package_name': Any(<class 'str'>, None, msg=None), 'without_error': <class 'bool'>}, extra=PREVENT_EXTRA, required=False) object>
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) → Generator[Dict[str, Any], None, None][source]

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

thoth.adviser.sieves.thoth_s2i_abi_compat module

Filter out stacks which have require non-existent ABI symbols in Thoth’s s2i base image.

class thoth.adviser.sieves.thoth_s2i_abi_compat.ThothS2IAbiCompatibilitySieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

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

CONFIGURATION_DEFAULT = {'package_name': None}
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) → Generator[Dict[str, Any], None, None][source]

Register if the base image provided is Thoth’s s2i.

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(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[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}
CONFIGURATION_SCHEMA = <Schema({'package_name': <class 'str'>, 'version_specifier': <class 'str'>}, extra=PREVENT_EXTRA, required=False) object>
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) → Generator[Dict[str, Any], None, None][source]

Include this sieve only if user explicitly asks for it.

Module contents

Implementation of sieves used in adviser pipeline.

class thoth.adviser.sieves.LegacyVersionSieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

A sieve to filter out legacy versions.

This sieve assumes no recent projects use legacy versions hence we can simply skip them in the resolution process.

CONFIGURATION_DEFAULT = {'package_name': None}
run(package_versions: Generator[thoth.python.package_version.PackageVersion, None, None]) → Generator[thoth.python.package_version.PackageVersion, None, None][source]

Cut-off legacy versions from the resolution process.

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

Include this sieve once, always.

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

Bases: thoth.adviser.sieve.Sieve

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

CONFIGURATION_DEFAULT = {'package_name': None}
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) → Generator[Dict[str, Any], None, None][source]

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

class thoth.adviser.sieves.SelectiveCutPreReleasesSieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

Enable or disable specific pre-releases for the given set of packages..

CONFIGURATION_DEFAULT = {'allow_prereleases': None, 'package_name': None}
CONFIGURATION_SCHEMA = <Schema({'package_name': None, 'allow_prereleases': <Schema({<class 'str'>: <class 'bool'>}, extra=PREVENT_EXTRA, required=False) object>}, extra=PREVENT_EXTRA, required=False) object>
packages_seen
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]

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

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

Enable or disable specific pre-releases for the given set of packages..

class thoth.adviser.sieves.FilterConfiguredIndexSieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

A sieve to filter out packages coming from other indexes than the ones configured.

CONFIGURATION_DEFAULT = {'allowed_indexes': None, 'package_name': None}
CONFIGURATION_SCHEMA = <Schema({'package_name': None, 'allowed_indexes': {<class 'str'>}}, extra=PREVENT_EXTRA, required=False) object>
packages_seen
pre_run() → None[source]

Initialize this unit before each run.

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

Cut-off packages that are not coming from an allowed index.

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

Enable this pipeline unit if the adjustment is enabled.

to_dict() → Dict[str, Any][source]

Turn this pipeline step into its dictionary representation, override to have unit JSON serializable.

class thoth.adviser.sieves.PackageIndexConfigurationSieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

A sieve to filter out packages based on index configuration.

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>
packages_seen
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]

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

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

Register for each package.

class thoth.adviser.sieves.CutLockedSieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[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.

CONFIGURATION_DEFAULT = {'package_name': None}
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) → Generator[Dict[str, Any], None, None][source]

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

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

Bases: thoth.adviser.sieve.Sieve

Filter out disabled Python package indexes.

CONFIGURATION_DEFAULT = {'package_name': None}
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) → Generator[Dict[str, Any], None, None][source]

Remove indexes which are not enabled in pipeline configuration.

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

Bases: thoth.adviser.sieve.Sieve

Filter out build time/installation errors of Python packages.

CONFIGURATION_DEFAULT = {'package_name': None, 'without_error': True}
CONFIGURATION_SCHEMA = <Schema({'package_name': Any(<class 'str'>, None, msg=None), 'without_error': <class 'bool'>}, extra=PREVENT_EXTRA, required=False) object>
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) → Generator[Dict[str, Any], None, None][source]

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

class thoth.adviser.sieves.VersionConstraintSieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[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}
CONFIGURATION_SCHEMA = <Schema({'package_name': <class 'str'>, 'version_specifier': <class 'str'>}, extra=PREVENT_EXTRA, required=False) object>
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) → Generator[Dict[str, Any], None, None][source]

Include this sieve only if user explicitly asks for it.

class thoth.adviser.sieves.ThothS2IAbiCompatibilitySieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

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

CONFIGURATION_DEFAULT = {'package_name': None}
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) → Generator[Dict[str, Any], None, None][source]

Register if the base image provided is Thoth’s s2i.

class thoth.adviser.sieves.FilterIndexSieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[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) → Generator[Dict[str, Any], None, None][source]

Register self, never.

class thoth.adviser.sieves.TensorFlow240AVX2IllegalInstructionSieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

A sieve that filters out TensorFlow==2.4.0 build as it requires AVX2 instruction set.

See:
AVX2_CPUS = frozenset({(6, 5), (6, 6), (6, 10), (6, 12), (6, 13), (6, 14), (6, 15)})
CONFIGURATION_DEFAULT = {'package_name': 'tensorflow'}
run(package_versions: Generator[thoth.python.package_version.PackageVersion, None, None]) → Generator[thoth.python.package_version.PackageVersion, None, None][source]

Recommend not to use TensorFlow==2.4.0 on non-AVX2 enabled CPU processors.

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

Register this pipeline unit for adviser and stable/testing recommendation types.

class thoth.adviser.sieves.TensorFlowAPISieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[source]

Bases: thoth.adviser.sieve.Sieve

A sieve that makes sure the right TensorFlow release is used based on user’s API usage.

CONFIGURATION_DEFAULT = {'package_name': 'tensorflow'}
CONFIGURATION_SCHEMA = <Schema({'package_name': Any(<class 'str'>, msg=None)}, extra=PREVENT_EXTRA, required=False) object>
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 library usage as supplied by the user.

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

Register this pipeline unit for adviser library usage is provided.

class thoth.adviser.sieves.TensorFlowCUDASieve(*, unit_run: bool = False, configuration: Dict[str, Any] = NOTHING)[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

CONFIGURATION_DEFAULT = {'package_name': 'tensorflow'}
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) → Generator[Dict[str, Any], None, None][source]

Register this pipeline unit for adviser when CUDA is present.