zensols.relpo package¶
Submodules¶
zensols.relpo.app module¶
A Python project release with Git integration.
- class zensols.relpo.app.Application(config_files, temporary_dir)[source]¶
Bases:
objectThe application client class to the command line.
- __init__(config_files, temporary_dir)¶
-
config_files:
Path¶ The
relpo.ymlconfiguration file used for substitution.
- meta(out=None, format=None)[source]¶
Print or write the project metadata.
- Parameters:
out (
Path) – the output file or dump to standard out if not providedformat (
str) – the output format
- mkdoc(out=None)[source]¶
Create the site documentation.
- Parameters:
out (
Path) – the directory to output the documentation
- mkenvdist(out=None)[source]¶
Create the environment distribution file.
- Parameters:
out (
Path) – the output distribution file
- mktag(message)[source]¶
Create a tag using the last change log entry’s version.
- Parameters:
message (
str) – the message (comment-like) of the tag
- pyproject(out=None)[source]¶
Write the
pyproject.tomlfile.- Parameters:
out (
Path) – the output file or dump to standard out if not provided
-
temporary_dir:
Path¶ Temporary space for files.
zensols.relpo.cli module¶
Command line entry point to the application.
- zensols.relpo.cli.invoke(action=None, version=False, level='[warn|info|debug]', config='relpo.yml', tmp=PosixPath('temp'), out='<path>', format='<json|yaml>', message='<comment>')[source]¶
Python project release with Git integration.
- actions:
config output the synthesized build configuration meta [-o, -f] output the project metadata pyproject write the pyproject.toml file mktag [-m] create a new tag using the last change log rmtag remove the most recent tag bumptag move the latest tag to the last commit template render standard in with: date, project, config check check for any issues with creating a release mkdoc [-o] create site documentation mkenvdist [-o] create the environment distribution
zensols.relpo.doc module¶
Classes that are used to write site documentation.
- class zensols.relpo.doc.DocConfig(data, stage_dir, config_template_dir, apidoc_template_dir, apidoc_output_dir, python_home, api_config, copy)[source]¶
Bases:
ConfigConfiguration for API doc generation.
- __init__(data, stage_dir, config_template_dir, apidoc_template_dir, apidoc_output_dir, python_home, api_config, copy)¶
-
apidoc_output_dir:
Path¶ The
sphinx-apioutput directory.
-
apidoc_template_dir:
Path¶ The directory used by
sphinx-apito generate Sphinx RST files. This is the output directory of theconfig_template_dirconfig files.
-
config_template_dir:
Path¶ The template directory to create the Sphinx API config files.
-
python_home:
Path¶ Sphinx Python environment.
-
stage_dir:
Path¶ Where temporary files are created used by Sphinx.
- class zensols.relpo.doc.Documentor(config, template_params, temporary_dir, output_dir)[source]¶
Bases:
objectThis class creates files used by
sphinx-apiandsphinx-buildto create a package API documentation. First rendered (from Jinja2 templates) Sphinx configuration (i.e..rstfiles) and static files are written to a source directory. Then Sphinx is given the source directory to generate the API documentation.- __init__(config, template_params, temporary_dir, output_dir)¶
-
output_dir:
Path¶ Where to output the generated site.
-
template_params:
Dict[str,Any]¶ The context given to Jinja2 as
Projectused to render the Sphinx API docs.
-
temporary_dir:
Path¶ Temporary space for files.
zensols.relpo.domain module¶
Application domain classes.
- class zensols.relpo.domain.ChangeLog(path)[source]¶
Bases:
FlattenableParses the keepchangelog
CHANGELOG.md(markdown) format.- __init__(path)¶
- property entries: Tuple[ChangeLogEntry, ...]¶
-
path:
Path¶ The path to the change log markdown formatted file.
- property today: ChangeLogEntry | None¶
only today’s changelog entry if there is one for today.
- class zensols.relpo.domain.ChangeLogEntry(version, date)[source]¶
Bases:
EntryA ChangeLog entry.
- __init__(version, date)¶
- class zensols.relpo.domain.Commit(date, author, sha, summary)[source]¶
Bases:
FlattenableA Git commit.
- __init__(date, author, sha, summary)¶
- class zensols.relpo.domain.Config(data)[source]¶
Bases:
FlattenableA configuration container for sections of the
relpo.ymlfile.- __init__(data)¶
- class zensols.relpo.domain.Entry(version, date)[source]¶
Bases:
FlattenableBase class for things that have versions with dates.
- __init__(version, date)¶
- class zensols.relpo.domain.Flattenable[source]¶
Bases:
objectA class that that generates a dictionary recursively from data classes and primitive data structures.
- __init__()¶
- exception zensols.relpo.domain.ProjectRepoError[source]¶
Bases:
ExceptionRaised for project repository related errors.
- __firstlineno__ = 23¶
- __module__ = 'zensols.relpo.domain'¶
- __static_attributes__ = ()¶
- __weakref__¶
list of weak references to the object
- class zensols.relpo.domain.Release(tag, change_log_entry)[source]¶
Bases:
FlattenableA matching entry between a release tag the change log.
- __init__(tag, change_log_entry)¶
-
change_log_entry:
ChangeLogEntry¶
- class zensols.relpo.domain.Tag(version, date, name, sha, message)[source]¶
Bases:
EntryA git tag that was used for a previous release or a current release.
- __init__(version, date, name, sha, message)¶
- class zensols.relpo.domain.Version(major=0, minor=0, debug=1)[source]¶
Bases:
FlattenableA container class for a tag version. All tags have an implicit format by sorting in decimal format (i.e.
<major>.<minor>.<version>). This class contains methods that make it sortable.- __init__(major=0, minor=0, debug=1)¶
- static from_str(s)[source]¶
Create a version instance from a string formatted version.
- Return type:
- Returns:
a new instance of
Version
- increment(decimal='debug', inc=1)[source]¶
Increment the version in the instance. By default the debug portion of the instance is incremented.
zensols.relpo.envdist module¶
Environment distribution file build.
- class zensols.relpo.envdist.Dependency(is_conda, source)[source]¶
Bases:
FlattenableA lock dependency.
- __init__(is_conda, source)¶
- property conda_platform: str | None¶
The platform of the conda dependency, or
Noneif not a conda dependnecy.
- property is_file: bool¶
Whether or not the dependency is a project local file. This is not to be confused with a cached file downloaded to the local file system.
- property local_file: Path¶
The downloaded and cached file on the local file system.
- See:
file
- class zensols.relpo.envdist.Environment(name, platforms)[source]¶
Bases:
FlattenableA pixi environment.
- __init__(name, platforms)¶
- class zensols.relpo.envdist.EnvironmentDistBuilder(config, template_params, temporary_dir, output_file, progress)[source]¶
Bases:
FlattenableThis class creates files used by
sphinx-apiandsphinx-buildto create a package API documentation. First rendered (from Jinja2 templates) Sphinx configuration (i.e..rstfiles) and static files are written to a source directory. Then Sphinx is given the source directory to generate the API documentation.- __init__(config, template_params, temporary_dir, output_file, progress)¶
-
config:
EnvironmentDistConfig¶ The parsed document generation configuration.
-
output_file:
Path¶ Where to output the environment distribution file.
-
template_params:
Dict[str,Any]¶ The context given to Jinja2 as
Projectused to render any configuration files or install scripts.
-
temporary_dir:
Path¶ Temporary space for files.
- class zensols.relpo.envdist.EnvironmentDistConfig(data, cache_dir, pixi_lock_file, environment, platforms, injects)[source]¶
Bases:
ConfigConfiguration for API doc generation.
- __init__(data, cache_dir, pixi_lock_file, environment, platforms, injects)¶
-
cache_dir:
Path¶ The directory to cache conda and PyPi library files.
-
pixi_lock_file:
Path¶ The pixi lock file (
pixi.lock).
- class zensols.relpo.envdist.Platform(name, dependencies)[source]¶
Bases:
FlattenableA parsed platform from the Pixi lock file.
- __init__(name, dependencies)¶
-
dependencies:
List[Dependency]¶ The platform dependnecies
zensols.relpo.project module¶
A utility class that represents a Git tag.
- class zensols.relpo.project.Project(config_files, temporary_dir)[source]¶
Bases:
FlattenableThe project and related data of a Python source code repository.
- __init__(config_files, temporary_dir)¶
- property config: ProjectConfig¶
The project config used to populate templates. This is the parsed data from all configuration files (
config_files).
- property pyproject: str¶
The
pyproject.tomlrendered content as a string.- Parameters:
template_dir – the directory to the zenbuild toml template files
- read_config()[source]¶
Return the parsed
config_fileswith each configuration file as an element of the returned list.
- property repo: ProjectRepo¶
The Git repository and its metadata.
-
temporary_dir:
Path¶ Temporary space for files.
- class zensols.relpo.project.ProjectConfig(data, proj_dir, template_dir, pyproject_template_files, table_appends, change_log_file_name)[source]¶
Bases:
ConfigThe
Projectconfiguration.- __init__(data, proj_dir, template_dir, pyproject_template_files, table_appends, change_log_file_name)¶
- property envdist_config: EnvironmentDistConfig¶
The environment distribution configuraiton.
-
proj_dir:
Path¶ The root Git repo directory.
-
pyproject_template_files:
Tuple[Path,...]¶ Additional template files used to render the
pyproject.tomlfile.
-
table_appends:
Dict[str,Any]¶ Table name/value TOML appends to add to the
pyproject.tomlfile. These entries have the TOML path as keys and the contents of an inline table to add as values.
-
template_dir:
Path¶ The directory with the
pyproject.tomlJinja2 template files.
zensols.relpo.repo module¶
Project and git repository classes.
- class zensols.relpo.repo.GitRemote(name, url)[source]¶
Bases:
FlattenableA Git remote created with a command such as:
``git remote add <name> <url>``
- __init__(name, url)¶
- class zensols.relpo.repo.ProjectRepo(repo_dir, commit_limit=20)[source]¶
Bases:
FlattenableA Python source code Git repository. It’s main use is determining the last tag in a sorted (by version) used to increment to the next version. However, it also creates tags and provides additional information about existing tags.
All tags have an implicit format by sorting in decimal format (i.e.
<major>.<minor>.<version>).- __init__(repo_dir, commit_limit=20)¶
- property git_repo: Repo¶
- increment_tag(message, version_increment_level='debug')[source]¶
Create a new tag incremented from the version of the latest commit.
-
repo_dir:
Path¶ The root Git repo directory.