# KPN'S COMMITIZEN
[![PyPI Package latest release](https://img.shields.io/pypi/v/cz-kpn.svg?style=flat-square)](https://pypi.org/project/cz-kpn/)
[![PyPI Package download count (per month)](https://img.shields.io/pypi/dm/cz-kpn?style=flat-square)](https://pypi.org/project/cz-kpn/)
![Docker Image Version (latest by date)](https://img.shields.io/docker/v/kpnnl/cz-kpn?label=latest%20version)
![Example commit](docs/images/commit.gif)
## About
Plugin for [python's commitizen](https://commitizen-tools.github.io/commitizen/),
which uses KPN commit rules to bump versions, update files and generate changelogs.
## KPN Rules summary
### Schema
```bash
<PREFIX> <SUBJECT> (#<ISSUE_ID>)
<LONG_DESCRIPTION>
```
| Prefix | SemVer relation | Description |
| ------- | --------------- | ------------------------------------------------------------------ |
| `FIX` | `PATCH` | Backwards compatible change that fixes something |
| `OPT` | `PATCH` | Other changes like refactors, docs, which are backwards compatible |
| `NEW` | `MINOR` | New functionality |
| `BREAK` | `MAJOR` | Breaking changes |
### Example
```
NEW: Add login screen (#MY-123)
```
[MORE INFO](./src/cz_kpn/cz_kpn_info.txt)
## Installation
Install globally in your system
```bash
python -m pip install --user cz-kpn
```
Or add `cz-kpn` to your project:
```sh
poetry add cz-kpn --group dev
```
## Quickstart
### Initialize cz-kpn in your project
Answer the questions appearing in:
```sh
cz init
```
### Bumping and changelog
Just run:
```sh
cz bump
```
### Commiting
```sh
cz commit
```
or the shortcut
```sh
cz c
```
### With docker
```sh
cmd="cz -n cz_kpn commit"
docker run --rm -it -v $(pwd):/app kpnnl/cz-kpn:3.2.10 $cmd
```
## Features
### Client tool to assist in the creation of a commit
![Example commit](docs/images/commit.gif)]
note: gif is outdated
This command is useful for newcomers, or when you don't remember the meaning
of each change type.
It will display a prompt which will guide the user in the commit creation.
```bash
cz commit
```
```bash
git cz commit
```
### Automatic version bump
Automatic version bump with changelog generation.
```bash
cz bump --changelog
```
Note: The `--changelog` flag is not required if `update_changelog_on_bump = true`
![Example bump](docs/images/bump.gif)
### Automatic changelog generation
If you don't want to generate a tag and bump the version, run:
```bash
cz changelog
```
This will create a changelog with unreleased commits, alternatively, you can run
```bash
cz changelog --incremental
```
to add only the missing changes.
This is useful if you have manually modified your changelog.
### Validate commit message
This command will tell you if there are any valid or invalid commit messages in
the given range.
You can also add it to `.pre-commit` hooks or manually as a git hook.
More info in [commitizen website](https://commitizen-tools.github.io/commitizen/check/).
```bash
cz check --rev-range ugnu348hg84hg84g..j8fj84g84h84hg83h2392
```
### Adding commit link to the changelog
Add to the configuration the `commit_url` parameter, using `$COMMIT_REV` as
variable, you can take a look at this project's [.cz.toml](.cz.toml) as an example
```toml
[tool.commitizen]
...
commit_url = "https://YOUR_DOMAIN/projects/YOUR_GROUP/repos/YOUR_PROJECT/commits/$COMMIT_REV"
```
## Configuration
The recommendation is to run `cz init` which will help you create the
right configuration and file.
You can also add manually to your `pyproject.toml` or create a `.cz.toml` file with:
```toml
[tool.commitizen]
name = "cz_kpn"
version = "<YOUR_CURRENT_VERSION>"
version_files = [
"src/__version__.py"
]
slack_channel = "ddci-notifications"
```
## Help
```bash
cz --help
```
Contents:
```bash
$ cz --help
Commitizen is a cli tool to generate conventional commits.
For more information about the topic go to https://conventionalcommits.org/
options:
-h, --help show this help message and exit
--debug use debug mode
-n NAME, --name NAME use the given commitizen (default: cz_conventional_commits)
-nr NO_RAISE, --no-raise NO_RAISE
comma separated error codes that won't rise error, e.g: cz -nr 1,2,3 bump. See codes at
https://commitizen-tools.github.io/commitizen/exit_codes/
commands:
{init,commit,c,ls,example,info,schema,bump,changelog,ch,check,version}
init init commitizen configuration
commit (c) create new commit
ls show available commitizens
example show commit example
info show information about the cz
schema show commit schema
bump bump semantic version based on the git log
changelog (ch) generate changelog (note that it will overwrite existing file)
check validates that a commit message matches the commitizen schema
version get the version of the installed commitizen or the current project (default: installed commitizen)
```
## Contributing
Read [Contributing guide](./CONTIRBUTING.md)
## Using in a github action
```yaml
name: Bump version and generate changelog
on:
push:
branches:
- main
jobs:
bump-version:
if: "!startsWith(github.event.head_commit.message, 'BUMP:')"
runs-on: ubuntu-latest
name: "Bump version and create changelog with commitizen"
steps:
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Create bump and changelog
uses: commitizen-tools/commitizen-action@master
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
changelog_increment_filename: body.md
extra_requirements: "cz-kpn"
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: "body.md"
tag_name: ${{ env.REVISION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
Read more in [commitizen docs](https://commitizen-tools.github.io/commitizen/tutorials/github_actions/)
Raw data
{
"_id": null,
"home_page": "https://github.com/kpn/cz-kpn",
"name": "cz-kpn",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "commitizen, release-management, autorelease",
"author": "Santiago Fraire Willemoes",
"author_email": "santiago.fraire@kpn.com",
"download_url": "https://files.pythonhosted.org/packages/97/a8/e25ca94c5a917fa5c7b83322bd2ee4b0096cfcffe39b0a27e0b44581e4aa/cz_kpn-3.2.10.tar.gz",
"platform": null,
"description": "# KPN'S COMMITIZEN\n\n[![PyPI Package latest release](https://img.shields.io/pypi/v/cz-kpn.svg?style=flat-square)](https://pypi.org/project/cz-kpn/)\n[![PyPI Package download count (per month)](https://img.shields.io/pypi/dm/cz-kpn?style=flat-square)](https://pypi.org/project/cz-kpn/)\n![Docker Image Version (latest by date)](https://img.shields.io/docker/v/kpnnl/cz-kpn?label=latest%20version)\n\n![Example commit](docs/images/commit.gif)\n\n## About\n\nPlugin for [python's commitizen](https://commitizen-tools.github.io/commitizen/),\nwhich uses KPN commit rules to bump versions, update files and generate changelogs.\n\n## KPN Rules summary\n\n### Schema\n\n```bash\n<PREFIX> <SUBJECT> (#<ISSUE_ID>)\n\n<LONG_DESCRIPTION>\n```\n\n| Prefix | SemVer relation | Description |\n| ------- | --------------- | ------------------------------------------------------------------ |\n| `FIX` | `PATCH` | Backwards compatible change that fixes something |\n| `OPT` | `PATCH` | Other changes like refactors, docs, which are backwards compatible |\n| `NEW` | `MINOR` | New functionality |\n| `BREAK` | `MAJOR` | Breaking changes |\n\n### Example\n\n```\nNEW: Add login screen (#MY-123)\n```\n\n[MORE INFO](./src/cz_kpn/cz_kpn_info.txt)\n\n## Installation\n\nInstall globally in your system\n\n```bash\npython -m pip install --user cz-kpn\n```\n\nOr add `cz-kpn` to your project:\n\n```sh\npoetry add cz-kpn --group dev\n```\n\n## Quickstart\n\n### Initialize cz-kpn in your project\n\nAnswer the questions appearing in:\n\n```sh\ncz init\n```\n\n### Bumping and changelog\n\nJust run:\n\n```sh\ncz bump\n```\n\n### Commiting\n\n```sh\ncz commit\n```\n\nor the shortcut\n\n```sh\ncz c\n```\n\n### With docker\n\n```sh\ncmd=\"cz -n cz_kpn commit\"\ndocker run --rm -it -v $(pwd):/app kpnnl/cz-kpn:3.2.10 $cmd\n```\n\n## Features\n\n### Client tool to assist in the creation of a commit\n\n![Example commit](docs/images/commit.gif)]\n\nnote: gif is outdated\n\nThis command is useful for newcomers, or when you don't remember the meaning\nof each change type.\nIt will display a prompt which will guide the user in the commit creation.\n\n```bash\ncz commit\n```\n\n```bash\ngit cz commit\n```\n\n### Automatic version bump\n\nAutomatic version bump with changelog generation.\n\n```bash\ncz bump --changelog\n```\n\nNote: The `--changelog` flag is not required if `update_changelog_on_bump = true`\n\n![Example bump](docs/images/bump.gif)\n\n### Automatic changelog generation\n\nIf you don't want to generate a tag and bump the version, run:\n\n```bash\ncz changelog\n```\n\nThis will create a changelog with unreleased commits, alternatively, you can run\n\n```bash\ncz changelog --incremental\n```\n\nto add only the missing changes.\nThis is useful if you have manually modified your changelog.\n\n### Validate commit message\n\nThis command will tell you if there are any valid or invalid commit messages in\nthe given range.\n\nYou can also add it to `.pre-commit` hooks or manually as a git hook.\n\nMore info in [commitizen website](https://commitizen-tools.github.io/commitizen/check/).\n\n```bash\ncz check --rev-range ugnu348hg84hg84g..j8fj84g84h84hg83h2392\n```\n\n### Adding commit link to the changelog\n\nAdd to the configuration the `commit_url` parameter, using `$COMMIT_REV` as\nvariable, you can take a look at this project's [.cz.toml](.cz.toml) as an example\n\n```toml\n[tool.commitizen]\n...\ncommit_url = \"https://YOUR_DOMAIN/projects/YOUR_GROUP/repos/YOUR_PROJECT/commits/$COMMIT_REV\"\n```\n\n## Configuration\n\nThe recommendation is to run `cz init` which will help you create the\nright configuration and file.\n\nYou can also add manually to your `pyproject.toml` or create a `.cz.toml` file with:\n\n```toml\n[tool.commitizen]\nname = \"cz_kpn\"\nversion = \"<YOUR_CURRENT_VERSION>\"\nversion_files = [\n \"src/__version__.py\"\n]\nslack_channel = \"ddci-notifications\"\n```\n\n## Help\n\n```bash\ncz --help\n```\n\nContents:\n\n```bash\n$ cz --help\nCommitizen is a cli tool to generate conventional commits.\nFor more information about the topic go to https://conventionalcommits.org/\n\noptions:\n -h, --help show this help message and exit\n --debug use debug mode\n -n NAME, --name NAME use the given commitizen (default: cz_conventional_commits)\n -nr NO_RAISE, --no-raise NO_RAISE\n comma separated error codes that won't rise error, e.g: cz -nr 1,2,3 bump. See codes at\n https://commitizen-tools.github.io/commitizen/exit_codes/\n\ncommands:\n {init,commit,c,ls,example,info,schema,bump,changelog,ch,check,version}\n init init commitizen configuration\n commit (c) create new commit\n ls show available commitizens\n example show commit example\n info show information about the cz\n schema show commit schema\n bump bump semantic version based on the git log\n changelog (ch) generate changelog (note that it will overwrite existing file)\n check validates that a commit message matches the commitizen schema\n version get the version of the installed commitizen or the current project (default: installed commitizen)\n```\n\n## Contributing\n\nRead [Contributing guide](./CONTIRBUTING.md)\n\n## Using in a github action\n\n```yaml\nname: Bump version and generate changelog\n\non:\n push:\n branches:\n - main\n\njobs:\n bump-version:\n if: \"!startsWith(github.event.head_commit.message, 'BUMP:')\"\n runs-on: ubuntu-latest\n name: \"Bump version and create changelog with commitizen\"\n steps:\n - name: Check out\n uses: actions/checkout@v3\n with:\n fetch-depth: 0\n token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}\n - name: Create bump and changelog\n uses: commitizen-tools/commitizen-action@master\n with:\n github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}\n changelog_increment_filename: body.md\n extra_requirements: \"cz-kpn\"\n - name: Release\n uses: softprops/action-gh-release@v1\n with:\n body_path: \"body.md\"\n tag_name: ${{ env.REVISION }}\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n\nRead more in [commitizen docs](https://commitizen-tools.github.io/commitizen/tutorials/github_actions/)\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "commitizen with kpn style",
"version": "3.2.10",
"project_urls": {
"Homepage": "https://github.com/kpn/cz-kpn",
"Repository": "https://github.com/kpn/cz-kpn"
},
"split_keywords": [
"commitizen",
" release-management",
" autorelease"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7a7f8a0175aa05ada695ce071431e09456e0f4a5df924b5d61afd8f0bda59d76",
"md5": "b5f00aa79fc2350b9b9586f32895ae6a",
"sha256": "e7f9ac62de2d90dee52f214d1c31e95c9215394c6570026d35575d82422e4ec6"
},
"downloads": -1,
"filename": "cz_kpn-3.2.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b5f00aa79fc2350b9b9586f32895ae6a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 804377,
"upload_time": "2024-09-12T07:27:17",
"upload_time_iso_8601": "2024-09-12T07:27:17.534229Z",
"url": "https://files.pythonhosted.org/packages/7a/7f/8a0175aa05ada695ce071431e09456e0f4a5df924b5d61afd8f0bda59d76/cz_kpn-3.2.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "97a8e25ca94c5a917fa5c7b83322bd2ee4b0096cfcffe39b0a27e0b44581e4aa",
"md5": "6c45165e7e0715c69a3df8e75a8e55be",
"sha256": "dec7485695320f9df1bf03fe4387af8d7fd0ea95abe11d59ee93e80834275619"
},
"downloads": -1,
"filename": "cz_kpn-3.2.10.tar.gz",
"has_sig": false,
"md5_digest": "6c45165e7e0715c69a3df8e75a8e55be",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 806590,
"upload_time": "2024-09-12T07:27:18",
"upload_time_iso_8601": "2024-09-12T07:27:18.901982Z",
"url": "https://files.pythonhosted.org/packages/97/a8/e25ca94c5a917fa5c7b83322bd2ee4b0096cfcffe39b0a27e0b44581e4aa/cz_kpn-3.2.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-12 07:27:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kpn",
"github_project": "cz-kpn",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cz-kpn"
}