https://github.com/theopsall/pre-commit-hooks
Streamline Python code quality with pre-configured hooks for black, isort, flake8, and autoflake, ensuring consistent and clean code in every commit
https://github.com/theopsall/pre-commit-hooks
autoflake black flake8 isort pre-commit pre-commit-config pre-commit-hook python python3
Last synced: about 15 hours ago
JSON representation
Streamline Python code quality with pre-configured hooks for black, isort, flake8, and autoflake, ensuring consistent and clean code in every commit
- Host: GitHub
- URL: https://github.com/theopsall/pre-commit-hooks
- Owner: theopsall
- License: apache-2.0
- Created: 2024-04-03T15:33:09.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2026-01-02T19:32:13.000Z (3 months ago)
- Last Synced: 2026-01-09T08:19:31.599Z (3 months ago)
- Topics: autoflake, black, flake8, isort, pre-commit, pre-commit-config, pre-commit-hook, python, python3
- Homepage:
- Size: 11.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```bash
pip install pre-commit
```
2. **Clone This Repository**:
Clone this repository into your local machine:
```bash
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:
```bash
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:
```bash
pre-commit run --all-files
```
- To format a specific file:
Run pre-commit for a specific file with:
```bash
pre-commit run --files your-file.py
```
# Updating Hooks
To update the hooks to their latest versions:
```bash
pre-commit autoupdate
```
Helpful medium [article](https://gatlenculp.medium.com/effortless-code-quality-the-ultimate-pre-commit-hooks-guide-for-2025-57ca501d9835)
https://github.com/astral-sh/ruff-pre-commit
https://github.com/astral-sh/uv-pre-commit