util

util

Utility helpers for the syncweaver package.

Functions

Name Description
get_version Return the installed package version.
print_citation Print the project citation and exit when the citation flag is enabled.
repo_base Return an absolute path rooted at the syncweaver package directory.

get_version

util.get_version()

Return the installed package version.

Reads from the VERSION file bundled with the package, falling back to importlib.metadata if unavailable.

Returns

Name Type Description
str str Version string.

Examples

>>> get_version()

print_citation

util.print_citation(context, param, value)

Print the project citation and exit when the citation flag is enabled.

Parameters

Name Type Description Default
context Click context. required
param Click option parameter (unused callback argument). required
value Citation flag value. required

Returns

Name Type Description
None None Always returns None.

Examples

>>> # Used as a Click callback and not called directly.

repo_base

util.repo_base(*paths)

Return an absolute path rooted at the syncweaver package directory.

Parameters

Name Type Description Default
*paths str Additional path segments to join. ()

Returns

Name Type Description
pathlib.Path pathlib.Path: Resolved path.

Examples

>>> repo_base("CITATION.cff")