Create git hooks with ease using a simple configuration file in a git project
Project description
py-githooks
Create git hooks with ease using a simple configuration file in a git project
Install
pip install py-githooks
Usage
- Create a
.githooks.iniconfiguration file (If not provided a dummy configuration file will be created). - Add sections based on
git hooks namesfollowed by acommandproperty with the shell code you want to run. - Run either
python -m python_githooksorgithooksin your virtual environment.
Configuration file example:
# .githooks.ini
[pre-commit]
command = pytest --cov
[pre-push]
command = pytest --cov && flake8
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.
Unuse
- Running
python -m python_githooks --deactivateorgithooks --deactivatewill stop shimming git hooks but keep the commands in.git/hooks - Run
rm .githooks.inito remove the configuration file (optional). rm .git/hooks/pre-commitor any other githook to stop them from executing (optional). e.g.rm .git/hooks/*
License
py-githooks is MIT-licensed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py-githooks-1.1.1.tar.gz.
File metadata
- Download URL: py-githooks-1.1.1.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.2.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7be404d01ab489a883440300884b8ea89ad98bf7f159b6598136ea67e39ff704
|
|
| MD5 |
3ca9d6311f4ed950337cf17e62b7e964
|
|
| BLAKE2b-256 |
07b8c294e740f080e2cb812a844ddbaa16deabf2080a1d2f8adfa7aba74b3ccf
|
File details
Details for the file py_githooks-1.1.1-py3-none-any.whl.
File metadata
- Download URL: py_githooks-1.1.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.2.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23adc01f3042fab2e38da2ca97e14ba066b7f2d89b8e53ec5358c71850dd7a18
|
|
| MD5 |
1acfa7758ec863e08769808e6b585c10
|
|
| BLAKE2b-256 |
a411d3ab177ea46a0a6d8a016fd4f6bba28b938752faaea459b34b44bc80f945
|