Skip to content

Commit 33b69c3

Browse files
committed
docs: improve readability
1 parent 14820b1 commit 33b69c3

File tree

6 files changed

+191
-108
lines changed

6 files changed

+191
-108
lines changed

docs/commands/bump.md

Lines changed: 95 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -30,94 +30,6 @@ The version follows the `MAJOR.MINOR.PATCH` format, with increments determined b
3030
| `MINOR` | New features | `feat` |
3131
| `PATCH` | Fixes and improvements | `fix`, `perf`, `refactor`|
3232

33-
### `--version-scheme`
34-
35-
By default, Commitizen uses [PEP 440][pep440] for version formatting. You can switch to semantic versioning using either:
36-
37-
1. Command line:
38-
```sh
39-
cz bump --version-scheme semver
40-
```
41-
42-
2. Configuration file:
43-
```toml title="pyproject.toml"
44-
[tool.commitizen]
45-
version_scheme = "semver"
46-
```
47-
48-
Available options are:
49-
50-
- `pep440`: [PEP 440][pep440] (**default** and recommended for Python projects)
51-
- `semver`: [Semantic Versioning][semver] (recommended for non-Python projects)
52-
53-
You can also set this in the configuration file with `version_scheme = "semver"`.
54-
55-
!!! note
56-
[pep440][pep440] and [semver][semver] are quite similar, although their difference lies in
57-
how the prereleases look. For example, `0.3.1a0` in pep440 is equivalent to `0.3.1-a0` in semver.
58-
59-
The following table illustrates the difference between the two schemes:
60-
61-
| Version Type | pep440 | semver |
62-
|--------------|----------------|-----------------|
63-
| Non-prerelease | `0.1.0` | `0.1.0` |
64-
| Prerelease | `0.3.1a0` | `0.3.1-a0` |
65-
| Devrelease | `0.1.1.dev1` | `0.1.1-dev1` |
66-
| Dev and pre | `1.0.0a3.dev1` | `1.0.0-a3-dev1` |
67-
68-
69-
!!! note "Incomplete Version Handling"
70-
Commitizen treats a three-part version (major.minor.patch) as complete.
71-
If your configured version is incomplete (for example, `1` or `1.2`), Commitizen pads missing parts with zeros when it needs `major/minor/patch` for tag formatting.
72-
The tag output depends on your `tag_format`: formats using `${version}` keep `1`/`1.2`, while formats using `${major}.${minor}.${patch}` will render `1.0.0`/`1.2.0`.
73-
74-
When bumping from an incomplete version, Commitizen looks for the latest existing tag that matches the provided release prefix.
75-
For example, if the current version is `1.2` and the latest `1.2.x` tag is `1.2.3`, then a patch bump yields `1.2.4` and a minor bump yields `1.3.0`.
76-
77-
!!! tip
78-
To control the behaviour of bumping and version parsing, you may implement your own `version_scheme` by inheriting from `commitizen.version_schemes.BaseVersion` or use an existing plugin package.
79-
80-
81-
### PEP440 Version Examples
82-
83-
Commitizen supports the [PEP 440][pep440] version format, which includes several version types. Here are examples of each:
84-
85-
#### Standard Releases
86-
```text
87-
0.9.0 # Initial development release
88-
0.9.1 # Patch release
89-
0.9.2 # Another patch release
90-
0.9.10 # Tenth patch release
91-
0.9.11 # Eleventh patch release
92-
1.0.0 # First stable release
93-
1.0.1 # Patch release after stable
94-
1.1.0 # Minor feature release
95-
2.0.0 # Major version release
96-
```
97-
98-
#### Pre-releases
99-
```text
100-
1.0.0a0 # Alpha release 0
101-
1.0.0a1 # Alpha release 1
102-
1.0.0b0 # Beta release 0
103-
1.0.0rc0 # Release candidate 0
104-
1.0.0rc1 # Release candidate 1
105-
```
106-
107-
#### Development Releases
108-
```text
109-
1.0.0.dev0 # Development release 0
110-
1.0.0.dev1 # Development release 1
111-
```
112-
113-
#### Combined Pre-release and Development
114-
```text
115-
1.0.0a1.dev0 # Development release 0 of alpha 1
116-
1.0.0b2.dev1 # Development release 1 of beta 2
117-
```
118-
119-
> **Note**: `post` releases (e.g., `1.0.0.post1`) are not currently supported.
120-
12133
## Command line options
12234

