A modern Python project template with uv, pre-commit hooks, ruff, and pylint for code quality and formatting.
- UV Package Manager: Fast, modern Python package management
- Pre-commit Hooks: Automated code quality checks before commits
- Ruff: Lightning-fast Python linter and formatter
- Pylint: Comprehensive Python code analysis
- GitHub Actions: Pre-configured CI/CD workflow
- Code Quality: Best practices for Python development
- Python 3.9 or higher
- uv package manager
-
Use this template to create a new repository on GitHub
-
Clone your new repository:
git clone https://github.com/yourusername/your-repo-name.git cd your-repo-name- Install uv (if not already installed):
# On macOS and Linux curl -LsSf https://astral.sh/uv/install.sh | sh # On Windows powershell -c "irm https://astral.sh/uv/install.ps1 | iex"- Create and activate a virtual environment:
uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate- Install pre-commit hooks:
uv pip install pre-commit pre-commit install-
Update
pyproject.tomlwith your project details:- Change
nameto your project name - Update
description - Add your author information
- Add your project dependencies
- Change
-
Customize tool configurations in
pyproject.toml:- Ruff settings (linting and formatting)
- Pylint rules
- Other tool configurations as needed
# Add a runtime dependency uv pip install package-name # Add a development dependency uv pip install --dev package-name# Run ruff linter ruff check . # Run ruff formatter ruff format . # Run pylint pylint your_module/ # Run all pre-commit hooks manually pre-commit run --all-filesPre-commit hooks automatically run on every commit. They include:
- Ruff linting and formatting
- Pylint code analysis
- Trailing whitespace removal
- End of file fixing
- YAML, TOML, and JSON validation
- Large file detection
- Private key detection
. ├── .github/ │ └── workflows/ # GitHub Actions workflows ├── .pre-commit-config.yaml # Pre-commit configuration ├── pyproject.toml # Project metadata and tool configuration ├── .gitignore # Git ignore rules ├── README.md # This file ├── LICENSE # Project license ├── CONTRIBUTING.md # Contribution guidelines ├── CODE_OF_CONDUCT.md # Code of conduct └── SECURITY.md # Security policy See CONTRIBUTING.md for guidelines on how to contribute to this project.
This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.
For security concerns, please see SECURITY.md.
This project is licensed under the MIT License - see the LICENSE file for details.