medcat.utils.saving.envsnapshot

Module Contents

Functions

get_direct_dependencies()

Get the set of direct dependency names.

_update_installed_dependencies_recursive(gathered, package)

get_transitive_deps(direct_deps)

Get the transitive dependencies of the direct dependencies.

get_installed_packages()

Get the installed packages and their versions.

get_environment_info([include_transitive_deps])

Get the current environment information.

Attributes

logger

ENV_SNAPSHOT_FILE_NAME

INSTALL_REQUIRES_FILE_PATH

INSTALL_REQUIRES_FILE_PATH_PIP

medcat.utils.saving.envsnapshot.logger
medcat.utils.saving.envsnapshot.ENV_SNAPSHOT_FILE_NAME = 'environment_snapshot.json'
medcat.utils.saving.envsnapshot.INSTALL_REQUIRES_FILE_PATH
medcat.utils.saving.envsnapshot.INSTALL_REQUIRES_FILE_PATH_PIP
medcat.utils.saving.envsnapshot.get_direct_dependencies()

Get the set of direct dependency names.

The current implementation reads install_requires.txt for dependenceies, removes comments, whitespace, quotes; removes the versions and returns the names as a set.

Returns:

Set[str] – The set of direct dependency names.

Return type:

Set[str]

medcat.utils.saving.envsnapshot._update_installed_dependencies_recursive(gathered, package)
Parameters:
  • gathered (Dict[str, str]) –

  • package (pkg_resources.Distribution) –

Return type:

Dict[str, str]

medcat.utils.saving.envsnapshot.get_transitive_deps(direct_deps)

Get the transitive dependencies of the direct dependencies.

Parameters:

direct_deps (List[str]) – List of direct dependencies.

Returns:

List[List[str]] – The list of dependency names along with their versions.

Return type:

List[List[str]]

medcat.utils.saving.envsnapshot.get_installed_packages()

Get the installed packages and their versions.

Returns:

List[List[str]] – List of lists. Each item contains of a dependency name and version.

Return type:

List[List[str]]

medcat.utils.saving.envsnapshot.get_environment_info(include_transitive_deps=True)

Get the current environment information.

Parameters:

include_transitive_deps (bool) – Whether to include transitive dependencies. Defaults to True.

Return type:

Dict[str, Any]

This includes dependency versions, the OS, the CPU architecture and the python version.

Returns:

Dict[str, Any] – _description_

Parameters:

include_transitive_deps (bool) –

Return type:

Dict[str, Any]