12335
![cz bump --help](../images/cli_help/cz_bump___help.svg)
@@ -176,7 +88,7 @@ For example, if the current version is `1.0.0b1` then bumping with `--prerelease
17688
Applies the exact changes that have been specified with `--increment` or determined from the commit log.
17789
For example, `--prerelease beta` will always result in a `b` tag, and `--increment PATCH` will always increase the patch component.
17890

179-
#### Examples
91+
**Examples**
18092

18193
The following table illustrates the difference in behavior between the two modes:
18294

@@ -525,6 +437,100 @@ Automatically answers “yes” to all interactive prompts during the bump proce
525437
cz bump --yes
526438
```
527439

440+
### `--version-scheme`
441+
442+
Format used for the version.
443+
444+
**Available options**
445+
446+
- `pep440`: [PEP 440][pep440]: recommended for Python projects, **default** (for legacy reasons)
447+
- `semver2`: [Semantic Versioning v2][semver]: recommended for non-Python projects
448+
- `semver`: [Semantic Versioning v1](https://semver.org/spec/v1.0.0.html): use if you are stuck with semver v1
449+
450+
**Examples**
451+
452+
1. Command line:
453+
```sh
454+
cz bump --version-scheme semver2
455+
```
456+
457+
2. Configuration file:
458+
```toml title="pyproject.toml"
459+
[tool.commitizen]
460+
version_scheme = "semver2"
461+
```
462+
463+
464+
!!! note
465+
[pep440][pep440] and [semver][semver] are quite similar, although their difference lies in
466+
how the prereleases look. For example, `0.3.1a0` in pep440 is equivalent to `0.3.1-a0` in semver.
467+
468+
The following table illustrates the difference between the two schemes:
469+
470+
| Version Type | pep440 | semver |
471+
|--------------|----------------|-----------------|
472+
| Non-prerelease | `0.1.0` | `0.1.0` |
473+
| Prerelease | `0.3.1a0` | `0.3.1-a0` |
474+
| Devrelease | `0.1.1.dev1` | `0.1.1-dev1` |
475+
| Dev and pre | `1.0.0a3.dev1` | `1.0.0-a3-dev1` |
476+
477+
478+
!!! note "Incomplete Version Handling"
479+
Commitizen treats a three-part version (major.minor.patch) as complete.
480+
If your configured version is incomplete (for example, `1` or `1.2`), Commitizen pads missing parts with zeros when it needs `major/minor/patch` for tag formatting.
481+
The tag output depends on your `tag_format`: formats using `${version}` keep `1`/`1.2`, while formats using `${major}.${minor}.${patch}` will render `1.0.0`/`1.2.0`.
482+
483+
When bumping from an incomplete version, Commitizen looks for the latest existing tag that matches the provided release prefix.
484+
For example, if the current version is `1.2` and the latest `1.2.x` tag is `1.2.3`, then a patch bump yields `1.2.4` and a minor bump yields `1.3.0`.
485+
486+
!!! tip
487+
To control the behaviour of bumping and version parsing, you may implement your own `version_scheme` by inheriting from `commitizen.version_schemes.BaseVersion` or use an existing plugin package.
488+
489+
490+
### PEP440 Version Examples
491+
492+
Commitizen supports the [PEP 440][pep440] version format, which includes several version types. Here are examples of each:
493+
494+
#### Standard Releases
495+
496+
```text
497+
0.9.0 # Initial development release
498+
0.9.1 # Patch release
499+
0.9.2 # Another patch release
500+
0.9.10 # Tenth patch release
501+
0.9.11 # Eleventh patch release
502+
1.0.0 # First stable release
503+
1.0.1 # Patch release after stable
504+
1.1.0 # Minor feature release
505+
2.0.0 # Major version release
506+
```
507+
508+
#### Pre-releases
509+
510+
```text
511+
1.0.0a0 # Alpha release 0
512+
1.0.0a1 # Alpha release 1
513+
1.0.0b0 # Beta release 0
514+
1.0.0rc0 # Release candidate 0
515+
1.0.0rc1 # Release candidate 1
516+
```
517+
518+
#### Development Releases
519+
520+
```text
521+
1.0.0.dev0 # Development release 0
522+
1.0.0.dev1 # Development release 1
523+
```
524+
525+
#### Combined Pre-release and Development
526+
527+
```text
528+
1.0.0a1.dev0 # Development release 0 of alpha 1
529+
1.0.0b2.dev1 # Development release 1 of beta 2
530+
```
531+
532+
> **Note**: `post` releases (e.g., `1.0.0.post1`) are not currently supported.
533+
528534
[pep440]: https://www.python.org/dev/peps/pep-0440/
529535
[semver]: https://semver.org/
530536
[version_files]: ../config/bump.md#version_files

docs/commands/changelog.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,28 +77,36 @@ cz changelog --extra key=value -e short="quoted value"
7777

7878
### `--file-name`
7979

80-
This value can be updated in the configuration file with the key `changelog_file` under `tool.commitizen`.
81-
8280
Specify the name of the output file. Note that changelog generation only works with Markdown files.
8381

8482
```bash
8583
cz changelog --file-name="CHANGES.md"
8684
```
8785

86+
This value can be updated in the configuration file with the key `changelog_file` under `tool.commitizen`.
87+
88+
```toml
89+
[tool.commitizen]
90+
# ...
91+
changelog_file = "CHANGES.md"
92+
```
93+
8894
### `--incremental`
8995

90-
This flag can be set in the configuration file with the key `changelog_incremental` under `tool.commitizen`
96+
Build from the latest version found in changelog.
9197

9298
Benefits:
9399

94-
- Build from the latest version found in changelog. This is useful if you have an existing changelog and want to use commitizen to extend it.
100+
- Useful if you have an existing changelog and want to use commitizen to extend it.
95101
- Update unreleased area
96102
- Allows users to manually edit the changelog without it being completely rewritten.
97103

98104
```bash
99105
cz changelog --incremental
100106
```
101107

108+
This flag can be set in the configuration file with the key `changelog_incremental` under `tool.commitizen`.
109+
102110
```toml
103111
[tool.commitizen]
104112
# ...
@@ -107,14 +115,14 @@ changelog_incremental = true
107115

108116
### `--start-rev`
109117

110-
This value can be set in the configuration file with the key `changelog_start_rev` under `tool.commitizen`
111-
112118
Start from a given git rev to generate the changelog. Commits before that rev will not be considered. This is especially useful for long-running projects adopting conventional commits, where old commit messages might fail to be parsed for changelog generation.
113119

114120
```bash
115121
cz changelog --start-rev="v0.2.0"
116122
```
117123

124+
This value can be set in the configuration file with the key `changelog_start_rev` under `tool.commitizen`
125+
118126
```toml
119127
[tool.commitizen]
120128
# ...
@@ -123,14 +131,14 @@ changelog_start_rev = "v0.2.0"
123131

124132
### `--merge-prerelease`
125133

126-
This flag can be set in the configuration file with the key `changelog_merge_prerelease` under `tool.commitizen`
127-
128134
Collects changes from prereleases into the next non-prerelease version. If you have a prerelease version followed by a normal release, the changelog will show the prerelease changes as part of the normal release. If not set, prereleases will be included as separate entries in the changelog.
129135

130136
```bash
131137
cz changelog --merge-prerelease
132138
```
133139

140+
This flag can be set in the configuration file with the key `changelog_merge_prerelease` under `tool.commitizen`
141+
134142
```toml
135143
[tool.commitizen]
136144
# ...

docs/config/bump.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,47 @@ version_files = [
212212
!!! note "Historical note"
213213
This option was renamed from `files` to `version_files`.
214214

215+
## `version_provider`
216+
217+
Mechanism by which Commitizen reads and writes version information in your project.
218+
219+
For a detailed explanation, check the [version provider](./version_provider.md) section.
220+
Which includes, how to create your own version provider.
221+
222+
**Available options**
223+
224+
- `commitizen`: default version provider and stores the version in the active commitizen config (`pyproject.toml` or `.cz.toml`) under the key `version`
225+
- `scm`: git tags provide the real version to commitizen (read only)
226+
- `pep621`: (python) manages version in `pyproject.toml` under the `project.version` field, following [PEP 621](https://peps.python.org/pep-0621/) standards
227+
- `poetry`: takes the version from poetry v1, use `pep621` with poetry v2 or later
228+
- `uv`: same as `pep621` except that it also updates the `uv.lock`
229+
- `cargo`: manages version in both `Cargo.toml` (`package.version`) and `Cargo.lock`
230+
- `npm`: manages version in `package.json` and the lock
231+
- `composer`: for PHP's Composer package manager
232+
233+
**Example**
234+
235+
```toml
236+
[tool.commitizen]
237+
version_provider = "pep621"
238+
```
239+
215240
## `version_scheme`
216241

217-
See [`--version-scheme`](../commands/bump.md#-version-scheme).
242+
Format used for the version.
243+
244+
For a detail explanation, check [`--version-scheme`](../commands/bump.md#-version-scheme).
245+
246+
**Available options**
247+
248+
- `pep440`: [PEP 440](https://www.python.org/dev/peps/pep-0440/): recommended for Python projects, **default** (for legacy reasons)
249+
- `semver2`: [Semantic Versioning](https://semver.org/): recommended for non-Python projects
250+
- `semver`: [Semantic Versioning](https://semver.org/spec/v1.0.0.html): use if you are stuck with semver v1
251+
252+
**Example**
253+
254+
255+
```toml
256+
[tool.commitizen]
257+
version_scheme = "semver2"
258+
```

docs/config/option.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,57 @@
1-
# Misc Options
1+
# General Options
22

33
## `name`
44

5+
Name of the committing rules to use. What we generally call the **commit conventions**.
6+
57
- Type: `str`
68
- Default: `"cz_conventional_commits"`
9+
- Options
10+
- `cz_conventional_commits`: uses [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)
11+
- `cz_jira`: jira [smart commits](https://support.atlassian.com/bitbucket-cloud/docs/use-smart-commits/)
12+
- `cz_customize`: (**not recommended**) customize the convention directly in the `TOML` file under `[tool.commitizen.customize]`, read [Customize in configuration file](../customization/config_file.md) for more. There's a plan to provide a different functionality.
713

8-
Name of the committing rules to use.
14+
You can write your own convention, and release it on PyPI, check [Customizing through a Python class](../customization/python_class.md).
915

1016
## `version`
1117

18+
Current version.
19+
20+
Required if you use `version_provider = "commitizen"`.
21+
1222
- Type: `str`
1323
- Default: `None`
1424

15-
Current version. Example: `"0.1.2"`. Required if you use `version_provider = "commitizen"`.
25+
Example: `"0.1.2"`.
1626

1727
## `style`
1828

29+
Style for the prompts.
30+
1931
- Type: `list`
2032
- Default: `[]`
2133

22-
Style for the prompts (It will merge this value with default style.) See [Styling your prompts with your favorite colors](https://github.com/tmbo/questionary#additional-features) for more details.
34+
It will merge this value with default style. See [Styling your prompts with your favorite colors](https://github.com/tmbo/questionary#additional-features) for more details.
2335

2436
## `customize`
2537

38+
Custom rules for committing and bumping.
39+
2640
- Type: `dict`
2741
- Default: `None`
2842

2943
**Supported in TOML, JSON, and YAML configuration files.**
3044

31-
Custom rules for committing and bumping. See [customization](../customization/config_file.md) for more details.
45+
See [customization](../customization/config_file.md) for more details.
3246

3347
## `use_shortcuts`
3448

49+
Show keyboard shortcuts when selecting from a list. When enabled, each choice shows a shortcut key; press that key or use the arrow keys to select.
50+
3551
- Type: `bool`
3652
- Default: `False`
3753

38-
Show keyboard shortcuts when selecting from a list. When enabled, each choice shows a shortcut key; press that key or use the arrow keys to select.
39-
40-
Example:
54+
**Example**
4155

4256
```toml title="pyproject.toml"
4357
[tool.commitizen]

0 commit comments

Comments
 (0)