ensure_untar
- ensure_untar(key: str, *subkeys: str, url: str, name: str | None = None, directory: str | None = None, force: bool = False, download_kwargs: DownloadKwargs | None = None, extract_kwargs: Mapping[str, Any] | None = None) Path[source]
Ensure a file is downloaded and untarred.
- Parameters:
key – The name of the module. No funny characters. The envvar <key>_HOME where key is uppercased is checked first before using the default home directory.
subkeys – A sequence of additional strings to join. If none are given, returns the directory for this module.
url – The URL to download.
name – Overrides the name of the file at the end of the URL, if given. Also useful for URLs that don’t have proper filenames with extensions.
directory – Overrides the name of the directory into which the tar archive is extracted. If none given, will use the stem of the file name that gets downloaded.
force – Should the download be done again, even if the path already exists? Defaults to false.
download_kwargs – Keyword arguments to pass through to
pystow.utils.download().extract_kwargs – Keyword arguments to pass to
tarfile.TarFile.extract_all().
- Returns:
The path of the directory where the file that has been downloaded gets extracted to