Git configs for a python project
Description: Meta-documentation for project workflow, Git setup, and code quality tools
Meta Documentation - Project Workflow & Git Setup
This document describes the complete development workflow, Git configuration, and code quality tools used in the EQUO project. Use this as a blueprint for setting up similar Python projects with UV package management.
🛠️ Technology Stack
Core Tools
- Python: 3.11+
- Package Manager: UV - Fast Python dependency management
- Web Framework: Flask 3.0+
- AI Framework: LangGraph + LangChain + OpenAI
- Data Validation: Pydantic
- Testing: Pytest with coverage
Code Quality Tools
- Formatter: Black (code formatting)
- Import Sorter: isort (import organization)
- Linter: flake8 (code style and error checking)
- Type Checker: mypy (static type analysis) - currently disabled
- Pre-commit: Automated quality checks before commits
📁 Configuration Files
.flake8
- Linting
Configuration
1 |
|
Key Settings: - Line Length: 120
characters (compatible with Black's default 88 + buffer) -
Ignored Rules: - E203
: Whitespace before
':' (conflicts with Black) - W503
: Line break before binary
operator (conflicts with Black)
.pre-commit-config.yaml
- Pre-commit Hooks
1 |
|
🔄 Development Workflow
Initial Project Setup
Create project structure:
1
2mkdir new-project && cd new-project
git initSet up UV and dependencies:
1
2
3
4
5
6
7
8# Initialize UV project
uv init --package
# Add core dependencies
uv add flask pydantic pytest pytest-cov
# Add development dependencies
uv add --dev black isort flake8 pre-commit mypyCopy configuration files:
1
2# Copy these files from EQUO project
cp .flake8 .pre-commit-config.yaml new-project/Install pre-commit hooks:
1
2uv run pre-commit install
uv run pre-commit install --hook-type commit-msg
Daily Development Commands
1 |
|
Git Workflow
Conventional Commit Format
All commits must follow the conventional commit format:
Pattern: type(scope): description
Valid Types: - feat
: New feature -
fix
: Bug fix - docs
: Documentation changes -
style
: Code style changes (formatting, no logic change) -
refactor
: Code refactoring - test
: Adding or
updating tests - chore
: Maintenance tasks -
perf
: Performance improvements - ci
: CI/CD
changes - build
: Build system changes -
revert
: Reverting previous commits
Examples: 1
2
3
4
5git commit -m "feat: add user authentication"
git commit -m "fix(api): resolve login endpoint error"
git commit -m "docs: update README.md"
git commit -m "test: add unit tests for user service"
git commit -m "refactor(agent): improve error handling"
Pre-commit Workflow
Every commit automatically runs:
- File Quality Checks:
- Remove trailing whitespace
- Fix end-of-file formatting
- Validate YAML/JSON/TOML files
- Check for large files and merge conflicts
- Code Quality:
- Black formatting
- isort import sorting
- flake8 linting
- Testing:
- Full pytest suite must pass
- Commit Message:
- Validates conventional commit format
Example commit process: 1
2
3
4
5
6
7
8# Make changes
git add .
# Commit (triggers all pre-commit hooks)
git commit -m "feat: add new financial analysis feature"
# If any hooks fail, fix issues and recommit
# Hooks run automatically on every commit attempt
🧪 Testing Configuration
Pytest Setup
File: pyproject.toml
1
2
3
4
5
6
7
8
9
10[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = [
"--strict-markers",
"--strict-config",
"--verbose",
]
Coverage Configuration
1 |
|
📦 Package Management with UV
Core UV Commands
1 |
|
UV Project Structure
1 |
|
🚀 Project Template Checklist
To replicate this workflow in a new project:
✅ Essential Files to Copy
✅ Setup Commands
1 |
|
✅ Development Environment
🔧 Troubleshooting
Common Issues
Pre-commit Hook Failures
1 |
|
Flake8 Line Length Issues
- Solution: Use Black formatting (88 chars) + flake8 config (120 chars max)
- Fix: Run
uv run black .
before committing
Import Sorting Issues
- Solution: Run
uv run isort .
to fix import order - Configuration: isort uses "black" profile for compatibility
Test Failures
- Solution: Fix failing tests before committing
- Bypass: Use
--no-verify
flag (not recommended)
Environment Issues
1 |
|
📋 Quality Standards
This workflow enforces:
- Code Formatting: Consistent style with Black
- Import Organization: Clean imports with isort
- Code Quality: Linting with flake8
- Type Safety: Type hints required (mypy ready)
- Test Coverage: All tests must pass before commit
- Commit Messages: Conventional commit format
- File Quality: No trailing whitespace, proper line endings
🔗 Related Tools
- UV Documentation - Fast Python package manager
- Pre-commit - Git hooks framework
- Black - Python code formatter
- flake8 - Python linter
- Conventional Commits - Commit message standard
🎯 Result: A robust, consistent development workflow that enforces code quality, testing, and proper Git practices across all team members and projects.