Semver
semver
Semantic versioning — parse commits and compute next version.
VersionBump
dataclass
Result of a semver computation.
Attributes:
| Name | Type | Description |
|---|---|---|
current |
str
|
Current tag (e.g. |
next |
str
|
Next tag (e.g. |
bump |
str
|
Bump type ( |
commits |
list[str]
|
One-line commit summaries since last tag. |
breaking |
bool
|
Whether a breaking change was detected. |
Source code in packages/axm-git/src/axm_git/core/semver.py
compute_bump(commits, current_tag)
Compute the next semver version from commit messages.
Rules (pre-1.0, i.e. major == 0):
- feat!: or BREAKING CHANGE: → minor bump
- feat: → minor bump
- everything else → patch bump
Rules (post-1.0):
- feat!: or BREAKING CHANGE: → major bump
- feat: → minor bump
- everything else → patch bump
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commits
|
list[str]
|
One-line commit messages (e.g. from |
required |
current_tag
|
str
|
Current version tag (e.g. |
required |
Returns:
| Type | Description |
|---|---|
VersionBump
|
VersionBump with computed next version. |
Source code in packages/axm-git/src/axm_git/core/semver.py
parse_tag(tag)
Parse a semver tag string into (major, minor, patch).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tag
|
str
|
Version string, with or without |
required |
Returns:
| Type | Description |
|---|---|
tuple[int, int, int]
|
Tuple of (major, minor, patch). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the tag doesn't match semver format. |