Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ If you're a first-time contributor, please check out issues labeled [good first
- Run the full test suite: `uv run poe all`
- Ensure test coverage doesn't drop (we use [CodeCov](https://app.codecov.io/gh/commitizen-tools/commitizen))
- For documentation changes, run `uv run poe doc` to check for warnings/errors
- If you need to change some file regression snapshots, run: `uv run poe test:regen`
4. **Committing Changes**
- Use Commitizen to make commits (we follow [conventional commits](https://www.conventionalcommits.org/))
- Example: `cz commit`
Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ semver = "commitizen.version_schemes:SemVer"
semver2 = "commitizen.version_schemes:SemVer2"

[dependency-groups]
dev = ["ipython>=8.0", "tox>4", "poethepoet>=0.34.0"]
dev = ["ipython>=8.0", "tox>4", "tox-uv", "poethepoet>=0.34.0"]

test = [
"pytest>=7.2",
Expand Down Expand Up @@ -263,6 +263,12 @@ test.cmd = "pytest -n 3 --dist=loadfile"
"test:all".help = "Run the test suite on all supported Python versions"
"test:all".cmd = "tox --parallel"

"test:regen".help = "Regenerate the test fixtures"
"test:regen".parallel = [
{ ref = "test -k 'not py_' --regen-all" },
{ ref = "test:all -- -k py_ --regen-all" },
]

cover.help = "Run the test suite with coverage"
cover.ref = "test --cov-report term-missing --cov-report=xml:coverage.xml --cov=commitizen --junitxml=junit.xml -o junit_family=legacy"

Expand Down
7 changes: 2 additions & 5 deletions tests/commands/test_common_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
from commitizen.commands import Example, Info, ListCz, Schema


@pytest.mark.skipif(
sys.version_info < (3, 13),
reason="The output message of argparse is different between Python 3.13 and lower than Python 3.13",
)
@pytest.mark.parametrize(
"command",
[
Expand All @@ -26,6 +22,7 @@
"version",
],
)
@pytest.mark.usefixtures("python_version")
def test_command_shows_description_when_use_help_option(
mocker: MockFixture,
capsys,
Expand All @@ -35,7 +32,7 @@ def test_command_shows_description_when_use_help_option(
):
"""Test that the command shows the description when the help option is used.

Note: If the command description changes, please run `pytest tests/commands/test_common_command.py --regen-all` to regenerate the test files.
Note: If the command description changes, please run `poe test:regen` to regenerate the test files.
"""
# Force consistent terminal output
monkeypatch.setenv("COLUMNS", "80")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
usage: cz bump [-h] [--dry-run] [--files-only] [--local-version] [--changelog]
[--no-verify] [--yes] [--tag-format TAG_FORMAT]
[--bump-message BUMP_MESSAGE] [--prerelease {alpha,beta,rc}]
[--devrelease DEVRELEASE] [--increment {MAJOR,MINOR,PATCH}]
[--increment-mode {linear,exact}] [--check-consistency]
[--annotated-tag]
[--annotated-tag-message ANNOTATED_TAG_MESSAGE] [--gpg-sign]
[--changelog-to-stdout] [--git-output-to-stderr] [--retry]
[--major-version-zero] [--template TEMPLATE] [--extra EXTRA]
[--file-name FILE_NAME] [--prerelease-offset PRERELEASE_OFFSET]
[--version-scheme {pep440,semver,semver2}]
[--version-type {pep440,semver,semver2}]
[--build-metadata BUILD_METADATA] [--get-next]
[--allow-no-commit]
[MANUAL_VERSION]

bump semantic version based on the git log

positional arguments:
MANUAL_VERSION bump to the given version (e.g: 1.5.3)

options:
-h, --help show this help message and exit
--dry-run show output to stdout, no commit, no modified files
--files-only bump version in the files from the config
--local-version bump only the local version portion
--changelog, -ch generate the changelog for the newest version
--no-verify this option bypasses the pre-commit and commit-msg
hooks
--yes accept automatically questions done
--tag-format TAG_FORMAT
the format used to tag the commit and read it, use it
in existing projects, wrap around simple quotes
--bump-message BUMP_MESSAGE
template used to create the release commit, useful
when working with CI
--prerelease {alpha,beta,rc}, -pr {alpha,beta,rc}
choose type of prerelease
--devrelease DEVRELEASE, -d DEVRELEASE
specify non-negative integer for dev. release
--increment {MAJOR,MINOR,PATCH}
manually specify the desired increment
--increment-mode {linear,exact}
set the method by which the new version is chosen.
'linear' (default) guesses the next version based on
typical linear version progression, such that bumping
of a pre-release with lower precedence than the
current pre-release phase maintains the current phase
of higher precedence. 'exact' applies the changes that
have been specified (or determined from the commit
log) without interpretation, such that the increment
and pre-release are always honored
--check-consistency, -cc
check consistency among versions defined in commitizen
configuration and version_files
--annotated-tag, -at create annotated tag instead of lightweight one
--annotated-tag-message ANNOTATED_TAG_MESSAGE, -atm ANNOTATED_TAG_MESSAGE
create annotated tag message
--gpg-sign, -s sign tag instead of lightweight one
--changelog-to-stdout
Output changelog to the stdout
--git-output-to-stderr
Redirect git output to stderr
--retry retry commit if it fails the 1st time
--major-version-zero keep major version at zero, even for breaking changes
--template TEMPLATE, -t TEMPLATE
changelog template file name (relative to the current
working directory)
--extra EXTRA, -e EXTRA
a changelog extra variable (in the form 'key=value')
--file-name FILE_NAME
file name of changelog (default: 'CHANGELOG.md')
--prerelease-offset PRERELEASE_OFFSET
start pre-releases with this offset
--version-scheme {pep440,semver,semver2}
choose version scheme
--version-type {pep440,semver,semver2}
Deprecated, use --version-scheme instead
--build-metadata BUILD_METADATA
Add additional build-metadata to the version-number
--get-next Determine the next version and write to stdout
--allow-no-commit bump version without eligible commits
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
usage: cz changelog [-h] [--dry-run] [--file-name FILE_NAME]
[--unreleased-version UNRELEASED_VERSION] [--incremental]
[--start-rev START_REV] [--merge-prerelease]
[--version-scheme {pep440,semver,semver2}]
[--export-template EXPORT_TEMPLATE] [--template TEMPLATE]
[--extra EXTRA] [--tag-format TAG_FORMAT]
[rev_range]

generate changelog (note that it will overwrite existing file)

positional arguments:
rev_range generates changelog for the given version (e.g: 1.5.3)
or version range (e.g: 1.5.3..1.7.9)

options:
-h, --help show this help message and exit
--dry-run show changelog to stdout
--file-name FILE_NAME
file name of changelog (default: 'CHANGELOG.md')
--unreleased-version UNRELEASED_VERSION
set the value for the new version (use the tag value),
instead of using unreleased
--incremental generates changelog from last created version, useful
if the changelog has been manually modified
--start-rev START_REV
start rev of the changelog. If not set, it will
generate changelog from the start
--merge-prerelease collect all changes from prereleases into next non-
prerelease. If not set, it will include prereleases in
the changelog
--version-scheme {pep440,semver,semver2}
choose version scheme
--export-template EXPORT_TEMPLATE
Export the changelog template into this file instead
of rendering it
--template TEMPLATE, -t TEMPLATE
changelog template file name (relative to the current
working directory)
--extra EXTRA, -e EXTRA
a changelog extra variable (in the form 'key=value')
--tag-format TAG_FORMAT
The format of the tag, wrap around simple quotes
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
usage: cz check [-h]
[--commit-msg-file COMMIT_MSG_FILE | --rev-range REV_RANGE | -d | -m MESSAGE]
[--allow-abort] [--allowed-prefixes [ALLOWED_PREFIXES ...]]
[-l MESSAGE_LENGTH_LIMIT]

validates that a commit message matches the commitizen schema

options:
-h, --help show this help message and exit
--commit-msg-file COMMIT_MSG_FILE
ask for the name of the temporal file that contains
the commit message. Using it in a git hook script:
MSG_FILE=$1
--rev-range REV_RANGE
a range of git rev to check. e.g, master..HEAD
-d, --use-default-range
check from the default branch to HEAD. e.g,
refs/remotes/origin/master..HEAD
-m MESSAGE, --message MESSAGE
commit message that needs to be checked
--allow-abort allow empty commit messages, which typically abort a
commit
--allowed-prefixes [ALLOWED_PREFIXES ...]
allowed commit message prefixes. If the message starts
by one of these prefixes, the message won't be checked
against the regex
-l MESSAGE_LENGTH_LIMIT, --message-length-limit MESSAGE_LENGTH_LIMIT
length limit of the commit message; 0 for no limit
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
usage: cz commit [-h] [--retry] [--no-retry] [--dry-run]
[--write-message-to-file FILE_PATH] [-s] [-a] [-e]
[-l MESSAGE_LENGTH_LIMIT] [--]

create new commit

options:
-h, --help show this help message and exit
--retry retry last commit
--no-retry skip retry if retry_after_failure is set to true
--dry-run show output to stdout, no commit, no modified files
--write-message-to-file FILE_PATH
write message to file before committing (can be
combined with --dry-run)
-s, --signoff Deprecated, use 'cz commit -- -s' instead
-a, --all Tell the command to automatically stage files that
have been modified and deleted, but new files you have
not told Git about are not affected.
-e, --edit edit the commit message before committing
-l MESSAGE_LENGTH_LIMIT, --message-length-limit MESSAGE_LENGTH_LIMIT
length limit of the commit message; 0 for no limit
-- Positional arguments separator (recommended)
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
usage: cz bump [-h] [--dry-run] [--files-only] [--local-version] [--changelog]
[--no-verify] [--yes] [--tag-format TAG_FORMAT]
[--bump-message BUMP_MESSAGE] [--prerelease {alpha,beta,rc}]
[--devrelease DEVRELEASE] [--increment {MAJOR,MINOR,PATCH}]
[--increment-mode {linear,exact}] [--check-consistency]
[--annotated-tag]
[--annotated-tag-message ANNOTATED_TAG_MESSAGE] [--gpg-sign]
[--changelog-to-stdout] [--git-output-to-stderr] [--retry]
[--major-version-zero] [--template TEMPLATE] [--extra EXTRA]
[--file-name FILE_NAME] [--prerelease-offset PRERELEASE_OFFSET]
[--version-scheme {pep440,semver,semver2}]
[--version-type {pep440,semver,semver2}]
[--build-metadata BUILD_METADATA] [--get-next]
[--allow-no-commit]
[MANUAL_VERSION]

bump semantic version based on the git log

positional arguments:
MANUAL_VERSION bump to the given version (e.g: 1.5.3)

options:
-h, --help show this help message and exit
--dry-run show output to stdout, no commit, no modified files
--files-only bump version in the files from the config
--local-version bump only the local version portion
--changelog, -ch generate the changelog for the newest version
--no-verify this option bypasses the pre-commit and commit-msg
hooks
--yes accept automatically questions done
--tag-format TAG_FORMAT
the format used to tag the commit and read it, use it
in existing projects, wrap around simple quotes
--bump-message BUMP_MESSAGE
template used to create the release commit, useful
when working with CI
--prerelease {alpha,beta,rc}, -pr {alpha,beta,rc}
choose type of prerelease
--devrelease DEVRELEASE, -d DEVRELEASE
specify non-negative integer for dev. release
--increment {MAJOR,MINOR,PATCH}
manually specify the desired increment
--increment-mode {linear,exact}
set the method by which the new version is chosen.
'linear' (default) guesses the next version based on
typical linear version progression, such that bumping
of a pre-release with lower precedence than the
current pre-release phase maintains the current phase
of higher precedence. 'exact' applies the changes that
have been specified (or determined from the commit
log) without interpretation, such that the increment
and pre-release are always honored
--check-consistency, -cc
check consistency among versions defined in commitizen
configuration and version_files
--annotated-tag, -at create annotated tag instead of lightweight one
--annotated-tag-message ANNOTATED_TAG_MESSAGE, -atm ANNOTATED_TAG_MESSAGE
create annotated tag message
--gpg-sign, -s sign tag instead of lightweight one
--changelog-to-stdout
Output changelog to the stdout
--git-output-to-stderr
Redirect git output to stderr
--retry retry commit if it fails the 1st time
--major-version-zero keep major version at zero, even for breaking changes
--template TEMPLATE, -t TEMPLATE
changelog template file name (relative to the current
working directory)
--extra EXTRA, -e EXTRA
a changelog extra variable (in the form 'key=value')
--file-name FILE_NAME
file name of changelog (default: 'CHANGELOG.md')
--prerelease-offset PRERELEASE_OFFSET
start pre-releases with this offset
--version-scheme {pep440,semver,semver2}
choose version scheme
--version-type {pep440,semver,semver2}
Deprecated, use --version-scheme instead
--build-metadata BUILD_METADATA
Add additional build-metadata to the version-number
--get-next Determine the next version and write to stdout
--allow-no-commit bump version without eligible commits
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
usage: cz changelog [-h] [--dry-run] [--file-name FILE_NAME]
[--unreleased-version UNRELEASED_VERSION] [--incremental]
[--start-rev START_REV] [--merge-prerelease]
[--version-scheme {pep440,semver,semver2}]
[--export-template EXPORT_TEMPLATE] [--template TEMPLATE]
[--extra EXTRA] [--tag-format TAG_FORMAT]
[rev_range]

generate changelog (note that it will overwrite existing file)

positional arguments:
rev_range generates changelog for the given version (e.g: 1.5.3)
or version range (e.g: 1.5.3..1.7.9)

options:
-h, --help show this help message and exit
--dry-run show changelog to stdout
--file-name FILE_NAME
file name of changelog (default: 'CHANGELOG.md')
--unreleased-version UNRELEASED_VERSION
set the value for the new version (use the tag value),
instead of using unreleased
--incremental generates changelog from last created version, useful
if the changelog has been manually modified
--start-rev START_REV
start rev of the changelog. If not set, it will
generate changelog from the start
--merge-prerelease collect all changes from prereleases into next non-
prerelease. If not set, it will include prereleases in
the changelog
--version-scheme {pep440,semver,semver2}
choose version scheme
--export-template EXPORT_TEMPLATE
Export the changelog template into this file instead
of rendering it
--template TEMPLATE, -t TEMPLATE
changelog template file name (relative to the current
working directory)
--extra EXTRA, -e EXTRA
a changelog extra variable (in the form 'key=value')
--tag-format TAG_FORMAT
The format of the tag, wrap around simple quotes
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
usage: cz check [-h]
[--commit-msg-file COMMIT_MSG_FILE | --rev-range REV_RANGE | -d | -m MESSAGE]
[--allow-abort] [--allowed-prefixes [ALLOWED_PREFIXES ...]]
[-l MESSAGE_LENGTH_LIMIT]

validates that a commit message matches the commitizen schema

options:
-h, --help show this help message and exit
--commit-msg-file COMMIT_MSG_FILE
ask for the name of the temporal file that contains
the commit message. Using it in a git hook script:
MSG_FILE=$1
--rev-range REV_RANGE
a range of git rev to check. e.g, master..HEAD
-d, --use-default-range
check from the default branch to HEAD. e.g,
refs/remotes/origin/master..HEAD
-m MESSAGE, --message MESSAGE
commit message that needs to be checked
--allow-abort allow empty commit messages, which typically abort a
commit
--allowed-prefixes [ALLOWED_PREFIXES ...]
allowed commit message prefixes. If the message starts
by one of these prefixes, the message won't be checked
against the regex
-l MESSAGE_LENGTH_LIMIT, --message-length-limit MESSAGE_LENGTH_LIMIT
length limit of the commit message; 0 for no limit
Loading