medcat.utils.envsnapshot
Classes:
Functions:
-
get_direct_dependencies–Gets the direct dependencies of the current package and their versions.
-
get_environment_info–Get the current environment information.
-
get_installed_dependencies–Get the installed packages and their versions.
-
get_transitive_deps–Get the transitive dependencies of the direct dependencies.
-
is_dependency_installed–Checks whether a dependency is installed.
Attributes:
Environment
Bases: BaseModel, AbstractSerialisable
Methods:
Attributes:
-
cpu_arcitecture(str) – -
dependencies(dict[str, str]) – -
os(str) – -
python_version(str) – -
transitive_deps(dict[str, str]) –
get_direct_dependencies
get_direct_dependencies(include_extras: bool) -> list[str]
Gets the direct dependencies of the current package and their versions.
Parameters:
-
(include_extrasbool) –Whether to include extras (like spacy).
Source code in medcat-v2/medcat/utils/envsnapshot.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
get_environment_info
get_environment_info(include_transitive_deps: bool = True, include_extras: bool = True) -> Environment
Get the current environment information.
This includes dependency versions, the OS, the CPU architecture and the python version.
Parameters:
-
(include_transitive_depsbool, default:True) –Whether to include transitive dependencies. Defaults to True.
-
(include_extrasbool, default:True) –Whether to include extras (like spacy). Defaults to True.
Returns:
-
Environment(Environment) –The environment.
Source code in medcat-v2/medcat/utils/envsnapshot.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
get_installed_dependencies
get_installed_dependencies(include_extras: bool) -> dict[str, str]
Get the installed packages and their versions.
Parameters:
-
(include_extrasbool) –Whether to include extras (like spacy).
Returns:
Source code in medcat-v2/medcat/utils/envsnapshot.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
get_transitive_deps
Get the transitive dependencies of the direct dependencies.
Parameters:
Returns:
Source code in medcat-v2/medcat/utils/envsnapshot.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
is_dependency_installed
is_dependency_installed(dependency: str) -> bool
Checks whether a dependency is installed.
This takes into account changes such as '-' vs '_'.
For example, typing-extensions is a direct dependency,
but its module path will be typing_extension and that's
how we can find it as an installed dependency.
Parameters:
-
(dependencystr) –The dependency in question.
Returns:
-
bool(bool) –Whether the depedency has been installed.
Source code in medcat-v2/medcat/utils/envsnapshot.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |