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.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.
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
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 python-githooks-1.0.7.tar.gz.
File metadata
- Download URL: python-githooks-1.0.7.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48585f31284c7a06ac9603e693a7d0b7882eae64edaf4e3acd80e83e80bcfc75
|
|
| MD5 |
e70ce196f6bf782e7b81c019e5984d4f
|
|
| BLAKE2b-256 |
592a4b18d6851cb092313637c5f3dc5933b9af2cbdc27f9fe1d4e00c52bb9e2e
|
File details
Details for the file python_githooks-1.0.7-py3-none-any.whl.
File metadata
- Download URL: python_githooks-1.0.7-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aca1f2e7e3012532b1f8505a07f9879613325b7cc64c115aff0457a8f39dba5
|
|
| MD5 |
5582528d49a3a24c70f8c576aeb41ca2
|
|
| BLAKE2b-256 |
b7a0d6137ce853fc1857688aa5e53247adf26c65a9bb167801cc6f0d79534e8d
|