Create git hooks with ease using a simple configuration file in a git project
Project description
python-githooks
Create git hooks with ease using a simple configuration file in a git project
Install
pip install python-githooks
Usage
- Create a
.githooks.ini
configuration file(If not provided a dummy configuration file will be created). - Add sections based on
git hooks names
followed by acommand
property with the shell code you want to run. - Run either
python -m python_githooks
orgithooks
in you virtual environment.
- Configuration file Example:
# .githooks.ini
[pre-commit]
command = pytest --cov
[pre-push]
command = pytest --cov && flake8
- Remember to re-run
python -m python_githooks
orgithooks
every time you make changes to the configuration file, whether it is for adding new hooks or modifying the current ones.
Removing a hook
If you already created a hook and now want to remove it, just set the command value to empty, like this:
# .githooks.ini
[pre-commit]
command =
This will not actually physically remove the hook from the git local project, just will make it instantly exit with 0
status code.
License
python-githooks is MIT-licensed.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python-githooks-1.0.5.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for python_githooks-1.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80f0d12611714f0688498bd73d5f6e982347b69824f7fa6fe3b0acdb650c5d4c |
|
MD5 | 1b76688bff6d9cc98ac8003892a02fcc |
|
BLAKE2b-256 | ecfbd0c701f3689c062aa732f3d6033b6a645f7ec5b2e7d7e0a318335a08afb6 |