Skip to content

Commit b35dc04

Browse files
lwjohnst86martonvagoK-Beicher
authored
docs: 📝 decision post for versioning with Commitizen (#136)
Co-authored-by: martonvago <[email protected]> Co-authored-by: Kris Beicher <[email protected]>
1 parent f525f7b commit b35dc04

File tree

1 file changed

+151
-0
lines changed
  • why-semantic-release-with-commitizen

1 file changed

+151
-0
lines changed
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
---
2+
title: "Why Commitizen for semantic release"
3+
description: "The reasons we use Commitizen for automated versioning and releasing of our software."
4+
date: "2024-11-08"
5+
categories:
6+
- communicate
7+
- organize
8+
---
9+
10+
::: content-hidden
11+
Use other decision posts as inspiration to writing these. Leave the
12+
content-hidden sections in the text for future reference.
13+
:::
14+
15+
## Context and problem statement
16+
17+
::: content-hidden
18+
State the context and some background on the issue, then write a
19+
statement in the form of a question for the problem.
20+
:::
21+
22+
Setting and updating the version of software communicates to users the
23+
state and changes of software. However, having to manually update the
24+
version as well as deciding when a given state of the software requires
25+
a version is time- and energy-consuming. So instead, we would
26+
rather automate this process. So the question is:
27+
28+
*What tool can we use that will automate versioning for us?*
29+
30+
## Decision drivers
31+
32+
::: content-hidden
33+
List some reasons for why we need to make this decision and what things
34+
have arisen that impact work.
35+
:::
36+
37+
The main drivers for this decision are that:
38+
39+
- We don't want to manually have to update the version number in files
40+
throughout our software.
41+
- We don't want to manually add Git tags for the versions.
42+
- We want the version to be determined based on some principles,
43+
rather that just a "feeling" or potentially arbitrary decision.
44+
45+
Our requirements for the tool are that it:
46+
47+
- Follows [Semantic Versioning](/why-semver/index.qmd).
48+
- Relies on [Conventional
49+
Commits](/why-conventional-commits/index.qmd) to determine which
50+
version to set.
51+
- Includes GitHub Action workflows to auto-generate releases upon
52+
merging to the main branch.
53+
- Updates the version number in the `pyproject.toml` file.
54+
- Creates a Git tag for the release.
55+
56+
## Considered options
57+
58+
::: content-hidden
59+
List and describe some of the options, as well as some of the benefits
60+
and drawbacks for each option.
61+
:::
62+
63+
There are only two options that fit our requirements:
64+
65+
- [Python Semantic
66+
Release](https://github.com/python-semantic-release/python-semantic-release)
67+
- [Commitizen](https://github.com/commitizen-tools/commitizen)
68+
69+
While most package management systems like [Poetry](/why-poetry/index.qmd),
70+
which we already use, can do version updating and releasing, they don't rely on
71+
automation based on commit messages. For this reason, we don't consider them.
72+
73+
### Python Semantic Release
74+
75+
Automatically updates version information for Python projects.
76+
77+
::::: columns
78+
::: column
79+
#### Benefits
80+
81+
- Widely used with a large number of GitHub stars.
82+
- Often recommended on external guides and websites (e.g. the [Python
83+
Packages](https://py-pkgs.org/07-releasing-versioning.html#automatic-version-bumping)
84+
book).
85+
- Very actively maintained and developed.
86+
- Can also generate an auto-generated changelog.
87+
:::
88+
89+
::: column
90+
#### Drawbacks
91+
92+
- The website is difficult to navigate, relative to Commitizen at
93+
least. For instance, there aren't any tutorials or "getting started"
94+
guides and the colour scheme is a bit hard on the eyes.
95+
:::
96+
:::::
97+
98+
### Commitizen
99+
100+
Commitizen is a Python CLI tool to help manage releases, versioning, and
101+
creating and adhering to Conventional Commits.
102+
103+
::::: columns
104+
::: column
105+
#### Benefits
106+
107+
- We already use it for our [commit
108+
linting](/why-semantic-release/index.qmd).
109+
- The documentation and website are very easy to navigate and
110+
understand.
111+
- Very widely used with a large number of GitHub stars.
112+
- Very actively maintained and developed.
113+
- Can also generate an auto-generated changelog.
114+
:::
115+
116+
::: column
117+
#### Drawbacks
118+
119+
- None.
120+
:::
121+
:::::
122+
123+
## Decision outcome
124+
125+
::: content-hidden
126+
What decision was made, use the form "We decided on CHOICE because of
127+
REASONS."
128+
:::
129+
130+
The choice was pretty clear that Commitizen was the best for our
131+
requirements and purposes. We already use it and the documentation is
132+
much easier to navigate and use, which is a critical factor in choosing
133+
between tools.
134+
135+
### Consequences
136+
137+
::: content-hidden
138+
List some potential consequences of this decision.
139+
:::
140+
141+
- Because it's a tool we already use, integrating it should be fairly
142+
easy.
143+
144+
## Resources used for this post
145+
146+
::: content-hidden
147+
List the resources used to write this post
148+
:::
149+
150+
- [Libhunt: Discovering Python
151+
packages](https://www.libhunt.com/l/python)

0 commit comments

Comments
 (0)