Skip to content

Commit aac0096

Browse files
build(deps): replace tbump with commitizen for versioning and changelog
- Remove tbump>=6.11.0 and tbump.toml - Add commitizen>=4.8.3 as dev dependency - Configure [tool.commitizen] in pyproject.toml: - version_provider=pep621, tag_format=v$version - Incremental CHANGELOG.md generation on bump - version_files to sync __version__.py and download URL - Replace poe version:update task with: - poe release -> cz bump --changelog - poe release:changelog -> cz changelog - Add commitizen commit-msg pre-commit hook to enforce conventional commits
1 parent 454b68c commit aac0096

4 files changed

Lines changed: 302 additions & 104 deletions

File tree

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,20 @@ repos:
2222
- --output-format=full
2323
- id: ruff-format
2424

25+
- repo: https://github.com/commitizen-tools/commitizen
26+
rev: v4.8.3
27+
hooks:
28+
- id: commitizen
29+
stages: [commit-msg]
30+
2531
- repo: local
2632
hooks:
2733
- id: ty
2834
name: ty
2935
entry: uv run ty check
3036
language: system
3137
files: \.py$
38+
3239
- id: testing
3340
name: Testing
3441
description: Running tests for the app

pyproject.toml

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ classifiers = [
3333
]
3434
dependencies = [
3535
"babel>=2.18.0",
36+
"keyring>=25.7.0",
3637
"platformdirs>=4.9.6",
3738
"pygit2>=1.19.2",
3839
"pygithub>=2.9.1",
@@ -59,9 +60,10 @@ dev = [
5960
"polib>=1.2.0",
6061
"pre-commit>=4.6.0",
6162
"pytest>=9.0.3",
63+
"pytest-asyncio>=1.3.0",
6264
"pytest-cov>=7.1.0",
6365
"ruff>=0.15.14",
64-
"tbump>=6.11.0",
66+
"commitizen>=4.8.3",
6567
"textual-dev>=1.8.0",
6668
"tomli-w>=1.2.0",
6769
"ty>=0.0.39",
@@ -72,27 +74,29 @@ requires = ["uv_build>=0.9.18,<0.10.0"]
7274
build-backend = "uv_build"
7375

7476
[tool.poe.tasks]
75-
"lint:update" = "uv run pre-commit autoupdate"
76-
"lint" = "uv run pre-commit run --all"
77+
"lint" = "uv run ruff check --fix"
78+
"lint:format" = "uv run ruff format"
79+
"lint:types" = "uv run ty check"
7780
"test" = "uv run pytest --cov edit_python_pe --cov-report xml:cobertura.xml --cov-report term --junitxml report.xml"
7881
"freeze" = "uv export --format requirements.txt --no-group dev --no-hashes --no-annotate --no-header --output-file requirements.txt"
7982
"freeze:dev" = "uv export --format requirements.txt --all-groups --no-hashes --no-annotate --no-header --output-file requirements.dev.txt"
8083
"changelog:draft" = { shell = "cat .diff.txt | gemini < prompts/changelog_generator.txt > .CHANGELOG_DRAFT.md" }
8184

82-
[tool.poe.tasks."version:update"]
83-
sequence = [
84-
{ cmd = "uv run tbump --no-push --no-tag --non-interactive ${version}" },
85-
]
86-
args = [{ name = "version", positional = true }]
85+
[tool.poe.tasks."release"]
86+
cmd = "uv run cz bump --changelog"
8787

88-
[tool.poe.tasks."messages:extract"]
89-
cmd = "uv run pybabel extract -F babel.cfg -o src/edit_python_pe/locale/messages.pot src/edit_python_pe"
88+
[tool.poe.tasks."release:changelog"]
89+
cmd = "uv run cz changelog"
9090

9191
[tool.poe.tasks."messages:init"]
9292
sequence = [
9393
"messages:extract",
9494
{ cmd = "uv run pybabel init -i src/edit_python_pe/locale/messages.pot -d src/edit_python_pe/locale -l ${lang}" }
9595
]
96+
97+
[tool.poe.tasks."messages:extract"]
98+
cmd = "uv run pybabel extract -F babel.cfg -o src/edit_python_pe/locale/messages.pot src/edit_python_pe"
99+
96100
args = [{ name = "lang", options = ["--lang"], required = true }]
97101

98102
[tool.poe.tasks."messages:update"]
@@ -101,18 +105,11 @@ sequence = [
101105
{ cmd = "uv run pybabel update -i src/edit_python_pe/locale/messages.pot -d src/edit_python_pe/locale" }
102106
]
103107

104-
[tool.poe.tasks."messages:translate"]
105-
cmd = "uv run python scripts/translate.py src/edit_python_pe/locale/${lang}/LC_MESSAGES/messages.po ${lang}"
106-
args = [{ name = "lang", options = ["--lang"], required = true }]
107-
108-
[tool.poe.tasks.makemessages]
109-
ref = "messages:update"
110-
111-
[tool.poe.tasks.compilemessages]
108+
[tool.poe.tasks."messages:compile"]
112109
cmd = "uv run pybabel compile -d src/edit_python_pe/locale"
113110

114111
[tool.ruff]
115-
line-length = 79
112+
line-length = 88
116113
target-version = "py314"
117114

118115
[tool.ruff.lint]
@@ -140,11 +137,16 @@ ignore = [
140137
"D203", # 1 blank line required before class docstring
141138
"D213", # Multi-line docstring summary should start at the second line
142139
"D407", # Missing dashed underline after section
143-
"S101", # Use of assert detected (often used in tests)
144140
]
145141

146142
[tool.ruff.lint.per-file-ignores]
147-
"tests/*" = ["S105", "S108", "E501"]
143+
"tests/*" = [
144+
"S101", # Use of assert detected
145+
"S105", # Use of hardcoded password string
146+
"S106", # Use of hardcoded password function args
147+
"S108", # Use of hardcoded temp files
148+
"E501", # Too long lines
149+
]
148150

149151
[tool.ruff.lint.isort]
150152
known-first-party = ["edit_python_pe"]
@@ -168,6 +170,32 @@ line-ending = "auto"
168170
# inconsistent-mro = "ignore"
169171
# unresolved-attribute = "ignore"
170172

173+
[tool.commitizen]
174+
name = "cz_conventional_commits"
175+
version_provider = "pep621"
176+
version_scheme = "semver"
177+
tag_format = "v$version"
178+
update_changelog_on_bump = true
179+
major_version_zero = true
180+
changelog_file = "CHANGELOG.md"
181+
changelog_incremental = true
182+
version_files = [
183+
"src/edit_python_pe/__version__.py:__version__ = \"$version\"",
184+
"pyproject.toml:tags/v$version.tar.gz",
185+
]
186+
187+
[[tool.commitizen.change_type_map]]
188+
"feat" = "Features"
189+
"fix" = "Bug Fixes"
190+
"docs" = "Documentation"
191+
"style" = "Styles"
192+
"refactor" = "Code Refactoring"
193+
"perf" = "Performance Improvements"
194+
"test" = "Tests"
195+
"build" = "Build System"
196+
"ci" = "Continuous Integration"
197+
"chore" = "Chores"
198+
171199
[tool.uv.build-backend]
172200
module-name = "edit_python_pe"
173201
module-root = "src"

tbump.toml

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)