Skip to content

Commit 4ad2cdf

Browse files
docs: replace commitizen docs with the ap-commit hook, [commit.types] and uv-based ap bump
- commit_workflow.md: ap prek instead of ap pre-commit, plain git commit checked by the ap-commit hook - package_releases.md: ap bump uses uv version --bump, add --minor/--major - remove cz.toml/commitizen mentions from concepts, overview, ci_cd and faq_sample - fix broken release_management.md link in ci_cd.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent d1c83bf commit 4ad2cdf

6 files changed

Lines changed: 51 additions & 50 deletions

File tree

‎afterpython/doc/concepts.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
[mystmd]: https://mystmd.org
2-
[commitizen]: https://github.com/commitizen-tools/commitizen
32
[pre-commit]: https://github.com/pre-commit/pre-commit
43
[ruff]: https://github.com/astral-sh/ruff
54

@@ -16,18 +15,17 @@ The `afterpython/` folder serves as a centralized location for both your project
1615
- `afterpython/guide/` - How-to Guides
1716

1817
**Configuration files:**
19-
- `cz.toml` for [commitizen]
2018
- `ruff.toml` for [ruff]
2119
- `.pre-commit-config.yaml` for [pre-commit]
2220
- `authors.yml` for [mystmd]
23-
- `afterpython.toml` for `afterpython` itself
21+
- `afterpython.toml` for `afterpython` itself (e.g. allowed commit types)
2422

2523
**Purpose:**
2624

2725
This structure serves two goals:
2826

2927
1. **Declutter the root directory** - Keeps maintenance-related configuration files separate from package code, making the project structure cleaner
30-
2. **Provide sane defaults** - Comes pre-configured with sensible defaults for common maintenance tools like [commitizen], [pre-commit], and [ruff], so you can start using them immediately
28+
2. **Provide sane defaults** - Comes pre-configured with sensible defaults for common maintenance tools like [pre-commit] and [ruff], so you can start using them immediately
3129

3230

3331
---

‎afterpython/doc/overview.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
[Scikit-Learn]: https://scikit-learn.org
1111
[WebLLM]: https://webllm.mlc.ai/
1212
[project-website-template]: https://github.com/AfterPythonOrg/project-website-template
13-
[commitizen]: https://github.com/commitizen-tools/commitizen
1413
[uv]: https://docs.astral.sh/uv/
1514
[ruff]: https://docs.astral.sh/ruff/
1615

@@ -48,7 +47,6 @@ ap tui
4847
- [pre-commit]
4948
- [GitHub Actions]
5049
- [pdoc]
51-
- [commitizen]
5250
- [uv]
5351
- [ruff]
5452
- [pagefind]

‎afterpython/doc/package_maintenance/ci_cd.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ Runs linting and formatting with ruff, runs tests with pytest and builds the pac
1212
### `release.yml` (optional)
1313
Releases your package to [PyPI] and GitHub.
1414

15-
`release.yml` will NOT be created if `commitizen` is not initialized during `ap init`.
15+
`release.yml` is only created if you agree to it during `ap init`.
1616

