datopy.workflow#

Description

Tools for data input/output.

Included:

  • Saving figures and Jupyter runtime environment files

  • Manually downloading modules

git_module_loader(
modules: Dict[str, List[str]],
save_dir: str | None = None,
run_tests: bool = False,
run_download: bool = False,
) None[source]#

Download collections of modules directly from their Git repo.

Retrieved files are stored in the current directory.

Parameters:
  • modules (Dict[str, List[str]]) – Keys are relative branch paths ‘{git-user}/{repo-name}/{branch-name}’. Values are lists of module filenames relative to their parent branch.

  • run_tests (bool, default=False) – Whether or not to run doctests for successful downloads.

  • run_download (bool, default=False) – Additional safeguard to ensure no modules are accidentally downloaded.

Examples

>>> from datopy.workflow import git_module_loader
>>> modules = {'gitusername/repo/branch': ['module1.py', 'module2.py']}
>>> git_module_loader(modules, run_tests=True, run_download=True)
Module gitusername/repo/branch/module1.py does not exist.
Module gitusername/repo/branch/module2.py does not exist.
>>> modules = {"HIPS/autograd/master":
...     ['autograd/tracer.py', 'autograd/util.py']}
>>> git_module_loader(modules, run_tests=False, run_download=False)
Skipping download.
Skipping download.
doctest_function(
object: Callable[[...], Any],
globs: dict[str, Any],
verbose=True,
) None[source]#

Run doctests for a specific function or class.

Parameters:
  • object (Callable[…, Any]) – Class, function, or other object with doctests to be run.

  • globs (dict[str, Any]) – Global variables from module of interest.

See also

datopy.run_doctests.run_doctest_suite

Simultaneously run all doctests across modules.


Functions

doctest_function(object, globs[, verbose])

Run doctests for a specific function or class.

git_module_loader(modules[, save_dir, ...])

Download collections of modules directly from their Git repo.