A modern, opinionated Python project template featuring FastAPI, Typer CLI, and OpenCode AI integration.
- 🚀 Modern Python - Python 3.14+ with strict type hints
- 📦 uv - Fast, reliable dependency management
- 🔧 Ruff - Lightning-fast linting and formatting
- 🔍 ty - Fast type checking
- 🌐 FastAPI - High-performance async API framework
- ⌨️ Typer - Beautiful CLI with auto-completion
- 🧪 pytest - Comprehensive testing with 90% coverage requirement
- 🤖 OpenCode - AI agent and skill integration
- 🔄 Semantic Release - Automated versioning and changelog
- 🐳 Container Ready - Multi-stage Containerfile for production
- 🔒 Security - Ruff and CodeQL scanning
- 📚 MkDocs - Beautiful documentation with Material theme
- just - Command runner (the only prerequisite!)
=== "Cargo"
bash cargo install just
=== "Homebrew"
bash brew install just
=== "Arch Linux"
bash pacman -S just
=== "apt (Debian/Ubuntu)"
bash apt install just
See just installation for more options.
# Clone the repository
git clone https://github.com/nahuel11500/python-template-project.git
cd python-template-project
# Setup everything (installs uv, Python 3.14, OpenCode, dependencies, pre-commit hooks)
just setupThat's it! just setup automatically installs:
- uv - Fast Python package manager
- Python 3.14 - Via uv
- OpenCode - AI coding agent
- All project dependencies - Including ruff, ty, pytest, etc.
- Pre-commit hooks - For code quality and conventional commits
# Start the development server
just dev
# Run the CLI
just cli --help
just cli hello World
just cli info
# Run all quality checks and tests
just check-allNote: just check-all expects dev dependencies (like pytest). If you ran just install
without extras, run uv sync --all-extras before just check-all.
just # Show all available commands
just install # Install dependencies
just setup # Install deps + pre-commit hooks
just dev # Start dev server with hot reload
just test # Run tests with coverage
just test-unit # Run unit tests only
just lint # Lint and auto-fix
just format # Format code
just typecheck # Type check with ty
just check # Run all quality checks
just docs # Serve documentation locally
just clean # Remove build artifactspython-template-project/
├── src/python_template/ # Main package
│ ├── api/ # FastAPI application
│ │ └── app.py # API routes and setup
│ ├── core/ # Business logic
│ │ └── config.py # Settings management
│ └── cli.py # Typer CLI
├── tests/ # Test suite
│ ├── unit/ # Unit tests
│ └── integration/ # Integration tests
├── docs/ # MkDocs documentation
├── .opencode/ # OpenCode agent configs
│ ├── agents/ # Custom AI agents
│ └── skills/ # Reusable skills
├── .github/ # GitHub Actions workflows
├── pyproject.toml # Project configuration
├── justfile # Task automation
├── Containerfile # Container build
└── AGENTS.md # OpenCode instructions
This template includes OpenCode AI integration for enhanced development:
- test-generator: Generate pytest tests from source code
- reviewer: Code review agent with read-only access
See AGENTS.md for detailed agent instructions.
# Build the container
just container-build
# Run the container
just container-run
# Or manually
podman build -f Containerfile -t python-template:latest .
podman run -p 8000:8000 python-template:latest# Serve documentation locally
just docs
# Build documentation
just docs-buildVisit http://localhost:8000 after running just docs.
| Variable | Default | Description |
|---|---|---|
APP_NAME |
python-template | Application name |
DEBUG |
false | Enable debug mode |
HOST |
0.0.0.0 | Server host |
PORT |
8000 | Server port |
LOG_LEVEL |
INFO | Logging level |
Create a .env file for local development:
DEBUG=true
LOG_LEVEL=DEBUGContributions are welcome! Please read CONTRIBUTING.md for guidelines.
This project uses Conventional Commits:
<type>(<scope>): <description>
# Examples
feat(api): add user authentication endpoint
fix(cli): handle missing config file gracefully
docs(readme): update installation instructions
Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore
This project is licensed under the MIT License - see the LICENSE file for details.