Developer API

Note

The API documentation is still under development. Please check back soon for more details.

Rule scripts

config.py

Process the user config settings.

errors.py

Figure “error” (status) codes.

rules.errors.ScriptDoesNotExist = <rules.errors._ScriptDoesNotExist object>

The figure script does not exist.

rules.errors.ScriptHasUncommittedChanges = <rules.errors._ScriptHasUncommittedChanges object>

The figure script has uncommitted changes.

rules.errors.ScriptNotVersionControlled = <rules.errors._ScriptNotVersionControlled object>

The figure script is not version controlled.

rules.errors.ScriptUpToDate = <rules.errors._ScriptUpToDate object>

The figure script is version controlled and up to date.

files.py

Miscellaneous files used throughout the workflow.

class rules.files.files

Houses lists of support files used throughout the workflow.

aux = []

Auxiliary files we copy over to the user’s src/ directory.

cls = {}

Class-specific auxiliary files.

dot_zenodo = []

The .zenodo files in which we store the URL for the datasets We make the PDF generation depend on these so we always have access to the URLs for the icon generation. These are updated in zenodo.smk.

special_figures = ['orcid-id.png', 'showyourwork.pdf']

Figures that are allowed directly in the src/ directory

tectonic = []

Tectonic command

tmp_syw = '.showyourwork-ms'

Temporary tex file.

tmp_xml = '.showyourwork-xml-ms'

Temporary tex file.

unknown = 'unknown-script'

Dummy file dependency for figures w/ unknown parent scripts.

zenodo_files_auto = []

The showyourwork-managed datasets for this article

zenodo_files_manual = []

The manually-uploaded datasets for this article that must be downloaded

functions.py

Functions used as inputs / params in various rules.

rules.functions.check_figure_format(figure)

Check that all figures are declared correctly in tex/ms.tex so we can parse them corresponding XML tree.

rules.functions.class_files(wildcards)

Return a list of class files needed to compile the PDF.

rules.functions.figure_script(wildcards)

Return the figure script that produces wildcards.figure.

rules.functions.figure_script_dependencies(wildcards)

Return user-specified dependencies of the current figure script.

rules.functions.figures(wildcards)

Return all the figure files required by the manuscript.

rules.functions.input_class_file(wildcards)

Return the path to the LaTeX document class file.

rules.functions.script_name(wildcards, input)

Returns the name of the figure script for the figure rule.

Assumes the first python file in the input is the one that generates the script.

paths.py

Sets global constants for the workflow.

class rules.paths.abspaths

Absolute paths used throughout the workflow.

user = PosixPath('/path/to/repo')

Path to the user’s repository root

workflow = PosixPath('/path/to/showyourwork')

Path to the showyourwork workflow

rules.paths.posix(path)

Convert a path object to a string containing the posix path.

class rules.paths.relpaths

Relative paths used throughout the workflow.

dot_github = PosixPath('.github')

Path to the showyourwork workflow

figures = PosixPath('src/figures')

Path to the showyourwork workflow

temp = PosixPath('.showyourwork')

Path to the showyourwork workflow

tex = PosixPath('src')

Path to the showyourwork workflow

zenodo.py

Collect information about all the datasets we’ll need to upload to/download from Zenodo.

class rules.zenodo.zenodo

Class containing metadata for all Zenodo deposits.

deposit_creators = {}

Zenodo authors for each dataset

deposit_description = {}

Zenodo deposit description for each dataset

deposit_title = {}

Zenodo deposit title for each dataset

file_name = {}

File name for each dataset

file_path = {}

Path to each dataset

generate_deps = {}

List of dependencies of each dataset

generate_shell = {}

Shell command for generating each dataset

sandbox = {}

Use Zenodo sandbox for a particular dataset?

token_name = {}

Zenodo token name (name of an env. var.) for each dataset

zenodo_id = {}

Id for each Zenodo download

zenodo_url = {}

Url for each Zenodo download

Rule files

Note

Coming soon!