commit-check

raw JSON →
2.6.0 verified Fri May 01 auth: no python

A Python library and CLI tool to enforce commit message formatting, branch naming conventions, author/email checks, and other git-related validations. Version 2.6.0 targets Python >=3.9 and is released periodically.

pip install commit-check
error ModuleNotFoundError: No module named 'commit_check'
cause Installed the package via 'pip install commit-check' but Python cannot find the module due to wrong import path or virtual environment not activated.
fix
Ensure the virtual environment is activated. The correct import is 'from commit_check import ...' (underscore, not hyphen).
error ImportError: cannot import name 'Config' from 'commit_check'
cause Config class moved to 'commit_check.config' in v2.0.0.
fix
Use 'from commit_check.config import Config'.
error GitCommandError: Cmd('git') failed due to: exit code(128) cmdline: git rev-parse --show-toplevel stderr: 'fatal: not a git repository'
cause commit-check requires a valid git repository. The current directory is not part of a git repo.
fix
Run the command inside a git repository or set project_root to a path inside a git repo.
error TypeError: CommitCheck() got an unexpected keyword argument 'debug'
cause The 'debug' parameter was removed in v2.6.0 after deprecation, or using an older version that doesn't have it.
fix
Use 'log_level' parameter instead. Check your commit-check version: 'pip show commit-check'.
breaking In v2.0.0, the Config class was moved from top-level to commit_check.config module. Direct imports from commit_check.Config will fail.
fix Change 'from commit_check import Config' to 'from commit_check.config import Config'
deprecated The 'debug' parameter in CommitCheck constructor is deprecated since v2.5.0 and will be removed in v3.0.0. Use 'log_level' instead.
fix Replace debug=True with log_level='DEBUG'
gotcha Installation creates a 'commit-check' command but it may conflict with other tools named 'commit-check' installed via npm or as a shell alias. Use 'python -m commit_check' as fallback.
fix Use 'python -m commit_check' if CLI command is shadowed.
gotcha The library expects to be run inside a git repository. Calling CommitCheck.run() outside a git repo raises GitCommandError.
fix Wrap in try/except or check for .git directory before calling.
pipx install commit-check

Basic usage of commit-check programmatically. For CLI: run `commit-check` in terminal.

from commit_check import CommitCheck
checker = CommitCheck(project_root='.', config={})
results = checker.run()
for result in results:
    print(result.passed, result.message)