isofit.data.download
Utility functions for the downloader modules
Functions
|
Fetch GitHub metadata for the latest tagged release. |
|
Stream downloads a file |
|
Unzips a zipfile |
|
Untars a .tar file. Removes the tar file after extracting |
|
Prepares the output path by ensuring the parents exist and itself doesn't presently exist. |
|
Download extra ISOFIT files that do not come with the default installation |
Preview download path locations. Paths can be changed from the default by using the overrides on the isofit command. See more via isofit --help |
|
|
Checks the installed version against the latest release on Github |
|
Pulls a release zipfile from a Github repository |
Module Contents
- release_metadata(org, repo, tag='latest')[source]
Fetch GitHub metadata for the latest tagged release.
Credit to Kevin Wurster https://github.com/isofit/isofit/pull/448#issuecomment-1966747551
- unzip(file, path=None, rename=None, overwrite=False, cleanup=True)[source]
Unzips a zipfile
- Parameters:
path (str, default=None) – Path to extract the zipfile to. Defaults to the directory the zip is found in
rename (str, default=None) – Renames the extracted data to this
overwrite (bool, default=False) – Overwrites the path destination with the zip contents if enabled
cleanup (bool, default=True) – Removes the zip file after completion
- Returns:
dst – The extracted output path
- Return type:
- prepare_output(output, default, isdir=False, overwrite=False)[source]
Prepares the output path by ensuring the parents exist and itself doesn’t presently exist.
- preview_paths()[source]
Preview download path locations. Paths can be changed from the default by using the overrides on the isofit command. See more via isofit –help
Example: Change the default data and examples paths $ isofit –data /path/to/data –examples /different/path/examples download paths
Download paths will default to: - data = /path/to/data - examples = /different/path/examples
These will be saved and may be reviewed: $ isofit download paths
Download paths will default to: - data = /path/to/data - examples = /different/path/examples
- isUpToDateGithub(owner, repo, name, path=None, debug=print, error=print, **_)[source]
Checks the installed version against the latest release on Github
- Parameters:
owner (str) – Github repository owner
repo (str) – Repository name
name (str) – Name of the downloader module to retrieve the path from the env ini if path is not provided
path (str, default=None) – Path to update. If None, defaults to the ini path
debug (function, default=print) – Print function to use for debug messages, eg. logging.debug
error (function, default=print) – Print function to use for error messages, eg. logging.error
**_ (dict) – Ignores unused params that may be used by other validate functions. This is to maintain compatibility with other functions
- Returns:
True if the path is up to date, False otherwise
- Return type:
Notes
The Github workflows watch for the string “[x]” to determine if the cache needs to update the data of this module. If your module does not include this string, the workflows will never detect updates.