Skip to main content

py-githooks

code linting: flake8 code quality: pytest MIT license CircleCI Coverage Status Dependabot badge

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

Install

pip install py-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 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

  1. Running python -m python_githooks --deactivate or githooks --deactivate will stop shimming git hooks but keep the commands in .git/hooks
  2. Run rm .githooks.ini to remove the configuration file (optional).
  3. rm .git/hooks/pre-commit or any other githook to stop them from executing (optional). e.g. rm .git/hooks/*

License

py-githooks is MIT-licensed.

Metadata

Release files for py-githooks 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-githooks 1.1.1
File Size Uploaded Provenance Actions
py-githooks-1.1.1.tar.gz 5.1 kB Without provenance Details for py-githooks-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py-githooks 1.1.1
File Interpreter ABI Platform Actions
py_githooks-1.1.1-py3-none-any.whl Python 3 none any Details for py_githooks-1.1.1-py3-none-any.whl

Total release size: 11.3 kB

Release files / py-githooks-1.1.1.tar.gz

Download URL py-githooks-1.1.1.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7be404d01ab489a883440300884b8ea89ad98bf7f159b6598136ea67e39ff704
BLAKE2b-256 checksum
How to use checksums
07b8c294e740f080e2cb812a844ddbaa16deabf2080a1d2f8adfa7aba74b3ccf
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / py_githooks-1.1.1-py3-none-any.whl

Download URL py_githooks-1.1.1-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23adc01f3042fab2e38da2ca97e14ba066b7f2d89b8e53ec5358c71850dd7a18
BLAKE2b-256 checksum
How to use checksums
a411d3ab177ea46a0a6d8a016fd4f6bba28b938752faaea459b34b44bc80f945
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for py-githooks 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files No provenance

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