ctl.plugins.changelog
Plugin that allows you manage CHANGELOG.(md|yaml|json) files
Functions
temporary_plugin
def temporary_plugin(ctl, name, **config)
instantiate an impromptu changelog plugin instance
Arguments
- ctl: ctl instance
- name: instance name
Keyword Arguments
Any keyword arguments will be passed on to plugin config
Returns
ChangeLogPlugin
instance
Classes
ChangeLogPlugin
ChangeLogPlugin(ctl.plugins.ExecutablePlugin)
manage changelog files
Class Attributes
- ConfigSchema (
ConfigSchema Class
): Base plugin config schema
Methods
datafile_to_md
def datafile_to_md(self, changelog_filepath)
Will attempt to generate md formatted changelog string from changelog data file
We are using munge so any codec that munge supports can be used (default=yaml)
Arguments
- changelog_filepath (
str
): filepath to your CHANGELOG.yaml file
Returns
str
: md formatted changelog
execute
def execute(self, **kwargs)
Execute the plugin's main action
Will automatically call prepare
Keyword Arguments
Any keyword arguments passed to this function will
be stored in the plugin's kwargs
attribute
generate
def generate(self, md_file, data_file, **kwargs)
Generates a changelog markdown filefrom a CHANGELOG.(yaml|json) file that follows the 20c changelog format
Arguments
- md_file (
str
): file path to a CHANGELOG.md file this is where the output will be written to - data_file (
str
): file path to a CHANGELOG.(yaml|json) file
Keyword Arguments
- print (
bool=False
): if True print the generated changelog to stdout instead of writing to a file
Exposed to CLI
namespace: ctl.{plugin_name}.generate
generate_clean
def generate_clean(self, data_file, **kwargs)
Will generate a clean CHANGELOG.(yaml|json) file with
just an unreleased
section in it.
Will fail if a file already exists
Arguments
- data_file (
str
): file path to a CHANGELOG.(yaml|json) file this is where the output will be written to
Exposed to CLI
namespace: ctl.{plugin_name}.generate_clean
generate_datafile
def generate_datafile(self, md_file, data_file, **kwargs)
Generates a changelog data file (yaml, json etc.) from a CHANGELOG.md file that follows the 20c changelog format.
Arguments
- md_file (
str
): file path to a CHANGELOG.md file - data_file (
str
): file path to a CHANGELOG.(yaml|json) file this is where the output will be written to
Keyword Arguments
- print (
bool=False
): if True print the generated changelog to stdout instead of writing to a file
Exposed to CLI
namespace: ctl.{plugin_name}.generate_datafile
md_to_dict
def md_to_dict(self, changelog_filepath)
will attempt to generate a dict from an existing CHANGELOG.md file
Arguments
- changelog_filepath (
str
): filepath to the CHANGELOG.md file
Returns
changelog dict
release
def release(self, version, data_file, **kwargs)
Adds the specified release to the changelog.
This will validate and move all items under "unreleased" to a new section for the specified release version
Arguments
- version (
str
): version mame (eg. tag name) - data_file (
str
): file path to a CHANGELOG.(yaml|json) file
Exposed to CLI
namespace: ctl.{plugin_name}.release
validate
def validate(self, data_file, version)
Checks if the specified release version exists in the changelog
and will raise a ChangelogVersionMissing
Exception when it
does not
Arguments
- data_file (
str
): file path to a CHANGELOG.(yaml|json) file - version (
str
)
version_exists
def version_exists(self, data_file, version)
Checks if the specified release exists in the changelog
Arguments
- data_file (
str
): file path to a CHANGELOG.(yaml|json) file - version (
str
)
Returns
True
if release exists, False
if not
ChangeLogPluginConfig
ChangeLogPluginConfig(confu.schema.core.Schema)
Config schema for the ChangeLogPlugin plugin
Class Attributes
- data_file (
Str
): path to a changelog data file - md_file (
Str
): path to a changelog markdown file
ChangelogVersionMissing
ChangelogVersionMissing(builtins.KeyError)
Raised when a changlog data file is validated to contain a specific version but that version is missing
Methods
__init__
def __init__(self, data_file, version)
Arguments
- data_file (
str
): file path to a CHANGELOG.(yaml|json) file - version (
str
)