util

util

Utility functions for the package

Functions

Name Description
date_today Returns the current date in ISO8601-compliant format (YYYY-MM-DD).
path_resolve Resolves the given filepath to an absolute path.
precommit_run Run pre-commit run with the specified arguments.
print_citation Print the package citation in bibtex format and exit.
repo_base Get the absolute path to a file in the repository

date_today

util.date_today()

Returns the current date in ISO8601-compliant format (YYYY-MM-DD).

Returns

Name Type Description
str The current date as a string in the format YYYY-MM-DD.

path_resolve

util.path_resolve(filepath)

Resolves the given filepath to an absolute path.

Parameters

Name Type Description Default
filepath str The path to be resolved. required

Returns

Name Type Description
pathlib.Path: The resolved absolute path.

precommit_run

util.precommit_run(args)

Run pre-commit run with the specified arguments.

Parameters

Name Type Description Default
args str The arguments to pass to the pre-commit command. required

Returns

Name Type Description
subprocess.CompletedProcess: The result of the shell command execution.

print_citation

util.print_citation(context, param, value)

Print the package citation in bibtex format and exit.

Parameters

Name Type Description Default
context Click context object. required
param Click parameter metadata for the option callback. required
value bool Whether the citation flag was provided. required

repo_base

util.repo_base(*paths)

Get the absolute path to a file in the repository

Parameters

Name Type Description Default
*paths str Additional paths to join with the base path. ()

Returns

Name Type Description
path str The absolute path to the file in the repository.