Skip to main content

python-githooks

code linting: flake8 code quality: pytest MIT license CircleCI

Create git hooks with ease using a simple configuration file in a git project

Install

pip install python-githooks

Usage

  1. Create a .githooks.ini configuration file(If not provided a dummy configuration file will be created).
  2. Add sections based on git hooks names followed by a command property with the shell code you want to run.
  3. Run either python -m python_githooks or githooks 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 or githooks 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.

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)

Source distribution for python-githooks 1.0.7
File Size Uploaded
python-githooks-1.0.7.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-githooks 1.0.7
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

1.0.7 This release

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page