provenance
Collect information about the current environment, like:
The Python version
The versions of the modules which are currently loaded
The git information for the modules which are currently loaded from a git repository
…
- anemoi.utils.provenance.editable_installs() dict[str, Path]
Return a dictionary of editable installs.
The check relies on how editable installs are handled based on PEP610. A <path-to-venv>/lib/site-packages/<package>.dist-info/direct_url.json file should be present.
- anemoi.utils.provenance.is_editable_install(init_path: str | Path) bool
Determine if the given path corresponds to an editable install.
- anemoi.utils.provenance.lookup_git_repo(path: str) Any | None
Lookup the git repository for a given path.
- Parameters:
path (str) – The path to lookup.
- Returns:
The git repository if found, otherwise None.
- Return type:
Repo, optional
- anemoi.utils.provenance.package_distributions() dict[str, list[str]]
Get the package distributions.
- Returns:
The package distributions.
- Return type:
- anemoi.utils.provenance.import_name_to_distribution_name(packages: list[str]) dict[str, str]
Convert import names to distribution names.
- anemoi.utils.provenance.module_versions(full: bool) tuple[dict[str, Any], dict[str, Any]]
Collect version information for all loaded modules and their git information.
- anemoi.utils.provenance.git_check(*args: Any) dict[str, Any]
Return the git information for the given arguments.
- Arguments can be:
an empty list, in that case all loaded modules are checked
a module name
a module object
an object or a class
a path to a directory
- Parameters:
args (list) – The list of arguments to check
- Returns:
An object with the git information for the given arguments.
>>> { "anemoi.utils": { "sha1": "c999d83ae283bcbb99f68d92c42d24315922129f", "remotes": [ "git@github.com:ecmwf/anemoi-utils.git" ], "modified_files": [ "anemoi/utils/checkpoints.py" ], "untracked_files": [] } }
- Return type:
- anemoi.utils.provenance.platform_info() dict[str, Any]
Get the platform information.
- Returns:
The platform information.
- Return type:
- anemoi.utils.provenance.assets_info(paths: list[str]) dict[str, Any]
Get information about the given assets.