17-
See [PyPI and GitHub Releases](./release_management.md#pypi-and-github-releases) for more details.
17+
See [PyPI and GitHub Releases](./package_releases.md#pypi-and-github-releases) for more details.
1818

1919
### `deploy.yml`
2020
Deploys your project website to GitHub Pages.

‎afterpython/doc/package_maintenance/commit_workflow.md‎

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,51 @@
1-
[pre-commit]: https://pre-commit.com/
2-
[commitizen]: https://commitizen-tools.github.io/commitizen/
1+
[prek]: https://prek.j178.dev/
32
[Conventional Commits]: https://www.conventionalcommits.org
43

54

65
# Commit Workflow
76

87
## Pre-Commit Hooks
9-
Pre-commit hooks are scripts that automatically run before a commit is finalized, serving as a quality checkpoint for code changes. `afterpython` uses [pre-commit] to manage these hooks.
8+
Pre-commit hooks are scripts that automatically run before a commit is finalized, serving as a quality checkpoint for code changes. `afterpython` uses [prek] (a faster drop-in replacement for `pre-commit`) to manage these hooks.
109

11-
After running `ap init`, if you agreed to create a `.pre-commit-config.yaml` file, it will be located in the `afterpython/` folder with some default hooks. Since this configuration file is not at the project root, you need to run `ap pre-commit` (or `ap pc` for short) instead of the `pre-commit` command—it automatically uses the configuration in `afterpython/`.
10+
After running `ap init`, if you agreed to create a `.pre-commit-config.yaml` file, it will be located in the `afterpython/` folder with some default hooks. Since this configuration file is not at the project root, you need to run `ap prek` (or `ap pc` for short) instead of the `prek` command—it automatically uses the configuration in `afterpython/`.
1211

1312
### Commands
14-
- `ap pre-commit` (or `ap pc`) — equivalent to `pre-commit --config afterpython/.pre-commit-config.yaml`
13+
- `ap prek` (or `ap pc`) — equivalent to `prek --config afterpython/.pre-commit-config.yaml`
1514

1615

1716
---
18-
## Commitizen
19-
If you agreed to create a `cz.toml` file during `ap init`, `afterpython` will use [commitizen] to help you write clear, structured commit messages following the [Conventional Commits] specification.
20-
21-
Since the `cz.toml` configuration file is located in `afterpython/` (not the project root), use `ap cz` instead of the standard `cz` command.
17+
## Commit Messages
18+
`afterpython` checks that your commit messages follow the [Conventional Commits] format, e.g. `feat: add new feature`, `fix(cli): resolve bug`. This is done by the `ap-commit` hook in `afterpython/.pre-commit-config.yaml`, so just use `git commit` as usual.
2219

2320
### Writing Commit Messages
24-
**Recommended:** Use `ap commit` to create commits. This command:
25-
1. Runs pre-commit hooks on changed files to catch issues early
26-
2. Guides you through an interactive prompt to write a properly formatted commit message
27-
3. Provides flags to skip checks when needed
28-
29-
**Alternative:** Use `git commit` directly if you're comfortable writing [Conventional Commits] format messages (e.g., `feat: add new feature`, `fix: resolve bug`). Your message must match the format enforced in `cz.toml` and pass pre-commit hook checks.
30-
31-
32-
**Bypassing checks:** To commit without running any checks:
33-
- `git commit --no-verify` — skip pre-commit hooks
34-
- `git push --no-verify` — skip pre-push hooks
35-
36-
### Commands
37-
- `ap cz` (or `ap commitizen`) — equivalent to `cz --config afterpython/cz.toml`
38-
- `ap commit` — wrapper around `cz commit` with additional features:
39-
- `ap commit --no-cz` — skip commitizen checks in pre-commit hooks
40-
- `ap commit --no-pc` — skip pre-commit checks before writing the commit message
41-
- `git commit --no-verify` — skip all pre-commit hooks
21+
- `git commit` — when your editor opens, the format and the allowed commit types are listed above git's own comments.
22+
- `git commit -m "feat: add new feature"` — the message is checked the same way.
23+
24+
The message title must look like `<type>(<scope>): <description>`, where `(<scope>)` is optional and `<type>` is one of the allowed commit types. Add `!` before `:` for breaking changes, e.g. `feat!: drop Python 3.11`.
25+
Messages created by git itself (e.g. merge, revert, `fixup!` and `squash!` commits) are let through as-is.
26+
27+
If the message is rejected, it is saved, so you can edit and retry with the `git commit -e -F <file>` command shown in the error.
28+
29+
### Commit Types
30+
Commit types can be defined in `afterpython/afterpython.toml` (`type = "description"`), `ap init` creates it with these defaults:
31+
```toml
32+
# allowed commit types, e.g. "feat: add X"; add or remove lines freely
33+
[commit.types]
34+
feat = "A new feature"
35+
fix = "A bug fix"
36+
docs = "Documentation only changes"
37+
style = "Formatting, no code meaning change"
38+
refactor = "Neither fixes a bug nor adds a feature"
39+
perf = "Performance improvement"
40+
test = "Adding or fixing tests"
41+
build = "Build system or dependencies"
42+
ci = "CI configuration"
43+
chore = "Other changes that don't modify src or tests"
44+
wip = "Work in progress"
45+
```
46+
To allow a new type, add a line, e.g. `deps = "Dependency updates"`; to disallow one, remove its line. The descriptions are shown in the commit message template and in the error message when a commit is rejected.
47+
48+
### Bypassing Checks
49+
- `SKIP=ap-commit git commit` — skip the commit message check
50+
- `git commit --no-verify` — skip all pre-commit and commit message hooks
4251
- `git push --no-verify` — skip all pre-push hooks
43-
44-
45-
:::{tip} Commitizen Customization
46-
<!-- :class: dropdown -->
47-
Customize the commit message format by editing `cz.toml`.
48-
49-
See [Commitizen Customization](https://commitizen-tools.github.io/commitizen/customization/) for details.
50-
:::

‎afterpython/doc/package_maintenance/package_releases.md‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[commitizen]: https://commitizen-tools.github.io/commitizen/
1+
[uv]: https://docs.astral.sh/uv/
22
[SemVer]: https://semver.org
33
[Python Versioning]: https://packaging.python.org/en/latest/discussions/versioning/
44
[PyPI]: https://pypi.org/
@@ -7,12 +7,16 @@
77
# Package Releases
88

99
## Version Bumping
10-
`ap bump` automatically increments your project version using [commitizen]'s `cz bump` under the hood.
10+
`ap bump` increments your project version using [uv]'s `uv version --bump` under the hood, then commits the change (`bump: version A → B`) and tags it (e.g. `v0.1.0`).
1111

1212
### Commands
13-
- `ap bump` — automatically bump version based on conventional commits
14-
- `ap bump --pre` — bump to a pre-release version (e.g., `0.1.0.dev3` → `0.1.0.rc0`)
15-
- `ap bump --release` — bump to a release version (e.g., `0.1.0.rc0` → `0.1.0`)
13+
- `ap bump` — bump version within the current release phase
14+
- dev versions: `0.1.0.dev3` → `0.1.0.dev4`
15+
- pre-releases: `0.1.0a1` → `0.1.0a2`
16+
- stable versions: `0.3.19` → `0.3.20` (patch)
17+
- `ap bump --minor` / `ap bump --major` — bump the minor / major version instead of patch (stable versions only, e.g., `0.3.19` → `0.4.0` / `1.0.0`)
18+
- `ap bump --pre` — bump to a pre-release version (e.g., `0.1.0.dev3` → `0.1.0rc0`)
19+
- `ap bump --release` — bump to a release version (e.g., `0.1.0rc0` → `0.1.0`), only allowed on the default branch (e.g. `main`)
1620
- **NOTE**: This command will **automatically trigger** the [release](./package_releases.md#releasing-your-package) workflow, you don't need to run `ap release` manually.
1721

1822
:::{seealso} Versioning
@@ -22,7 +26,7 @@ See [SemVer] and [Python Versioning] to learn more about versioning in Python pa
2226

2327
---
2428
## PyPI and GitHub Releases
25-
If you agreed to create `cz.toml` during `ap init`, `afterpython` automatically creates a GitHub Actions workflow (`.github/workflows/release.yml`) that publishes your package to [PyPI] and creates GitHub releases.
29+
If you agreed to create the release workflow during `ap init`, `afterpython` creates a GitHub Actions workflow (`.github/workflows/release.yml`) that publishes your package to [PyPI] and creates GitHub releases.
2630

2731
### PyPI Setup
2832
To enable trusted publishing on PyPI:

‎afterpython/faq_sample.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
answer: |
1616
`ap init` configures:
1717
- Pre-commit hooks (ruff, mypy)
18-
- Conventional commits via *commitizen*
18+
- Conventional commit message checks (commit types in `afterpython.toml`)
1919
- Semantic-release for versioning
2020
- The project website scaffold under `afterpython/`
2121
category: Getting Started

0 commit comments

Comments
 (0)