config#

showyourwork.config.as_dict(x, depth=0, maxdepth=30)#

Replaces nested instances of OrderedDicts with regular dicts in a dictionary.

This is useful when parsing a config generated from a YAML file with inconsistent use of hyphens.

Parameters:
  • x – A dictionary or dictionary-like mapping generated from reading a YAML file.

  • depth (int, optional) – Default is 0.

  • maxdepth (int, optional) – Default is 30.

showyourwork.config.edit_yaml(file)#

A context used to edit a YAML file in place.

Parameters:

file (str) – The full path to the YAML file.

showyourwork.config.edit_yaml_roundtrip(file)#
showyourwork.config.expand_dependency_directories(dependency, repo_root=None)#

Expand a dependency path that may be a directory into a list of files.

If the dependency is a directory, recursively returns all files within it. Otherwise, returns the dependency as-is in a list.

Parameters:
  • dependency (str) – Path to a file or directory, relative to the repo root. Should use forward slashes (/) as path separators for consistency across platforms.

  • repo_root (Path, optional) – Root path of the repository. If not provided, defaults to the user’s repo root via paths.user().repo.

Returns:

A list of file paths (as strings) with forward slashes as separators

for platform-independent consistency.

Return type:

list

showyourwork.config.get_run_type()#

Return the type of the current Snakemake run.

Options are:

  • clean

  • build

  • tarball

  • preprocess

  • other

Returns:

The type of the current run (one of the options listed above).

Return type:

str

showyourwork.config.get_upstream_dependencies(file, dependencies, depth=0)#

Collect user-defined dependencies of a file recursively. Returns a list of strings.

showyourwork.config.parse_config()#

Parse the current config and fill in defaults.

showyourwork.config.parse_overleaf()#

Parse Overleaf configuration options and fill in defaults.

showyourwork.config.render_config(cwd='.')#

Render any jinja templates in showyourwork.yml, combine with zenodo.yml, and save the processed config to a temporary YAML file.

This temporary YAML file is then used as the configfile for the Snakemake workflow.

Parameters:

cwd (str, optional) – The path to the working directory.

Returns:

The user config.

Return type:

dict