thoth.storages.graph package¶
Submodules¶
thoth.storages.graph.enums module¶
Enum types used in thoth-storages code.
-
class
thoth.storages.graph.enums.
EnvironmentTypeEnum
[source]¶ Bases:
enum.Enum
Class for the environment types.
-
BUILDTIME
= 'BUILDTIME'¶
-
RUNTIME
= 'RUNTIME'¶
-
-
class
thoth.storages.graph.enums.
InspectionSyncStateEnum
[source]¶ Bases:
enum.Enum
Class for the inspection syncs state.
-
PENDING
= 'PENDING'¶
-
SYNCED
= 'SYNCED'¶
-
-
class
thoth.storages.graph.enums.
MetadataDistutilsTypeEnum
[source]¶ Bases:
enum.Enum
Class for the requirements format.
-
OBSOLETE
= 'OBSOLETE'¶
-
PROVIDED
= 'PROVIDED'¶
-
REQUIRED
= 'REQUIRED'¶
-
-
class
thoth.storages.graph.enums.
QuerySortTypeEnum
[source]¶ Bases:
enum.Enum
Class for the requirements format.
-
PACKAGE_NAME
= 'package_name'¶
-
PACKAGE_VERSION
= 'package_version'¶
-
-
class
thoth.storages.graph.enums.
RecommendationTypeEnum
[source]¶ Bases:
enum.Enum
Class for the reccomendation type.
-
LATEST
= 'LATEST'¶
-
PERFORMANCE
= 'PERFORMANCE'¶
-
SECURITY
= 'SECURITY'¶
-
STABLE
= 'STABLE'¶
-
TESTING
= 'TESTING'¶
-
-
class
thoth.storages.graph.enums.
RequirementsFormatEnum
[source]¶ Bases:
enum.Enum
Class for the requirements format.
-
PIPENV
= 'PIPENV'¶
-
thoth.storages.graph.models module¶
Models for SQL based database.
-
class
thoth.storages.graph.models.
Advised
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A relation stating advised software stack.
-
adviser_run
¶
-
adviser_run_id
¶
-
python_software_stack
¶
-
python_software_stack_id
¶
-
-
class
thoth.storages.graph.models.
AdviserRun
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A class representing a single adviser run.
-
additional_stack_info
¶
-
advised_configuration_changes
¶
-
advised_software_stacks
¶
-
adviser_document_id
¶
-
adviser_error
¶
-
adviser_name
¶
-
adviser_version
¶
-
count
¶
-
datetime
¶
-
debug
¶
-
duration
¶
-
external_build_software_environment
¶
-
external_build_software_environment_id
¶
-
external_hardware_information
¶
-
external_hardware_information_id
¶
-
external_run_software_environment
¶
-
external_run_software_environment_id
¶
-
id
¶
-
is_s2i
¶
-
limit
¶
-
limit_latest_versions
¶
-
need_re_run
¶
-
origin
¶
-
python_package_version_entities
¶
-
re_run_adviser_id
¶
-
recommendation_type
¶
-
requirements_format
¶
-
source_type
¶
-
user_software_stack
¶
-
user_software_stack_id
¶
-
-
class
thoth.storages.graph.models.
CVE
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Information about a CVE.
-
advisory
¶
-
aggregated_at
¶
-
cve_id
¶
-
cve_name
¶
-
id
¶
-
python_package_version_entities
¶
-
version_range
¶
-
-
class
thoth.storages.graph.models.
DebDependency
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A Debian dependency.
-
deb_package_versions_depends
¶
-
deb_package_versions_pre_depends
¶
-
deb_package_versions_replaces
¶
-
id
¶
-
package_name
¶
-
-
class
thoth.storages.graph.models.
DebDepends
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Depending relation of a deb package.
-
deb_dependency
¶
-
deb_dependency_id
¶
-
deb_package_version
¶
-
deb_package_version_id
¶
-
id
¶
-
version_range
¶
-
-
class
thoth.storages.graph.models.
DebPackageVersion
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Debian-specific package version.
-
arch
¶
-
depends
¶
-
epoch
¶
-
id
¶
-
package_extract_runs
¶
-
package_name
¶
-
package_version
¶
-
pre_depends
¶
-
replaces
¶
-
-
class
thoth.storages.graph.models.
DebPreDepends
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Pre-depending relation of a deb package.
-
deb_dependency
¶
-
deb_dependency_id
¶
-
deb_package_version
¶
-
deb_package_version_id
¶
-
version_range
¶
-
-
class
thoth.storages.graph.models.
DebReplaces
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A relation of a deb package capturing package replacement..
-
deb_dependency
¶
-
deb_dependency_id
¶
-
deb_package_version
¶
-
deb_package_version_id
¶
-
version_range
¶
-
-
class
thoth.storages.graph.models.
DependencyMonkeyRun
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A class representing a single dependency-monkey run.
-
build_hardware_information
¶
-
build_hardware_information_id
¶
-
build_software_environment
¶
-
build_software_environment_id
¶
-
count
¶
-
datetime
¶
-
debug
¶
-
decision
¶
-
dependency_monkey_document_id
¶
-
dependency_monkey_error
¶
-
dependency_monkey_name
¶
-
dependency_monkey_version
¶
-
duration
¶
-
id
¶
-
inspection_runs
¶
-
limit_latest_versions
¶
-
python_package_requirements
¶
-
run_hardware_information
¶
-
run_hardware_information_id
¶
-
run_software_environment
¶
-
run_software_environment_id
¶
-
seed
¶
-
-
class
thoth.storages.graph.models.
DependsOn
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Dependency of a Python package version.
-
entity
¶
-
entity_id
¶
-
extra
¶
-
marker
¶
-
marker_evaluation_result
¶
-
platform
¶
-
version
¶
-
version_id
¶
-
version_range
¶
-
-
class
thoth.storages.graph.models.
DetectedSymbol
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A relation stating a package extract run detected a symbol.
-
package_extract_run
¶
-
package_extract_run_id
¶
-
versioned_symbol
¶
-
versioned_symbol_id
¶
-
-
class
thoth.storages.graph.models.
EcosystemSolver
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Record for an ecosystem solver.
-
ecosystem
¶
-
id
¶
-
os_name
¶
-
os_version
¶
-
python_version
¶
-
solver_name
¶
-
solver_version
¶
-
versions
¶
-
-
class
thoth.storages.graph.models.
ExternalHardwareInformation
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
External Hardware information base class to derive for specific HW environments.
-
adviser_runs
¶
-
cpu_cores
¶
-
cpu_family
¶
-
cpu_model
¶
-
cpu_model_name
¶
-
cpu_physical_cpus
¶
-
cpu_vendor
¶
-
gpu_cores
¶
-
gpu_memory_size
¶
-
gpu_model_name
¶
-
gpu_vendor
¶
-
id
¶
-
ram_size
¶
-
-
class
thoth.storages.graph.models.
ExternalPythonRequirements
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Requirements for a user software stack.
-
external_python_requirements
¶
-
external_python_software_stack
¶
-
id
¶
-
requirements_hash
¶
-
-
class
thoth.storages.graph.models.
ExternalPythonRequirementsLock
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A pinned down requirements for a user application.
-
external_python_requirements_locks
¶
-
external_python_software_stack
¶
-
id
¶
-
requirements_lock_hash
¶
-
-
class
thoth.storages.graph.models.
ExternalPythonSoftwareStack
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A Python software stack definition from users.
-
adviser_runs
¶
-
external_python_package_requirements
¶
-
external_python_requirements_id
¶
-
external_python_requirements_lock
¶
-
external_python_requirements_lock_id
¶
-
id
¶
-
kebechet_github_installation
¶
-
provenance_checker_runs
¶
-
-
class
thoth.storages.graph.models.
ExternalSoftwareEnvironment
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A base class for environment types.
-
adviser_inputs_build
¶
-
adviser_inputs_run
¶
-
cuda_version
¶
-
environment_name
¶
-
environment_type
¶
-
external_package_extract_runs
¶
-
id
¶
-
image_name
¶
-
image_sha
¶
-
kebechet_github_installation
¶
-
os_name
¶
-
os_version
¶
-
python_version
¶
-
versioned_symbols
¶
-
-
class
thoth.storages.graph.models.
FoundDeb
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
State a package extract run found a Debian package.
-
deb_package_version
¶
-
deb_package_version_id
¶
-
package_extract_run
¶
-
package_extract_run_id
¶
-
-
class
thoth.storages.graph.models.
FoundPythonFile
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
State a package extract run found a Python file.
-
file
¶
-
package_extract_run
¶
-
package_extract_run_id
¶
-
python_file_digest
¶
-
python_file_digest_id
¶
-
-
class
thoth.storages.graph.models.
FoundPythonInterpreter
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
State a package extract run found a Python interpreter.
-
package_extract_run
¶
-
package_extract_run_id
¶
-
python_interpreter
¶
-
python_interpreter_id
¶
-
-
class
thoth.storages.graph.models.
FoundRPM
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
State a package extract run found an RPM package.
-
package_extract_run
¶
-
package_extract_run_id
¶
-
rpm_package_version
¶
-
rpm_package_version_id
¶
-
-
class
thoth.storages.graph.models.
HardwareInformation
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Hardware information base class to derive for specific HW environments.
-
cpu_cores
¶
-
cpu_family
¶
-
cpu_model
¶
-
cpu_model_name
¶
-
cpu_physical_cpus
¶
-
cpu_vendor
¶
-
dependency_monkey_runs_build
¶
-
dependency_monkey_runs_run
¶
-
gpu_cores
¶
-
gpu_memory_size
¶
-
gpu_model_name
¶
-
gpu_vendor
¶
-
id
¶
-
inspection_runs_build
¶
-
inspection_runs_run
¶
-
ram_size
¶
-
-
class
thoth.storages.graph.models.
HasArtifact
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
The given package has the given artifact.
-
python_artifact
¶
-
python_artifact_id
¶
-
python_package_version_entity
¶
-
python_package_version_entity_id
¶
-
-
class
thoth.storages.graph.models.
HasExternalPythonRequirements
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
The requirement from user Pipfile.
-
external_python_package_requirement
¶
-
external_python_requirements_id
¶
-
external_requirements
¶
-
python_package_requirement_id
¶
-
-
class
thoth.storages.graph.models.
HasExternalPythonRequirementsLock
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
The requirement from Pipfile.lock.
-
external_python_requirements_lock
¶
-
external_python_requirements_locked_id
¶
-
python_package_version_entity
¶
-
python_package_version_entity_id
¶
-
-
class
thoth.storages.graph.models.
HasMetadataClassifier
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
The Python package has the given classifier in the metadata.
-
python_package_metadata
¶
-
python_package_metadata_classifier_id
¶
-
python_package_metadata_classifiers
¶
-
python_package_metadata_id
¶
-
-
class
thoth.storages.graph.models.
HasMetadataDistutils
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
The Python package has the given distutils in the metadata.
-
python_package_metadata
¶
-
python_package_metadata_distutils
¶
-
python_package_metadata_distutils_id
¶
-
python_package_metadata_id
¶
-
-
class
thoth.storages.graph.models.
HasMetadataPlatform
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
The Python package has the given platform in the metadata.
-
python_package_metadata
¶
-
python_package_metadata_id
¶
-
python_package_metadata_platform_id
¶
-
python_package_metadata_platforms
¶
-
-
class
thoth.storages.graph.models.
HasMetadataProjectUrl
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
The Python package has the given project URL in the metadata.
-
python_package_metadata
¶
-
python_package_metadata_id
¶
-
python_package_metadata_project_url_id
¶
-
python_package_metadata_project_urls
¶
-
-
class
thoth.storages.graph.models.
HasMetadataProvidesExtra
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
The Python package has the given optional feature in the metadata.
-
python_package_metadata
¶
-
python_package_metadata_id
¶
-
python_package_metadata_provides_extra_id
¶
-
python_package_metadata_provides_extras
¶
-
-
class
thoth.storages.graph.models.
HasMetadataRequiresExternal
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
The Python package has the given dependency in the metadata.
-
python_package_metadata
¶
-
python_package_metadata_id
¶
-
python_package_metadata_requires_external_id
¶
-
python_package_metadata_requires_externals
¶
-
-
class
thoth.storages.graph.models.
HasMetadataSupportedPlatform
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
The Python package has the given supported platform in the metadata.
-
python_package_metadata
¶
-
python_package_metadata_id
¶
-
python_package_metadata_supported_platform_id
¶
-
python_package_metadata_supported_platforms
¶
-
-
class
thoth.storages.graph.models.
HasPythonRequirements
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
The requirement from Pipfile.
-
python_package_requirement
¶
-
python_package_requirement_id
¶
-
python_requirements
¶
-
python_requirements_id
¶
-
-
class
thoth.storages.graph.models.
HasPythonRequirementsLock
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
The requirement from Pipfile.lock.
-
python_package_version
¶
-
python_package_version_id
¶
-
python_requirements_lock
¶
-
python_requirements_lock_id
¶
-
-
class
thoth.storages.graph.models.
HasSymbol
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A relation stating a software environment has a symbol.
-
external_software_environment
¶
-
external_software_environment_id
¶
-
software_environment
¶
-
software_environment_id
¶
-
versioned_symbol
¶
-
versioned_symbol_id
¶
-
-
class
thoth.storages.graph.models.
HasUnresolved
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A relation representing a Python package version entity unresolved identified in adviser run.
-
adviser_run
¶
-
adviser_run_id
¶
-
python_package_version_entity
¶
-
python_package_version_entity_id
¶
-
-
class
thoth.storages.graph.models.
HasVulnerability
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
The given package version has a vulnerability.
-
cve
¶
-
cve_id
¶
-
python_package_version_entity
¶
-
python_package_version_entity_id
¶
-
-
class
thoth.storages.graph.models.
Identified
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A relation representing a Python package version identified by a package-extract run.
-
package_extract_run
¶
-
package_extract_run_id
¶
-
python_package_version_entity
¶
-
python_package_version_entity_id
¶
-
-
class
thoth.storages.graph.models.
IncludedFile
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A relation representing file found in the given artifact.
-
file
¶
-
python_artifact
¶
-
python_artifact_id
¶
-
python_file_digest
¶
-
python_file_digest_id
¶
-
-
class
thoth.storages.graph.models.
InspectionRun
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A class representing a single inspection.
-
amun_version
¶
-
build_hardware_information
¶
-
build_hardware_information_id
¶
-
build_requests_cpu
¶
-
build_requests_memory
¶
-
build_software_environment
¶
-
build_software_environment_id
¶
-
conv1d_perf_indicators
¶
-
conv2d_perf_indicators
¶
-
datetime
¶
-
dependency_monkey_run
¶
-
dependency_monkey_run_id
¶
-
id
¶
-
inspection_document_id
¶
-
inspection_result_number
¶
-
inspection_software_stack
¶
-
inspection_software_stack_id
¶
-
inspection_sync_state
¶
-
matmul_perf_indicators
¶
-
pybench_perf_indicators
¶
-
run_hardware_information
¶
-
run_hardware_information_id
¶
-
run_requests_cpu
¶
-
run_requests_memory
¶
-
run_software_environment
¶
-
run_software_environment_id
¶
-
-
class
thoth.storages.graph.models.
KebechetGithubAppInstallations
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Kebechet Github App Installations.
slug = namespace/repository (ex - thoth-station/advisor) repo_name = repository (ex - advisor) private = True or False installation_id = provided by github (ex - 236821515)
-
advised_python_software_stack_id
¶
-
advised_software_stack
¶
-
external_python_software_stack_id
¶
-
external_software_environment
¶
-
external_software_environment_id
¶
-
id
¶
-
info_manager
¶
-
installation_id
¶
-
is_active
¶
-
last_run
¶
-
pipfile_requirements_manager
¶
-
private
¶
-
repo_name
¶
-
slug
¶
-
thoth_advise_manager
¶
-
thoth_provenance_manager
¶
-
update_manager
¶
-
user_software_stack
¶
-
version_manager
¶
-
-
class
thoth.storages.graph.models.
PackageExtractRun
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A class representing a single package-extract (image analysis) run.
-
analysis_document_id
¶
-
datetime
¶
-
debug
¶
-
duration
¶
-
environment_type
¶
-
external_software_environment
¶
-
external_software_environment_id
¶
-
found_debs
¶
-
found_python_files
¶
-
found_python_interpreters
¶
-
found_rpms
¶
-
id
¶
-
image_size
¶
-
image_tag
¶
-
origin
¶
-
os_id
¶
-
os_name
¶
-
os_version_id
¶
-
package_extract_error
¶
-
package_extract_name
¶
-
package_extract_version
¶
-
python_package_version_entities
¶
-
software_environment
¶
-
software_environment_id
¶
-
versioned_symbols
¶
-
-
class
thoth.storages.graph.models.
ProvenanceCheckerRun
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A class representing a single provenance-checker run.
-
datetime
¶
-
debug
¶
-
duration
¶
-
id
¶
-
origin
¶
-
provenance_checker_document_id
¶
-
provenance_checker_error
¶
-
provenance_checker_name
¶
-
provenance_checker_version
¶
-
user_software_stack
¶
-
user_software_stack_id
¶
-
-
class
thoth.storages.graph.models.
PythonArtifact
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
An artifact for a python package in a specific version.
-
artifact_hash_sha256
¶
-
artifact_name
¶
-
id
¶
-
present
¶
-
python_files
¶
-
python_package_version_entities
¶
-
versioned_symbols
¶
-
-
class
thoth.storages.graph.models.
PythonDependencyMonkeyRequirements
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Requirements for a software stack as run on Dependency Monkey.
-
dependency_monkey_run
¶
-
dependency_monkey_run_id
¶
-
id
¶
-
python_package_requirement
¶
-
python_package_requirement_id
¶
-
-
class
thoth.storages.graph.models.
PythonFileDigest
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A class representing a single file digests.
-
id
¶
-
package_extract_runs
¶
-
python_artifacts
¶
-
sha256
¶
-
-
class
thoth.storages.graph.models.
PythonInterpreter
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A class representing a single python interpreter.
-
id
¶
-
link
¶
-
package_extract_runs
¶
-
path
¶
-
version
¶
-
-
class
thoth.storages.graph.models.
PythonPackageIndex
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Representation of a Python package Index.
-
enabled
¶
-
id
¶
-
python_package_requirements
¶
-
python_package_version_entities
¶
-
python_package_versions
¶
-
url
¶
-
verify_ssl
¶
-
warehouse_api_url
¶
-
-
class
thoth.storages.graph.models.
PythonPackageMetadata
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Metadata extracted for a Python Package.
Source: https://packaging.python.org/specifications/core-metadata/
-
classifiers
¶
-
description
¶
-
description_content_type
¶
-
distutils
¶
-
download_url
¶
-
home_page
¶
-
id
¶
-
keywords
¶
-
license
¶
-
maintainer
¶
-
maintainer_email
¶
-
metadata_version
¶
-
name
¶
-
platforms
¶
-
project_urls
¶
-
provides_extras
¶
-
python_package_versions
¶
-
requires_externals
¶
-
requires_python
¶
-
summary
¶
-
supported_platforms
¶
-
version
¶
-
-
class
thoth.storages.graph.models.
PythonPackageMetadataClassifier
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Classification value (part of metadata) for the Python Package.
-
classifier
¶
-
id
¶
-
python_packages_metadata
¶
-
-
class
thoth.storages.graph.models.
PythonPackageMetadataDistutils
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Distutils (part of metadata).
REQUIRED: it means that the distribution (Python package) requires it.
PROVIDED: it means that the distribution (Python package) has it.
OBSOLETE: it means that the distribution (Python package) renders obsolete. This means that the two projects should not be installed at the same time.
-
distutils
¶
-
distutils_type
¶
-
id
¶
-
python_packages_metadata
¶
-
-
class
thoth.storages.graph.models.
PythonPackageMetadataPlatform
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Platform (part of metadata) describing an operating system supported by the Python Package.
-
id
¶
-
platform
¶
-
python_packages_metadata
¶
-
-
class
thoth.storages.graph.models.
PythonPackageMetadataProjectUrl
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Browsable URL (part of metadata) for the project of the Python Package and a label for it.
-
id
¶
-
project_url
¶
-
python_packages_metadata
¶
-
-
class
thoth.storages.graph.models.
PythonPackageMetadataProvidesExtra
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Optional feature (part of metadata) for the Python Package.
May be used to make a dependency conditional on whether the optional feature has been requested.
-
id
¶
-
optional_feature
¶
-
python_packages_metadata
¶
-
-
class
thoth.storages.graph.models.
PythonPackageMetadataRequiresExternal
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Dependency field (part of metadata) in the system that the distribution (Python package) is to be used.
This field is intended to serve as a hint to downstream project maintainers, and has no semantics which are meaningful to the distutils distribution.
-
dependency
¶
-
id
¶
-
python_packages_metadata
¶
-
-
class
thoth.storages.graph.models.
PythonPackageMetadataSupportedPlatform
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Supported-Platform field (part of metadata) used in binary distributions containing a PKG-INFO file.
It is used to specify the OS and CPU for which the binary distribution was compiled.
-
id
¶
-
python_packages_metadata
¶
-
supported_platform
¶
-
-
class
thoth.storages.graph.models.
PythonPackageRequirement
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A requirement as stated by a software stack.
-
dependency_monkey_runs
¶
-
develop
¶
-
external_python_requirement
¶
-
id
¶
-
index
¶
-
name
¶
-
python_package_index_id
¶
-
python_requirement
¶
-
version_range
¶
-
-
class
thoth.storages.graph.models.
PythonPackageVersion
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Representation of a Python package version running on a specific software environment.
-
dependencies
¶
-
entity
¶
-
entity_id
¶
-
id
¶
-
index
¶
-
is_missing
¶
-
os_name
¶
-
os_version
¶
-
package_name
¶
-
package_version
¶
-
provides_source_distro
¶
-
python_package_index_id
¶
-
python_package_metadata
¶
-
python_package_metadata_id
¶
-
python_software_stacks
¶
-
python_version
¶
-
si_aggregated
¶
-
solvers
¶
-
-
class
thoth.storages.graph.models.
PythonPackageVersionEntity
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Representation of a Python package not running in any environment.
-
adviser_runs
¶
-
cves
¶
-
external_python_software_stacks
¶
-
id
¶
-
index
¶
-
package_extract_runs
¶
-
package_name
¶
-
package_version
¶
-
python_artifacts
¶
-
python_package_index_id
¶
-
python_package_versions
¶
-
si_aggregated_runs
¶
-
versions
¶
-
-
class
thoth.storages.graph.models.
PythonRequirements
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Requirements for a software stack.
-
id
¶
-
python_software_stack
¶
-
requirements
¶
-
requirements_hash
¶
-
-
class
thoth.storages.graph.models.
PythonRequirementsLock
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A pinned down requirements for an application.
-
id
¶
-
python_requirements_lock
¶
-
python_software_stack
¶
-
requirements_lock_hash
¶
-
-
class
thoth.storages.graph.models.
PythonSoftwareStack
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A Python software stack definition.
-
advised_by
¶
-
id
¶
-
inspection_runs
¶
-
kebechet_github_installation
¶
-
overall_score
¶
-
performance_score
¶
-
python_package_requirements
¶
-
python_package_requirements_locked
¶
-
python_requirements_id
¶
-
python_requirements_lock_id
¶
-
software_stack_type
¶
-
-
class
thoth.storages.graph.models.
RPMPackageVersion
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
RPM-specific package version.
-
arch
¶
-
epoch
¶
-
id
¶
-
package_extract_runs
¶
-
package_identifier
¶
-
package_name
¶
-
package_version
¶
-
release
¶
-
rpm_requirements
¶
-
src
¶
-
-
class
thoth.storages.graph.models.
RPMRequirement
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
Requirement of an RPM as stated in a spec file.
-
id
¶
-
rpm_package_versions
¶
-
rpm_requirement_name
¶
-
-
class
thoth.storages.graph.models.
RPMRequires
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
RPM requirement mapping.
-
rpm_package_version
¶
-
rpm_package_version_id
¶
-
rpm_requirement
¶
-
rpm_requirement_id
¶
-
-
class
thoth.storages.graph.models.
RequiresSymbol
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A relation stating a software environment requires a symbol.
-
python_artifact
¶
-
python_artifact_id
¶
-
versioned_symbol
¶
-
versioned_symbol_id
¶
-
-
class
thoth.storages.graph.models.
SIAggregated
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A relation representing a Python package version entity analyzed by a si_aggregated_run.
-
python_package_version
¶
-
python_package_version_entity
¶
-
python_package_version_entity_id
¶
-
python_package_version_id
¶
-
si_aggregated_run
¶
-
si_aggregated_run_id
¶
-
-
class
thoth.storages.graph.models.
SecurityIndicatorAggregatedRun
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
SecurityIndicatorAggregatedRun.
-
datetime
¶
-
error
¶
-
id
¶
-
number_of_analyzed_files
¶
-
number_of_blank_lines_in_python_files
¶
-
number_of_files_total
¶
-
number_of_files_with_severities
¶
-
number_of_filtered_files
¶
-
number_of_lines_with_code_in_python_files
¶
-
number_of_lines_with_comments_in_python_files
¶
-
number_of_python_files
¶
-
python_package_version_entities
¶
-
severity_high_confidence_high
¶
-
severity_high_confidence_low
¶
-
severity_high_confidence_medium
¶
-
severity_high_confidence_undefined
¶
-
severity_low_confidence_high
¶
-
severity_low_confidence_low
¶
-
severity_low_confidence_medium
¶
-
severity_low_confidence_undefined
¶
-
severity_medium_confidence_high
¶
-
severity_medium_confidence_low
¶
-
severity_medium_confidence_medium
¶
-
severity_medium_confidence_undefined
¶
-
si_aggregated_run_document_id
¶
-
total_number_of_blank_lines
¶
-
total_number_of_files
¶
-
total_number_of_lines
¶
-
total_number_of_lines_with_code
¶
-
total_number_of_lines_with_comments
¶
-
-
class
thoth.storages.graph.models.
SoftwareEnvironment
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A base class for environment types.
-
cuda_version
¶
-
dependency_monkey_runs_build
¶
-
dependency_monkey_runs_run
¶
-
environment_name
¶
-
environment_type
¶
-
id
¶
-
image_name
¶
-
image_sha
¶
-
inspection_runs_build
¶
-
inspection_runs_run
¶
-
os_name
¶
-
os_version
¶
-
package_extract_runs
¶
-
python_version
¶
-
versioned_symbols
¶
-
-
class
thoth.storages.graph.models.
Solved
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
A solver solved a package-version.
-
datetime
¶
-
document_id
¶
-
duration
¶
-
ecosystem_solver
¶
-
ecosystem_solver_id
¶
-
error
¶
-
error_unparseable
¶
-
error_unsolvable
¶
-
is_provided
¶
-
version
¶
-
version_id
¶
-
thoth.storages.graph.models_base module¶
A base and utilities for implementing SQLAlchemy based models.
thoth.storages.graph.models_performance module¶
Performance indicators (models) used in Thoth with their schemas.
-
class
thoth.storages.graph.models_performance.
PerformanceIndicatorBase
[source]¶ Bases:
object
A base class for implementing performance indicators.
-
component
= Column(None, String(length=256), table=None, nullable=False)¶
-
classmethod
create_from_report
(session: sqlalchemy.orm.session.Session, inspection_specification: Dict[str, Any], inspection_result: Dict[str, Any], inspection_run_id: int) → thoth.storages.graph.models_performance.PerformanceIndicatorBase[source]¶ Create performance indicator record together with related observed performance edge based on inspection.
-
exit_code
= Column(None, Integer(), table=None, nullable=False)¶
-
classmethod
from_report
(inspection_result: Dict[str, Any], partial_model: type) → thoth.storages.graph.models_performance.PerformanceIndicatorBase[source]¶ Create model from the inspection report respecting parameters and result reported by the indicator.
-
origin
= Column(None, String(length=256), table=None, nullable=False)¶
-
overall_score
= Column(None, Float(), table=None)¶
-
ru_idrss
= Column(None, Integer(), table=None, nullable=False)¶
-
ru_inblock
= Column(None, Integer(), table=None, nullable=False)¶
-
ru_isrss
= Column(None, Integer(), table=None, nullable=False)¶
-
ru_ixrss
= Column(None, Integer(), table=None, nullable=False)¶
-
ru_majflt
= Column(None, Integer(), table=None, nullable=False)¶
-
ru_maxrss
= Column(None, Integer(), table=None, nullable=False)¶
-
ru_minflt
= Column(None, Integer(), table=None, nullable=False)¶
-
ru_msgrcv
= Column(None, Integer(), table=None, nullable=False)¶
-
ru_msgsnd
= Column(None, Integer(), table=None, nullable=False)¶
-
ru_nivcsw
= Column(None, Integer(), table=None, nullable=False)¶
-
ru_nsignals
= Column(None, Integer(), table=None, nullable=False)¶
-
ru_nswap
= Column(None, Integer(), table=None, nullable=False)¶
-
ru_nvcsw
= Column(None, Integer(), table=None, nullable=False)¶
-
ru_oublock
= Column(None, Integer(), table=None, nullable=False)¶
-
ru_stime
= Column(None, Float(), table=None, nullable=False)¶
-
ru_utime
= Column(None, Float(), table=None, nullable=False)¶
-
version
= Column(None, String(length=256), table=None, nullable=False)¶
-
-
class
thoth.storages.graph.models_performance.
PiConv1D
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
,thoth.storages.graph.models_performance.PerformanceIndicatorBase
A class for representing a conv1D micro-performance test.
-
batch
¶
-
component
¶
-
data_format
¶
-
device
¶
-
dtype
¶
-
elapsed
¶
-
exit_code
¶
-
filter_width
¶
-
id
¶
-
input_channels
¶
-
input_width
¶
-
inspection_run
¶
-
inspection_run_id
¶
-
origin
¶
-
output_channels
¶
-
overall_score
¶
-
padding
¶
-
rate
¶
-
reps
¶
-
ru_idrss
¶
-
ru_inblock
¶
-
ru_isrss
¶
-
ru_ixrss
¶
-
ru_majflt
¶
-
ru_maxrss
¶
-
ru_minflt
¶
-
ru_msgrcv
¶
-
ru_msgsnd
¶
-
ru_nivcsw
¶
-
ru_nsignals
¶
-
ru_nswap
¶
-
ru_nvcsw
¶
-
ru_oublock
¶
-
ru_stime
¶
-
ru_utime
¶
-
strides
¶
-
version
¶
-
-
class
thoth.storages.graph.models_performance.
PiConv2D
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
,thoth.storages.graph.models_performance.PerformanceIndicatorBase
A class for representing a conv2D micro-performance test.
-
batch
¶
-
component
¶
-
data_format
¶
-
device
¶
-
dtype
¶
-
elapsed
¶
-
exit_code
¶
-
filter_height
¶
-
filter_width
¶
-
id
¶
-
input_channels
¶
-
input_height
¶
-
input_width
¶
-
inspection_run
¶
-
inspection_run_id
¶
-
origin
¶
-
output_channels
¶
-
overall_score
¶
-
padding
¶
-
rate
¶
-
reps
¶
-
ru_idrss
¶
-
ru_inblock
¶
-
ru_isrss
¶
-
ru_ixrss
¶
-
ru_majflt
¶
-
ru_maxrss
¶
-
ru_minflt
¶
-
ru_msgrcv
¶
-
ru_msgsnd
¶
-
ru_nivcsw
¶
-
ru_nsignals
¶
-
ru_nswap
¶
-
ru_nvcsw
¶
-
ru_oublock
¶
-
ru_stime
¶
-
ru_utime
¶
-
strides
¶
-
version
¶
-
-
class
thoth.storages.graph.models_performance.
PiMatmul
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
,thoth.storages.graph.models_performance.PerformanceIndicatorBase
A class for representing a matrix multiplication micro-performance test.
-
component
¶
-
device
¶
-
dtype
¶
-
elapsed
¶
-
exit_code
¶
-
id
¶
-
inspection_run
¶
-
inspection_run_id
¶
-
matrix_size
¶
-
origin
¶
-
overall_score
¶
-
rate
¶
-
reps
¶
-
ru_idrss
¶
-
ru_inblock
¶
-
ru_isrss
¶
-
ru_ixrss
¶
-
ru_majflt
¶
-
ru_maxrss
¶
-
ru_minflt
¶
-
ru_msgrcv
¶
-
ru_msgsnd
¶
-
ru_nivcsw
¶
-
ru_nsignals
¶
-
ru_nswap
¶
-
ru_nvcsw
¶
-
ru_oublock
¶
-
ru_stime
¶
-
ru_utime
¶
-
version
¶
-
-
class
thoth.storages.graph.models_performance.
PiPyBench
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,thoth.storages.graph.models_base.BaseExtension
,thoth.storages.graph.models_performance.PerformanceIndicatorBase
A class for representing Pybench results for Python Interpreter.
-
built_in_function_calls_average
¶
-
built_in_method_lookup_average
¶
-
compare_floats_average
¶
-
compare_floats_integers_average
¶
-
compare_integers_average
¶
-
compare_interned_strings_average
¶
-
compare_longs_average
¶
-
compare_strings_average
¶
-
compare_unicode_average
¶
-
component
¶
-
concat_strings_average
¶
-
concat_unicode_average
¶
-
create_instances_average
¶
-
create_new_instances_average
¶
-
create_strings_with_concat_average
¶
-
create_unicode_with_concat_average
¶
-
dict_creation_average
¶
-
dict_with_float_keys_average
¶
-
dict_with_integer_keys_average
¶
-
dict_with_string_keys_average
¶
-
exit_code
¶
-
for_loops_average
¶
-
id
¶
-
if_then_else_average
¶
-
inspection_run
¶
-
inspection_run_id
¶
-
list_slicing_average
¶
-
nested_for_loops_average
¶
-
normal_class_attribute_average
¶
-
normal_instance_attribute_average
¶
-
origin
¶
-
overall_score
¶
-
python_function_calls_average
¶
-
python_method_calls_average
¶
-
recursion_average
¶
-
rounds
¶
-
ru_idrss
¶
-
ru_inblock
¶
-
ru_isrss
¶
-
ru_ixrss
¶
-
ru_majflt
¶
-
ru_maxrss
¶
-
ru_minflt
¶
-
ru_msgrcv
¶
-
ru_msgsnd
¶
-
ru_nivcsw
¶
-
ru_nsignals
¶
-
ru_nswap
¶
-
ru_nvcsw
¶
-
ru_oublock
¶
-
ru_stime
¶
-
ru_utime
¶
-
second_import_average
¶
-
second_package_import_average
¶
-
second_submodule_import_average
¶
-
simple_complex_arithmetic_average
¶
-
simple_dict_manipulation_average
¶
-
simple_float_arithmetic_average
¶
-
simple_int_float_arithmetic_average
¶
-
simple_integer_arithmetic_average
¶
-
simple_list_manipulation_average
¶
-
simple_long_arithmetic_average
¶
-
small_lists_average
¶
-
small_tuples_average
¶
-
special_class_attribute_average
¶
-
special_instance_attribute_average
¶
-
string_mappings_average
¶
-
string_predicates_average
¶
-
string_slicing_average
¶
-
totals_average
¶
-
try_except_average
¶
-
try_raise_except_average
¶
-
tuple_slicing_average
¶
-
unicode_mappings_average
¶
-
unicode_predicates_average
¶
-
unicode_properties_average
¶
-
unicode_slicing_average
¶
-
version
¶
-
thoth.storages.graph.postgres module¶
An SQL database for storing Thoth data.
-
class
thoth.storages.graph.postgres.
GraphDatabase
(engine: sqlalchemy.engine.base.Engine = None, sessionmaker=None)[source]¶ Bases:
thoth.storages.graph.sql_base.SQLBase
A SQL database adapter providing graph-like operations on top of SQL queries.
-
DEFAULT_COUNT
= 100¶
-
adviser_document_id_exist
(adviser_document_id: str) → bool[source]¶ Check if there is a adviser document record with the given id.
-
analysis_document_id_exist
(analysis_document_id: str) → bool[source]¶ Check if there is an analysis document record with the given id.
-
analysis_records_exist
(analysis_document: dict) → bool[source]¶ Check whether the given analysis document records exist in the graph database.
-
static
construct_connection_string
() → str[source]¶ Construct a connection string needed to connect to database.
-
create_github_app_installation
(slug: str, repo_name: str, private: bool, installation_id: str) → bool[source]¶ Create a record for new installation or reactivate uninstalled installation.
- Example -
“installation_id”: “236796147”, “repo_name”: “advisor”, “slug”: “thoth-station/advisor”, “private”: False
Accepts installation details passed down by Github. :rtype: True, False :returns True: if installation existed and was updated :returns False: if installation was newly added.
-
create_python_cve_record
(package_name: str, package_version: str, index_url: str, *, record_id: str, version_range: str, advisory: str, cve: Optional[str] = None) → bool[source]¶ Store information about a CVE in the graph database for the given Python package.
-
create_python_package_version_entity
(package_name: str, package_version: Optional[str] = None, index_url: Optional[str] = None, *, only_if_package_seen: bool = False) → Optional[Tuple[thoth.storages.graph.models.PythonPackageVersionEntity, bool]][source]¶ Create a Python package version entity record in the system.
By creating this entity, the system will record and track the given package.
-
dependency_monkey_document_id_exists
(dependency_monkey_document_id: str) → bool[source]¶ Check if the given dependency monkey report record exists in the graph database.
-
get_active_kebechet_github_installations_repos
() → List[str][source]¶ Get all active repositories names with active Kebechet installation.
Examples:
>>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_active_kebechet_github_installations_repos() ['repository_foo_fullname', 'repository_bar_fullname', ...]
-
get_active_kebechet_github_installations_repos_count_all
() → int[source]¶ Return the count of active repos with Kebechet installation.
Example: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.connect() >>> graph.get_active_kebechet_github_installations_repos_count_all() 165
-
get_adviser_run_count_per_source_type
() → Dict[str, int][source]¶ Retrieve number of Adviser run per source type in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_adviser_run_count_per_source_type() {‘GITHUB_APP’: 154, ‘CLI’: 71}
-
get_adviser_run_document_ids_all
(initial_date: Optional[str] = None, final_date: Optional[str] = None, source_type: Optional[str] = None, start_offset: int = 0, count: Optional[int] = 100) → List[str][source]¶ Retrieve adviser run document ids.
@params initial_date: DD-MM-YY @params final_date: DD-MM-YY
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_adviser_run_document_ids_all() [‘adviser-343231d’]
-
get_adviser_run_origins_all
(package_name: Optional[str] = None, package_version: Optional[str] = None, index_url: Optional[str] = None, start_offset: int = 0, count: Optional[int] = 100, distinct: bool = False) → List[str][source]¶ Retrieve all origins (git repos URLs) in Adviser Run.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_adviser_run_origins_all() [‘https://github.com/thoth-station/storages’,
-
get_analysis_metadata
(analysis_document_id: str) → Dict[str, Any][source]¶ Get metadata stored for the given analysis document.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_analysis_metadata() {
‘analysis_datetime’: datetime.datetime(2019, 10, 7, 18, 57, 22, 658131), ‘analysis_document_id’: ‘package-extract-2ef02c9cea8b1ef7’, ‘package_extract_name’: ‘thoth-package-extract’, ‘package_extract_version’: ‘1.0.1’ }
-
get_analyzed_image_symbols_all
(os_name: str, os_version: str, *, python_version: Optional[str] = None, cuda_version: Optional[str] = None) → List[str][source]¶ Get symbols associated with a given image.
-
get_analyzer_documents_count_all
() → int[source]¶ Get number of image analysis documents synced into graph.
-
get_build_software_environment_all
(start_offset: int = 0, count: Optional[int] = 100) → List[str][source]¶ Get all software environments available for build.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_run_software_environment_all() [‘quay.io/thoth-station/thoth-pylint:v0.7.0-ubi8’]
-
get_build_software_environment_analyses_all
(build_software_environment_name: str, start_offset: int = 0, count: Optional[int] = 100, convert_datetime: bool = True, is_external: bool = False) → List[dict][source]¶ Get listing of analyses available for the given software environment for build.
-
get_depends_on
(package_name: str, package_version: Optional[str] = None, index_url: Optional[str] = None, *, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, extras: FrozenSet[Optional[str]] = None, marker_evaluation_result: Optional[bool] = None, platform: Optional[str] = None, is_missing: Optional[bool] = None) → Dict[str, List[Tuple[str, str]]][source]¶ Get dependencies for the given Python package respecting environment and extras.
If no environment is provided, dependencies are returned for all environments as stored in the database.
Extras (as described in PEP-0508) are respected. If no extras is provided (extras=None), all dependencies are returned with all extras specified. A special value of None in extras listing no extra:
extras=frozenset((None,)) - return only dependencies which do not have any extra assigned
extras=frozenset((None, “postgresql”)) - dependencies without extra and with extra “postgresql”
extras=None - return all dependencies (regardless extra)
Environment markers are not taken into account in this query.
-
get_entity_count
(entity: Union[sqlalchemy.ext.declarative.api.Base, thoth.storages.graph.models_base.BaseExtension]) → int[source]¶ Get count of a specific entity in the database.
-
get_error_solved_document_id_all
(package_name: Optional[str] = None, package_version: Optional[str] = None, index_url: Optional[str] = None, *, unsolvable: bool = False, unparseable: bool = False, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False, limit_results: bool = True) → List[str][source]¶ Retrieve solver document id with error Python package versions in Thoth Database.
if unsolvable=True -> get_unsolvable_python_package_versions if unparseable=True -> get_unparseable_python_package_versions
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_error_solved_document_id_all() [‘solver-fedora-32-py37-324232’]
-
get_error_solved_python_package_versions_all
(package_name: Optional[str] = None, package_version: Optional[str] = None, index_url: Optional[str] = None, *, unsolvable: bool = False, unparseable: bool = False, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → List[Tuple[str, str, str]][source]¶ Retrieve solved with error Python package versions in Thoth Database.
if unsolvable=True -> get_unsolvable_python_package_versions if unparseable=True -> get_unparseable_python_package_versions
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_error_solved_python_package_versions_all() [(‘regex’, ‘2018.11.7’, ‘https://pypi.org/simple’), (‘tensorflow’, ‘1.11.0’, ‘https://pypi.org/simple’)]
-
get_error_solved_python_package_versions_count_all
(package_name: Optional[str] = None, package_version: Optional[str] = None, index_url: Optional[str] = None, *, unsolvable: bool = False, unparseable: bool = False, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → int[source]¶ Retrieve solved with error Python package versions number in Thoth Database.
if unsolvable=True -> get_unsolvable_python_package_versions_count_all if unparseable=True -> get_unparseable_python_package_versions_count_all
-
get_hardware_environments_all
(is_external: bool = False, *, start_offset: int = 0, count: Optional[int] = 100) → List[Dict][source]¶ Get hardware environments (external or internal) registered in the graph database.
-
get_kebechet_github_installations_active_managers
(slug: str) → list[source]¶ Return the list of active managers for a particular repository. Passed a slug name to be deactivated. Example - slug:’thoth-station/advisor’ :rtype: List :returns List of manager currently activated for the repo.
-
get_kebechet_github_installations_info_for_python_package_version
(package_name: str, *, package_version: Optional[str] = None, index_url: Optional[str] = None, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None) → Dict[str, Dict[str, Any]][source]¶ Return info about repo containing Python Package in the software stack.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_kebechet_github_installations_info_for_python_package_version(
package_name=’click’ index_url=”https://pypi.org/simple”,
)
- {
- ‘thoth-station/jupyter-nbrequirements’:
- {
‘installation_id’: ‘193650988’, ‘private’: False, ‘package_name’: ‘click’, ‘package_version’: ‘7.1.2’, ‘index_url’: ‘https://pypi.org/simple’}
}
-
get_main_table_count
() → Dict[str, int][source]¶ Retrieve dictionary mapping main tables to records count.
-
get_origin_count_per_source_type
(distinct: bool = False) → Dict[str, Dict[Tuple[str, str], int]][source]¶ Retrieve number of users of adviser per source type.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_origin_count_per_source_type() {‘GITHUB_APP’: 1570, ‘KEBECHET’: 48, ‘JUPYTER_NOTEBOOK’: 18, ‘CLI’: 513} >>> graph.get_origin_count_per_source_type(distinct=True) {‘GITHUB_APP’: 145, ‘KEBECHET’: 5, ‘JUPYTER_NOTEBOOK’: 2, ‘CLI’: 78}
-
get_performance_table_count
() → Dict[str, int][source]¶ Get dictionary mapping performance tables to records count.
-
get_pi_count
(component: str) → Dict[str, int][source]¶ Get dictionary with number of Performance Indicators per type for the PI component selected.
-
get_python_cve_records_all
(package_name: str, package_version: str) → List[dict][source]¶ Get known vulnerabilities for the given package-version.
-
get_python_environment_marker
(package_name: str, package_version: str, index_url: str, *, dependency_name: str, dependency_version: str, os_name: str, os_version: str, python_version: str) → Optional[str][source]¶ Get Python evaluation marker as per PEP-0508.
@raises NotFoundError: if the given package has no entry in the database
-
get_python_environment_marker_evaluation_result
(package_name: str, package_version: str, index_url: str, *, dependency_name: str, dependency_version: str, os_name: str, os_version: str, python_version: str) → bool[source]¶ Get result of the Python evaluation marker.
The extra part of the environment marker (an exception in PEP-0508) is not taken into account and is substituted with a value which always defaults to True (as it would cause an error during context interpreting). See solver implementation for details.
@raises NotFoundError: if the given package has no entry in the database
-
get_python_package_hashes_sha256
(package_name: str, package_version: str, index_url: str, *, distinct: bool = False) → List[str][source]¶ Get all hashes for Python package in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_python_package_hashes_sha256() [
‘9d6863f6c70d034b8c34b3355cb7ba7d2ad799583947265efda41fe67127c23f’, ‘8e4a1f6d89cfaadb486237acbfa24700add01da022dfcf3536e5071d21e13ee0’
]
-
get_python_package_index_all
(enabled: bool = None) → List[Dict[str, str]][source]¶ Get listing of Python package indexes registered in the graph database.
-
get_python_package_index_urls_all
(enabled: Optional[bool] = None) → List[str][source]¶ Retrieve all the URLs of registered Python package indexes.
-
get_python_package_required_symbols
(package_name: str, package_version: str, index_url: str) → List[str][source]¶ Get required symbols for a Python package in a specified version.
-
get_python_package_version_dependents_all
(package_name: str, *, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, start_offset: int = 0, count: int = 100) → List[Dict[str, Any]][source]¶ Get dependents for the given package.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_dependents(“selinon”, os_name=”rhel”, os_version=”8”, python_version=”3.6”) [
- {
“index_url”: “https://pypi.org/simple”, “package_name”: “thoth-worker”, “package_version”: “0.0.2”, “version_range”: “>=1.0.0”, “marker_evaluation_result”: True, “marker”: None, “extra”: None,
}
]
-
get_python_package_version_entities_count_all
(*, distinct: bool = False) → int[source]¶ Retrieve number of all Python packages in Thoth Database.
-
get_python_package_version_entities_names_all
() → List[str][source]¶ Retrieve names of Python package entities in the Thoth’s knowledge base.
-
get_python_package_version_metadata
(package_name: str, package_version: str, index_url: str) → Dict[str, str][source]¶ Retrieve Python package metadata.
-
get_python_package_version_names_all
(*, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → List[str][source]¶ Retrieve names of Python Packages known by Thoth.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_python_packages_names_all() [‘regex’, ‘tensorflow’]
-
get_python_package_version_platform_all
() → List[str][source]¶ Retrieve all platforms stored in the database.
-
get_python_package_version_records
(package_name: str, package_version: str, index_url: Optional[str], *, os_name: Optional[str], os_version: Optional[str], python_version: Optional[str]) → List[dict][source]¶ Get records for the given package regardless of index_url.
-
get_python_package_versions_all
(package_name: Optional[str] = None, package_version: Optional[str] = None, index_url: Optional[str] = None, *, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False, is_missing: Optional[bool] = None) → List[Tuple[str, str, str]][source]¶ Retrieve Python package versions in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_python_package_versions_all() [(‘regex’, ‘2018.11.7’, ‘https://pypi.org/simple’), (‘tensorflow’, ‘1.11.0’, ‘https://pypi.org/simple’)]
-
get_python_package_versions_all_count
(*, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False, sort_by: thoth.storages.graph.enums.QuerySortTypeEnum = None) → thoth.storages.graph.query_result_base.PythonQueryResult[source]¶ Retrieve number of versions per Python package name in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_python_package_versions_all_count() {‘setuptools’: 988, ‘pip’: 211, ‘termcolor’: 14, ‘six’: 42}
-
get_python_package_versions_count
(*, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → Dict[Tuple[str, str, str], int][source]¶ Retrieve number of Python Package (package_name, package_version, index_url) in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_python_package_versions_count() {(‘absl-py’, ‘0.1.10’, ‘https://pypi.org/simple’): 1, (‘absl-py’, ‘0.2.1’, ‘https://pypi.org/simple’): 1}
-
get_python_package_versions_count_all
(package_name: Optional[str] = None, package_version: Optional[str] = None, index_url: Optional[str] = None, *, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False, is_missing: Optional[bool] = None) → int[source]¶ Retrieve Python package versions number in Thoth Database.
-
get_python_package_versions_count_per_index
(index_url: str, *, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → Dict[str, Dict[Tuple[str, str], int]][source]¶ Retrieve number of Python package versions per index url in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_python_package_versions_count_per_index(index_url=’https://pypi.org/simple’) {‘https://pypi.org/simple’: {(‘absl-py’, ‘0.1.10’): 1, (‘absl-py’, ‘0.2.1’): 1}}
-
get_python_package_versions_count_per_version
(package_name: str, *, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → Dict[str, Dict[str, int]][source]¶ Retrieve number of Python package versions per index url in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_python_package_versions_count_per_version(package_name=’tensorflow’) {‘1.14.0rc0’: {‘https://pypi.org/simple’: 1}, ‘1.13.0rc2’: {‘https://pypi.org/simple’: 1}}
-
get_python_package_versions_per_index
(index_url: str, *, distinct: bool = False) → Dict[str, List[str]][source]¶ Retrieve listing of Python packages (solved) known to graph database instance for the given index.
-
get_python_packages_all
(*, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → List[Tuple[str, str]][source]¶ Retrieve Python packages with index in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_python_packages_all() [(‘regex’, ‘https://pypi.org/simple’), (‘tensorflow’, ‘https://pypi.org/simple’)]
-
get_python_packages_all_versions
(*, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → Dict[str, List[Tuple[str, str]]][source]¶ Retrieve Python package versions per package in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_python_packages_all_versions() {‘absl-py’: [(‘0.1.10’, ‘https://pypi.org/simple’), (‘0.2.1’, ‘https://pypi.org/simple’)]}
-
get_python_packages_count_all
(*, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → int[source]¶ Retrieve number of versions per Python package in Thoth Database.
-
get_python_software_stack_count_all
(software_stack_type: str, distinct: bool = False) → int[source]¶ Get number of Python software stacks available filtered by type.
-
get_relation_table_count
() → Dict[str, int][source]¶ Retrieve dictionary mapping relation tables to records count.
-
get_run_software_environment_all
(start_offset: int = 0, count: Optional[int] = 100, is_external: bool = False) → List[str][source]¶ Get all software environments available for run.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_run_software_environment_all() [‘quay.io/thoth-station/thoth-pylint:v0.7.0-ubi8’]
-
get_run_software_environment_analyses_all
(run_software_environment_name: str, start_offset: int = 0, count: Optional[int] = 100, convert_datetime: bool = True, is_external: bool = False) → List[dict][source]¶ Get listing of analyses available for the given software environment for run.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_run_software_environment_analyses_all() [{
‘analysis_datetime’: datetime.datetime(2019, 10, 7, 18, 57, 22, 658131), ‘analysis_document_id’: ‘package-extract-2ef02c9cea8b1ef7’, ‘package_extract_name’: ‘thoth-package-extract’, ‘package_extract_version’: ‘1.0.1’ }]
-
get_script_alembic_version_head
() → str[source]¶ Get alembic version head from alembic folder scripts.
-
get_si_aggregated_python_package_version
(package_name: str, package_version: str, index_url: str) → Dict[str, int][source]¶ Get Aggregate Security Indicators (SI) results per Python package version.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_si_aggregated_python_package_version(
package_name=’thoth-common’, package_version=’0.10.0’, index_url=’https://pypi.org/simple’
- )
- {
‘severity_high_confidence_high’: 0, ‘severity_high_confidence_low’: 0, ‘severity_high_confidence_medium’: 0, ‘severity_high_confidence_undefined’: 0, ‘severity_low_confidence_high’: 0, ‘severity_low_confidence_low’: 0, ‘severity_low_confidence_medium’: 0, ‘severity_low_confidence_undefined’: 0, ‘severity_medium_confidence_high’: 0, ‘severity_medium_confidence_low’: 0, ‘severity_medium_confidence_medium’: 0, ‘severity_medium_confidence_undefined’: 0, ‘number_of_analyzed_files’: 0, ‘number_of_files_total’: 0, ‘number_of_files_with_severities’: 0, ‘number_of_filtered_files’: 0, ‘number_of_python_files’: 39, ‘number_of_lines_with_comments_in_python_files’: 922, ‘number_of_blank_lines_in_python_files’: 2760, ‘number_of_lines_with_code_in_python_files’: 9509, ‘total_number_of_files’: 75, ‘total_number_of_lines’: 36856, ‘total_number_of_lines_with_comments’: 2895, ‘total_number_of_blank_lines’: 6737, ‘total_number_of_lines_with_code’: 27224
}
-
get_si_analyzed_python_package_versions_all
(*, distinct: bool = False) → List[Tuple[str, str, str]][source]¶ Get SI analyzed Python package versions in Thoth Database. Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_si_analyzed_python_package_versions_all() [(‘fbprophet’, ‘0.4’, ‘https://pypi.org/simple’)]
-
get_si_analyzed_python_package_versions_count_all
(*, distinct: bool = False) → int[source]¶ Get SI analyzed Python package versions number in Thoth Database.
-
get_si_unanalyzed_python_package_versions_all
(start_offset: int = 0, count: Optional[int] = 100, distinct: bool = True, randomize: bool = True, provides_source_distro: bool = True, si_error: bool = False) → List[Tuple[str, str, str]][source]¶ Retrieve solved Python package versions in Thoth Database, that are not anaylyzed by SI. Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_si_unanalyzed_python_package_versions_all() [(‘crossbar’, ‘0.10.0’, ‘https://pypi.org/simple’), (‘tensorflow’, ‘1.11.0’, ‘https://pypi.org/simple’)]
-
get_si_unanalyzed_python_package_versions_count_all
(index_url: Optional[str] = None, *, distinct: bool = False, provides_source_distro: bool = True, si_error: bool = False) → int[source]¶ Get SI unanalyzed Python package versions number in Thoth Database.
-
get_software_environments_all
(is_external: bool = False, *, start_offset: int = 0, count: Optional[int] = 100) → List[Dict][source]¶ Get software environments (external or internal) registered in the graph database.
-
get_solved_python_package_versions_all
(package_name: Optional[str] = None, package_version: Optional[str] = None, index_url: Optional[str] = None, *, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False, is_missing: Optional[bool] = None) → List[Tuple[str, str, str]][source]¶ Retrieve solved Python package versions in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_solved_python_package_versions_all() [(‘regex’, ‘2018.11.7’, ‘https://pypi.org/simple’), (‘tensorflow’, ‘1.11.0’, ‘https://pypi.org/simple’)]
-
get_solved_python_package_versions_count
(*, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → Dict[Tuple[str, str, str], int][source]¶ Retrieve number of Python Package (package_name, package_version, index_url) solved in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_solved_python_package_versions_count() {(‘absl-py’, ‘0.1.10’, ‘https://pypi.org/simple’): 1, (‘absl-py’, ‘0.2.1’, ‘https://pypi.org/simple’): 1}
-
get_solved_python_package_versions_count_all
(package_name: Optional[str] = None, package_version: Optional[str] = None, index_url: Optional[str] = None, *, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False, is_missing: Optional[bool] = None) → int[source]¶ Retrieve solved Python package versions number in Thoth Database.
-
get_solved_python_package_versions_count_per_index
(index_url: str, *, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → Dict[str, Dict[Tuple[str, str], int]][source]¶ Retrieve number of solved Python package versions per index url in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_solved_python_package_versions_count_per_index(index_url=’https://pypi.org/simple’) {‘https://pypi.org/simple’: {(‘absl-py’, ‘0.1.10’): 1, (‘absl-py’, ‘0.2.1’): 1}}
-
get_solved_python_package_versions_count_per_version
(package_name: str, *, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → Dict[str, Dict[str, int]][source]¶ Retrieve number of solved Python package versions per package version in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_solved_python_package_versions_count_per_version(package_name=’tensorflow’) {‘1.14.0rc0’: {‘https://pypi.org/simple’: 1}, ‘1.13.0rc2’: {‘https://pypi.org/simple’: 1}}
-
get_solved_python_package_versions_software_environment_all
() → List[Dict[str, str]][source]¶ Retrieve software environment configurations used to solve Python packages.
-
get_solved_python_packages_all
(*, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → List[Tuple[str, str]][source]¶ Retrieve solved Python package with index in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_solved_python_packages_all() [(‘regex’, ‘https://pypi.org/simple’), (‘tensorflow’, ‘https://pypi.org/simple’)]
-
get_solved_python_packages_all_versions
(*, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → Dict[str, List[Tuple[str, str]]][source]¶ Retrieve solved Python package versions per package in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_solved_python_packages_all_versions() {‘absl-py’: [(‘0.1.10’, ‘https://pypi.org/simple’), (‘0.2.1’, ‘https://pypi.org/simple’)]}
-
get_solved_python_packages_count_all
(*, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → int[source]¶ Retrieve number of solved Python package versions in Thoth Database.
-
get_solver_run_document_ids_all
(initial_date: Optional[str] = None, final_date: Optional[str] = None, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, start_offset: int = 0, count: Optional[int] = 100, has_error: bool = False, unsolvable: bool = False, unparseable: bool = False) → List[str][source]¶ Retrieve solver run document ids.
@params initial_date: DD-MM-YY @params final_date: DD-MM-YY
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_solver_run_document_ids_all() [‘solver-rhel-8-py38-343231d’]
-
get_unsolved_python_package_versions_all
(package_name: Optional[str] = None, package_version: Optional[str] = None, index_url: Optional[str] = None, *, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False, randomize: bool = True) → List[Tuple[str, Optional[str], Optional[str]]][source]¶ Retrieve unsolved Python package versions in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_unsolved_python_package_versions_all() [(‘regex’, ‘2018.11.7’, ‘https://pypi.org/simple’), (‘tensorflow’, ‘1.11.0’, ‘https://pypi.org/simple’)]
-
get_unsolved_python_package_versions_count
(*, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, start_offset: int = 0, count: Optional[int] = 100, distinct: bool = False) → Dict[Tuple[str, str, str], int][source]¶ Retrieve number of unsolved versions per Python package in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_unsolved_python_package_versions_count() {(‘absl-py’, ‘0.1.10’, ‘https://pypi.org/simple’): 1, (‘absl-py’, ‘0.2.1’, ‘https://pypi.org/simple’): 1}
-
get_unsolved_python_package_versions_count_all
(package_name: Optional[str] = None, package_version: Optional[str] = None, index_url: Optional[str] = None, *, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → int[source]¶ Retrieve unsolved Python package versions number in Thoth Database.
-
get_unsolved_python_package_versions_count_per_index
(index_url: str, *, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, start_offset: int = 0, count: Optional[int] = 100, distinct: bool = False) → Dict[str, Dict[Tuple[str, str], int]][source]¶ Retrieve number of unsolved Python package versions per index url in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_unsolved_python_package_versions_count_per_index(index_url=’https://pypi.org/simple’) {‘https://pypi.org/simple’: {(‘absl-py’, ‘0.1.10’): 1, (‘absl-py’, ‘0.2.1’): 1}}
-
get_unsolved_python_package_versions_count_per_version
(package_name: str, *, start_offset: int = 0, count: Optional[int] = 100, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, distinct: bool = False) → Dict[str, Dict[str, int]][source]¶ Retrieve number of unsolved Python package versions per package version in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_unsolved_python_package_versions_count_per_version(package_name=’tensorflow’) {‘1.14.0rc0’: {‘https://pypi.org/simple’: 1}, ‘1.13.0rc2’: {‘https://pypi.org/simple’: 1}}
-
get_unsolved_python_packages_all
(*, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, start_offset: int = 0, count: Optional[int] = 100, distinct: bool = False) → List[Tuple[str, Optional[str]]][source]¶ Retrieve unsolved Python package with index in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_unsolved_python_packages_all() [(‘regex’, ‘https://pypi.org/simple’), (‘tensorflow’, ‘https://pypi.org/simple’)]
-
get_unsolved_python_packages_all_per_adviser_run
(source_type: str) → Dict[str, List[str]][source]¶ Retrieve all unsolved packages for a certain Adviser Run that need to be re run.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_unsolved_python_packages_all_per_adviser_run() {‘adviser-04ab56d6’: [‘black’], ‘adviser-054ab56d6’: [‘black’, ‘numpy’]}
-
get_unsolved_python_packages_all_versions
(*, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, start_offset: int = 0, count: Optional[int] = 100, distinct: bool = False) → Dict[str, List[Tuple[str, str]]][source]¶ Retrieve unsolved Python package versions per package in Thoth Database.
Examples: >>> from thoth.storages import GraphDatabase >>> graph = GraphDatabase() >>> graph.get_unsolved_python_packages_all_versions() {‘absl-py’: [(‘0.1.10’, ‘https://pypi.org/simple’), (‘0.2.1’, ‘https://pypi.org/simple’)]}
-
has_python_solver_error
(package_name: str, package_version: str, index_url: str, *, os_name: Optional[str], os_version: Optional[str], python_version: Optional[str]) → bool[source]¶ Retrieve information whether the given package has any solver error.
-
inspection_document_id_exist
(inspection_document_id: str) → bool[source]¶ Check if there is an inspection document record with the given id.
-
inspection_document_id_result_number_exists
(inspection_document_id: str, inspection_result_number: int) → bool[source]¶ Check if the given inspection id result number record exists in the graph database.
-
is_database_corrupted
() → bool[source]¶ Run the amcheck extension to check for DB corruption, false negatives are possible but false positives are not.
amcheck documenation: https://www.postgresql.org/docs/10/amcheck.html
- bool
False: No DB corruption detected by amcheck (not definitive) True: Database is corrupted
-
is_python_package_index_enabled
(url: str) → bool[source]¶ Check if the given Python package index is enabled.
-
is_python_package_version_is_missing
(package_name: str, package_version: str, index_url: str) → bool[source]¶ Check whether is_missing flag is set for python package version.
-
is_schema_up2date
() → bool[source]¶ Check if the current schema is up2date with the one configured on database side.
-
static
normalize_python_index_url
(index_url: Optional[str]) → Optional[str][source]¶ Map python index url.
-
static
normalize_python_package_name
(package_name: str) → str[source]¶ Normalize Python package name based on PEP-0503.
-
static
normalize_python_package_version
(package_version: str) → str[source]¶ Normalize Python package name based on PEP-440.
-
provenance_checker_document_id_exist
(provenance_checker_document_id: str) → bool[source]¶ Check if there is a provenance-checker document record with the given id.
-
python_package_exists
(package_name: str) → bool[source]¶ Check if the given Python package exists regardless of version.
-
python_package_version_depends_on_platform_exists
(platform: str) → bool[source]¶ Check if the given platform has some records in the database.
-
python_package_version_exists
(package_name: str, package_version: str, index_url: Optional[str] = None, solver_name: Optional[str] = None) → bool[source]¶ Check if the given Python package version exists in the graph database.
If optional solver_name parameter is set, the call answers if the given package was solved by the given solver. Otherwise, any solver run is taken into account.
-
register_python_package_index
(url: str, warehouse_api_url: Optional[str] = None, verify_ssl: bool = True, enabled: bool = False) → bool[source]¶ Register the given Python package index in the graph database.
-
retrieve_dependent_packages
(package_name: str, package_version: Optional[str] = None) → Dict[str, List[str]][source]¶ Get mapping package name to package version of packages that depend on the given package.
-
retrieve_transitive_dependencies_python
(package_name: str, package_version: str, index_url: str, *, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None, extras: FrozenSet[Optional[str]] = None, marker_evaluation_result: Optional[bool] = None) → List[Tuple[Tuple[str, str, str], Tuple[str, str, str], Tuple[str, str, str], Tuple[str, str, str], Optional[Tuple[str, str, str]], Optional[Tuple[str, str, str]]]][source]¶ Get all transitive dependencies for the given package by traversing dependency graph.
It’s much faster to retrieve just dependency ids for the transitive dependencies as most of the time is otherwise spent in serialization and deserialization of query results. The ids are obtained later on (kept in ids map, see bellow).
The ids map represents a map to optimize number of retrievals - not to perform duplicate queries into graph instance.
Extras are taken into account only for direct dependencies. Any extras required in libraries used in transitive dependencies are not required as solver directly report dependencies regardless extras configuration - see get_depends_on docs for extras parameter values..
-
retrieve_transitive_dependencies_python_multi
(*package_tuples, os_name: Optional[str] = None, os_version: Optional[str] = None, python_version: Optional[str] = None) → Dict[Tuple[str, str, str], Set[Tuple[Tuple[str, str, str], Tuple[str, str, str], Tuple[str, str, str], Tuple[str, str, str], Optional[Tuple[str, str, str]], Optional[Tuple[str, str, str]]]]][source]¶ Get all transitive dependencies for a given set of packages by traversing the dependency graph.
-
set_python_package_index_state
(url: str, *, enabled: bool) → None[source]¶ Enable or disable Python package index.
-
si_aggregated_document_id_exists
(si_aggregated_run_document_id: str) → bool[source]¶ Check if the given security indicator aggregated report record exists in the graph database.
-
si_aggregated_python_package_version_exists
(package_name: str, package_version: str, index_url: str) → bool[source]¶ Check if Aggregate Security Indicators (SI) results exists for Python package version.
-
solved_software_environment_exists
(os_name: str, os_version: str, python_version: str) → bool[source]¶ Check if there are any solved packages for the given software environment.
-
solver_document_id_exists
(solver_document_id: str) → bool[source]¶ Check if there is a solver document record with the given id.
-
solver_records_exist
(solver_document: dict) → bool[source]¶ Check if the given solver document record exists.
-
sync_analysis_result
(document: dict) → None[source]¶ Sync the given analysis result to the graph database.
-
sync_dependency_monkey_result
(document: dict) → None[source]¶ Sync reports of dependency monkey runs.
-
sync_inspection_result
(document) → None[source]¶ Sync the given inspection document into the graph database.
-
sync_provenance_checker_result
(document: dict) → None[source]¶ Sync provenance checker results into graph database.
-
sync_revsolver_result
(document: Dict[str, Any]) → None[source]¶ Sync results of the reverse solver.
This updates relations for DependsOn on a new package release.
-
sync_security_indicator_aggregated_result
(document: dict) → None[source]¶ Sync the given security-indicator aggregated result to the graph database.
-
sync_solver_result
(document: dict) → None[source]¶ Sync the given solver result to the graph database.
-
update_kebechet_github_installations_on_is_active
(slug: str) → bool[source]¶ Deactivate the app on getting an uninstall event.
Passed a slug name to be deactivated. Example - slug:’thoth-station/advisor’ :rtype: True, False :returns True: if installation existed and was deactivated. :returns False: if installation was not found.
-
update_missing_flag_package_version
(package_name: str, package_version: str, index_url: str, value: bool) → None[source]¶ Update value of is_missing flag for PythonPackageVersion.
-
thoth.storages.graph.postgres_utils module¶
Utils for postgresql database.
-
thoth.storages.graph.postgres_utils.
create_database
(url, encoding='utf8', template=None)[source]¶ Issue the appropriate CREATE DATABASE statement. :param url: A SQLAlchemy engine URL. :param encoding: The encoding to create the database as. :param template:
The name of the template from which to create the new database. At the moment only supported by PostgreSQL driver.
To create a database, you can pass a simple URL that would have been passed to
create_engine
.create_database('postgres://postgres@localhost/name')
- You may also pass the url from an existing engine. ::
create_database(engine.url)
Has full support for mysql, postgres, and sqlite. In theory, other database engines should be supported.
Modified version from sqlalchemy_utils to take care of one issue.
-
thoth.storages.graph.postgres_utils.
database_exists
(url)[source]¶ Check if a database exists. :param url: A SQLAlchemy engine URL. Performs backend-specific testing to quickly determine if a database exists on the server.
database_exists('postgres://postgres@localhost/name') #=> False create_database('postgres://postgres@localhost/name') database_exists('postgres://postgres@localhost/name') #=> True
- Supports checking against a constructed URL as well. ::
engine = create_engine(‘postgres://postgres@localhost/name’) database_exists(engine.url) #=> False create_database(engine.url) database_exists(engine.url) #=> True
Modified version from sqlalchemy_utils to take care of one issue.
thoth.storages.graph.query_result_base module¶
Utilities for SQLAlchemy query results.
thoth.storages.graph.sql_base module¶
A base class for implementing SQL based databases.
Module contents¶
A graph database adapter for communicating with dgraph via gRPC.