Skip to main content

A wrapper for pre-commit.

Project description

Wrapper for https://pre-commit.com, so wre-commit

Extensions

  • Run pre-commit:
    • in Docker container when ### wre-commit-docker-image: ... is found in the config file
    • or directly calling locally installed pre-commit
  • Support multiple configurations using:
    • multiple config files using shell wildcards in option --config, by default .pre-commit-config*.yaml, with respecting the fail_fast config setting.
    • multi-doc YAML config files, with respecting the fail_fast config setting.

Installation into system

Install the wraper into system by command:

pip3 install --upgrade wre-commit

Then a script wre-commit is available in the $PATH.

Installation into Git repository

Install this script as .git/hooks/pre-commit into your Git repository by running the command:

wre-commit install

Add option -t or --hook-type to specify another/more hook(s) to install.

Uninstallation from Git repository

Uninstall this script as .git/hooks/pre-commit from your Git repository by running the command

wre-commit uninstall

Add option -t or --hook-type to specify another/more hook(s) to uninstall.

Usage

Place the line ### wre-commit-docker-image: DOCKER_IMAGE (without quotes) into your pre-commit config file, typically .pre-commit-config.yaml. Replace the DOCKER_IMAGE with the Docker image name in format expected by command docker run. That image should have pre-commit installed, possibly with other binaries and hook repository dependencies. Then pre-commit in that container will be triggered with your repository dir read-write visible.

You can also call the pre-commit in the Docker container directly, f.e.:

wre-commit run --all-files

If no such line is present in the pre-commit config file, then the locally installed pre-commit will be called as usuall.

Debugging

Set environment variable WRE_COMMIT_DEBUG to see debug messages on standard error:

  • of the executed commands
  • about splitting multi-doc config files

Requirements

  • python3 AND:
    • locally installed and running docker OR:
    • locally installed pre-commit

Developing

Update versions

  • in wre_commit/main.py
  • in setup.cfg

Ensure local dependencies

python3 -m pip install --user --upgrade setuptools wheel twine

Build PyPi package

rm -rf dist
python3 setup.py sdist bdist_wheel

Upload package to PyPi

python3 -m twine upload dist/*

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

wre_commit-1.0.6.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wre_commit-1.0.6-py2.py3-none-any.whl (19.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file wre_commit-1.0.6.tar.gz.

File metadata

  • Download URL: wre_commit-1.0.6.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.4.0 requests-toolbelt/0.9.1 tqdm/4.48.1 CPython/3.7.7

File hashes

Hashes for wre_commit-1.0.6.tar.gz
Algorithm Hash digest
SHA256 e4585fbbc417b439996a44630f926f3ff2d281a41e4ec9f4d5a106c9620fcf0f
MD5 2d96a15e75a342ee942e63e16425d28b
BLAKE2b-256 4a4587039df92ddf626628d2dac3e8b17666103a41fd7dae41c8c2cf7ea37754

See more details on using hashes here.

File details

Details for the file wre_commit-1.0.6-py2.py3-none-any.whl.

File metadata

  • Download URL: wre_commit-1.0.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.4.0 requests-toolbelt/0.9.1 tqdm/4.48.1 CPython/3.7.7

File hashes

Hashes for wre_commit-1.0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e87146d32a59590e1197c0b8ae6b4c00f84715359cac24bc0e7451b63199d0ab
MD5 3b8bb1e4042f6ccaafc93416dae4a132
BLAKE2b-256 b3865cea333421d9d3b54cb5de09ae875e9fa7c5297c06b4fea808697cca42cc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page