Skip to content
/ pre-commit-hooks Public template

Streamline Python code quality with pre-configured hooks for black, isort, flake8, and autoflake, ensuring consistent and clean code in every commit

License

Notifications You must be signed in to change notification settings

theopsall/pre-commit-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Pre-Commit Configuration for Python Projects

This repository contains a pre-commit configuration tailored for Python projects. It integrates tools like black, isort, flake8, and autoflake to enforce code quality and style consistency.

Description

This pre-commit setup is designed to streamline Python code formatting and linting processes. It ensures your code is clean, readable, and adheres to best practices before every commit.

Installation

To use this pre-commit configuration in your project, follow these steps:

  1. Install pre-commit:

    If not already installed, install pre-commit globally with:

    pip install pre-commit
  2. Clone This Repository:

    Clone this repository into your local machine:

    git clone https://github.com/theopsall/pre-commit-hooks
  3. Copy Configuration to Your Project:

    Copy the .pre-commit-config.yaml file from this repository to the root of your project.

  4. Install Hooks:

    Navigate to your project's root directory and install the pre-commit hooks:

    pre-commit install

Usage

Once installed, pre-commit will run automatically on git commit. However, you can also run it manually on all files:

  • To run on all files:
    pre-commit run --all-files
  • To format a specific file: Run pre-commit for a specific file with:
    pre-commit run --files your-file.py

Updating Hooks

To update the hooks to their latest versions:

pre-commit autoupdate

About

Streamline Python code quality with pre-configured hooks for black, isort, flake8, and autoflake, ensuring consistent and clean code in every commit

Topics

Resources

License

Stars

Watchers

Forks