A standardized template for bootstrapping Generative AI applications. This template provides a solid foundation with a pre-configured development environment, modern tooling, and a logical project structure.
This template is packed with modern tools to ensure a smooth, efficient, and high-quality development experience.
-
📦 Development Environment:
- Dev Containers: Fully configured, consistent, and reproducible development environment using Docker.
- uv: Extremely fast Python package installer and resolver. Used for dependency management and running tasks, it's a significant speed upgrade over
pip
.
-
✅ Code Quality & Automation:
- Pre-commit Hooks: Framework for managing and maintaining pre-commit hooks. Ensures code quality checks are run automatically before any code is checked in.
- Ruff: Extremely fast Python linter and code formatter. Replaces
black
,isort
,flake8
, and many other tools. - basedpyright: Powerful and performant static type checker based on Microsoft's
pyright
. - deptry: Command-line utility to check for obsolete, missing, and unused dependencies.
- Conventional Commits: Enforces a standardized commit message format to create an explicit and readable commit history.
-
🔧 Application & API:
-
🧪 Testing:
- Pytest: Mature, full-featured Python testing tool that makes it easy to write simple, scalable tests.
The project follows a standard layout for scalability and maintainability.
└── ./
├── .devcontainer/ # Dev Container configuration (Dockerfile, etc.)
├── app/ # Main application source code
│ ├── core/ # Core business logic (services)
│ ├── models/ # Pydantic models (data structures)
│ ├── prompts/ # Jinja2 prompt templates
│ ├── routers/ # FastAPI endpoints (controllers)
│ ├── utils/ # Utility functions
│ ├── config.py # Application settings
│ └── main.py # Application entrypoint
├── data/ # For storing data files (e.g., CSV, JSON)
├── notebooks/ # Jupyter notebooks for experimentation
├── tests/ # Tests
│ ├── component/
│ ├── integration/
│ └── unit/
├── .gitignore
├── .pre-commit-config.yaml # Configuration for pre-commit hooks
├── pyproject.toml # Project metadata and dependencies (for uv)
└── uv.lock # Pinned versions of all dependencies
Follow these steps to bootstrap your new project. You can choose to use the pre-configured Dev Container or set it up locally.
This is the easiest way to get started, as it provides a consistent and fully-equipped environment out of the box.
Prerequisites:
Steps:
- Create from Template: Click "Use this template" at the top of the repository page to create your new project.
- Clone the Repository: Clone your newly created repository to your local machine.
- Open in Pycharm /VS Code: Open the cloned repository folder in Pycharm / VS Code.
- Reopen in Container: Pycharm / VS Code will detect the
.devcontainer
and prompt you to reopen the project in a container. Click "Reopen in Container".
That's it! The container will build, create a virtual environment, install all dependencies, and set up pre-commit hooks automatically.
If you prefer not to use a Dev Container, you can set up the project locally.
Prerequisites:
- Python
~=3.13
- uv: You'll need to install
uv
. You can do this with methods described in the uv installation guide.curl -LsSf https://astral.sh/uv/install.sh | sh
Steps:
- Create from Template & Clone: Create your repository using the template and clone it locally.
- Create Virtual Environment: Navigate to the project's root directory, create a virtual environment.
uv venv
- Activate Virtual Environment:
- macOS/Linux (bash/zsh):
source .venv/bin/activate
- macOS/Linux (bash/zsh):
- Install Dependencies: Sync your environment with the locked dependencies.
uv sync
- Install Pre-commit Hooks: Set up the git hooks in your local repository.
uv run pre-commit install --install-hooks
Your local environment is now set up and ready for development.
-
To add a new dependency:
uv add <package-name>
This will add it to your
pyproject.toml
and updateuv.lock
. -
To install all dependencies from
pyproject.toml
(e.g., after pulling changes):uv sync
- To run the entire test suite (unit and component tests), use the following command:
uv run pytest
The pre-commit hooks will automatically run ruff
to format and lint your code on every commit. You can also run it manually:
- Format code:
uv run ruff format
- Lint and auto-fix code:
uv run ruff check
Application settings are managed in app/config.py
using Pydantic's BaseSettings
. You can create a .env
file in the project root to override default settings (e.g., for API keys). A .gitignore
entry is already in place to prevent committing this file.
# .env file
OPENAI_API_KEY="your-secret-key-here"
LOG_LEVEL="DEBUG"