No project description provided
Project description
changelog-cmd
Tool for managing a changelog in the style of Keep a Changelog.
Features:
- Write new changelog entries in a consistent manner
- Validate and format your changelog
- Suggest semantic version of releases based on their contents
- Write scripts which make automated changes and updates to changelogs, whilst keeping the changelog in a human-readable format
Installation
Requires Python 3.9 or higher.
pip install changelog-cmd
Usage
Starting a changelog
Create a changelog named CHANGELOG.md
in the current directory by running
changelog init --release-link-format=RELEASE_LINK_FORMAT
Where the --release-link-format
option specifies how to generate links to a given release, and is given using a Python string format specifier. For example, if you want to link to source on GitHub, this format specifier might be:
https://github.com/user/repo/tree/{tag}
- the source code at this releasehttps://github.com/user/repo/compare/{previous_tag}...{tag}
- a comparison of this release with the one before
Or if you want to link to PyPi, the format might be:
https://pypi.org/project/package/{tag}/
Above you see the two variables available for substitution:
tag
is the tag of the releaseprevious_tag
is the tag of the previous release
Finding the changelog
By default, changelog
looks for a changelog called CHANGELOG.md
in the current directory. You can override this by passing a command-line option:
changelog --path path/to/changelog.md ...
Or you can set an environment variable:
CHANGELOG_PATH=path/to/changelog.md ...
The command-line option takes precedence.
Adding entries to a changelog
Add an entry to the unreleased section of a changelog:
changelog entry added --message "Description of my change"
You can replace added
in the above with any of the following types of entry:
added
changed
deprecated
fixed
removed
security
To specify a change as breaking, simply include the --breaking
flag:
changelog entry changed --message "Description of a breaking change" --breaking
If you need to add a missing entry to a past release, you can specify the release tag explicitly:
changelog entry fixed --message "Description of a fix" --tag "0.1.1"
Cutting a release
When you are ready to cut a release, run the following:
changelog release
This will identify the correct semantic version. Alternatively, you can specify the semantic version bump yourself:
changelog release --bump "major"
Or, if you don't use semantic versioning at all, simply specify the tag of the release:
changelog release --tag "2021.r3"
Formatting and validation
Using this tool should not preclude manual editing of a changelog. To ensure that manual changes don't break conventions, you can use the following two commands in your development workflow:
Simply check that the changelog is still in a recognisable format:
changelog validate
Format the changelog in a standard manner:
changelog format
Changelog configuration
This tool stores configuration in the changelog itself. The currently available config fields are:
release_link_format
specifies the format for release linksbreaking_change_token
specifies the token for breaking changes
Check the value of a config field via:
changelog config get --field CONFIG_FIELD
And set it via
changelog config set --field CONFIG_FIELD --value VALUE
Development
Install dependencies:
pyenv shell 3.9.4 # Or other 3.9.x
pre-commit install # Configure commit hooks
poetry install # Install Python dependencies
Run tests:
poetry run inv verify
Future improvements
The following is a list of possible future improvements for this tool:
- Support a release-per-change workflow (every change is tagged as a new release)
- Support configuration of of change types beyond those specified by Keep a Changelog
- Extensions to help interaction with
git
, e.g. merge conflict resolution and/or validation.
License
This project is distributed under the MIT license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file changelog-cmd-0.2.0.tar.gz
.
File metadata
- Download URL: changelog-cmd-0.2.0.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.8 CPython/3.9.4 Linux/5.8.0-63-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbd164b6520dd5e486cf7cf7cfb2f6b23a9d5a007e6cd4618a2248bae67174c9 |
|
MD5 | 2ab59ec70fd9a4692808f651fa3b4129 |
|
BLAKE2b-256 | ee5c19b2db5ef60710580334e253f10ebc4be390d07ff0ee77a8e971a6476b99 |
File details
Details for the file changelog_cmd-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: changelog_cmd-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.8 CPython/3.9.4 Linux/5.8.0-63-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f6e71314b16919a9c26fb2903a3bf60c351fb5342820bda0ae5c5db046be46e |
|
MD5 | 941536ed70df996a44ab691efd104267 |
|
BLAKE2b-256 | e7ee501348ebf9629fb4411322579e035225dc63232076bdbde16c25cbdc5918 |