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.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 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_githooksorgithooksevery 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.
Release files for python-githooks 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python-githooks-1.0.7.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_githooks-1.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.6 kB
Release files / python-githooks-1.0.7.tar.gz
| Download URL | python-githooks-1.0.7.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
48585f31284c7a06ac9603e693a7d0b7882eae64edaf4e3acd80e83e80bcfc75
|
|
BLAKE2b-256 checksum How to use checksums |
592a4b18d6851cb092313637c5f3dc5933b9af2cbdc27f9fe1d4e00c52bb9e2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.6
|
Release files / python_githooks-1.0.7-py3-none-any.whl
| Download URL | python_githooks-1.0.7-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4aca1f2e7e3012532b1f8505a07f9879613325b7cc64c115aff0457a8f39dba5
|
|
BLAKE2b-256 checksum How to use checksums |
b7a0d6137ce853fc1857688aa5e53247adf26c65a9bb167801cc6f0d79534e8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.6
|