Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

Run pre-commit code checkers

Project Description

This script does any number of checks like unittests or pylint checks before git commit. If at least one check will not pass, commit is aborted.

Checks are treated as jobs divided among couple of workers. Number of workers is equal to number of your cpu logical cores, every worker is executed in separate process.

Some checks are performed on whole project (unittest), other checks are performed on every file (e.g. pylint). Only files added to git staging area are taken into account during jobs creation.

See Currently supported checkers

See for example usage.


  2. git submodule add
  3. cp GitHooks/samples/ ./
  4. cp GitHooks/samples/pre-commit .git/hooks/pre-commit; chmod +x .git/hooks/pre-commit

Make sure that every requirement of checkers (pylint, pep8 etc.) are installed in your system or active virtual environment. You should install them manually.


To customize pre-commit checking edit copied to parent repository. Purpose of is to create checker jobs and send them to execution in last step. In this file you can specify which checkers for which files will be created.

Currently supported checkers


Description:Run system shell command and fail if exit code is non 0

Usage: Create ExitCodeChecker object with arguments:

  1. command to execute (string)
  2. task name displayed before result in console
# ...
from checker import ExitCodeChecker
# ...
jobs = []
# ...
jobs.append(ExitCodeChecker('python3 -m unittest discover .',
                            'python unittest'))
Example result:
* python unittest: OK


Description:Check passes if pylint code rate for particular file is greather or equal to accepted code rate. Accepted code rate is


# ...
from checker import PylintChecker
# ...
jobs = []
# ...
jobs.append(PylintChecker(file_name, ACCEPTED_PYLINT_RATE))
Release History

Release History

This version
History Node

History Node

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
GitHooks- (6.1 kB) Copy SHA256 Checksum SHA256 Source Nov 3, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting