This guide provides instructions for setting up your development environment, navigating the project structure, and adhering to our coding standards.
Ensure your system meets the following requirements before getting started:
- Docker (Recommended for isolated environments)
- Git (Version control)
- Python 3.10+
- Hatch (Project manager)
Note
We strongly recommend using our Docker setup to ensure your local environment exactly matches our CI/CD pipelines.
Important
The Dockerfile and docker-compose.yml files included in this template are placeholders that must be filled in for your specific language stack before they are usable. The default CMD in both files will exit with an error if run without modification.
Once implemented, you can spin up the development environment with:
git clone https://github.com/markurtz/template-python.git
cd template-python
# Build and start the development environment in the background
docker-compose up -d --buildTo view the logs of your running containers:
docker-compose logs -fIf you prefer to develop directly on your host machine, this project uses uv for environment management and dependency resolution, alongside Hatch as our command orchestrator.
Note
A note on shared tooling: This project uses MkDocs for documentation.
# 1. Install uv and hatch globally (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
uv tool install hatch
# 2. Optionally, set up a Python virtual environment
uv venv
source .venv/bin/activate
# 3. Sync the development environment (installs all dependency groups and extras)
uv sync --all-groups --all-extras
# 4. Run hatch commands directly
hatch run test:all
hatch run lint:checkUse uv to add or update dependencies efficiently:
# Add a general dependency
uv add <package>
# Add a development dependency
uv add --group dev <package>
# Add to a specific extra
uv add <package> --optional <extra_name>
# Sync targeted groups or extras
uv sync --group dev
uv sync --extra <extra_name>We maintain strict testing standards. Our tests are located in the tests/ directory and are categorized by tier.
| Test Tier | Directory | Description |
|---|---|---|
| Unit | tests/unit/ |
Fast, isolated tests for individual functions and classes. |
| Integration | tests/integration/ |
Slower tests that verify interactions between multiple components. |
| End-to-End | tests/e2e/ |
Full-stack tests simulating real user workflows. |
Replace the commands below with those appropriate for your language stack:
# Run unit tests
hatch run test:unit
# Run integration tests
hatch run test:integration
# Run all tests with coverage
hatch run test:all-covWe use opinionated formatters and linters to maintain consistency: Ruff for linting/formatting and Mypy for static type checking.
- Formatters & Linters:
# Check for linting and formatting issues hatch run lint:check hatch run types:check # Auto-format code hatch run lint:format
Tip
IDE Configuration: We highly recommend configuring your editor (e.g., VSCode, IntelliJ) to format on save using the project's formatting tools. For VSCode, ensure you have the relevant extensions installed and check .vscode/settings.json if available.
We use pre-commit to ensure code quality standards are met before changes are committed. This repository is configured to use our existing Hatch environments for these checks, guaranteeing consistency with CI/CD pipelines.
Setup:
-
Install pre-commit globally or in your local virtual environment:
uv pip install pre-commit
-
Install the git hook scripts:
pre-commit install
Usage:
Once installed, pre-commit will automatically run on the modified files whenever you commit. To run the hooks manually on all files:
pre-commit run --all-filesWe follow a structured branching strategy to maintain a clean git history.
-
Branch Naming:
- Feature branches:
feature/short-description - Bug fixes:
bugfix/short-description - Documentation:
docs/short-description
- Feature branches:
-
Commit Messages: We encourage following Conventional Commits.
feat: add new user endpointfix: resolve crash on startupdocs: update developing guide
-
Pull Requests:
- Push your branch to the remote repository.
- Open a Pull Request against the
mainbranch. - Ensure all CI checks (tests, linters) pass.
- Request a review from at least one core maintainer.
This repository uses a modular, standardized GitHub Actions architecture. Workflows are divided into core lifecycle events and reusable helper templates.
| Workflow | Trigger | Purpose |
|---|---|---|
Development (development.yml) |
Pull Request to main |
Runs quality gates, security audits, unit/integration tests, and builds documentation previews. Blocks merges if checks fail. |
Main (main.yml) |
Push to main |
Post-merge validation. Runs unit/integration/e2e tests, quality/security checks, and updates the latest documentation. |
Nightly (nightly.yml) |
Cron (Daily 00:00 UTC) | Runs extended regression tests, alpha builds, nightly documentation deployment, and deeper security analysis. |
Release (release.yml) |
Push of v*.*.* tag |
Performs full verification, builds immutable release packages, versioned documentation, and publishes artifacts. |
Weekly (weekly.yml) |
Cron (Sun 00:00 UTC) | Conducts dependency hygiene and full test suite regression to catch configuration drift. |
- Safe PR Commenting: The
pr_comment.ymlworkflow usesworkflow_runto securely post CI status comments on pull requests, circumventing write permission limits on forks. - Environment Cleanup: When a PR is closed or merged,
development_cleanup.ymlautomatically removes ephemeral documentation environments and artifacts to maintain a clean workspace.
Our pipelines rely on modular templates located in .github/workflows/_*.yml (e.g., _tests.yml, _quality.yml, _docs.yml, _security.yml, _build_package.yml). This ensures testing granularity and linting rules remain perfectly consistent across all stages of the software lifecycle.
Our documentation is built using MkDocs Material. To preview documentation changes locally:
# Hatch manages the isolated docs environment
# Serve documentation on http://127.0.0.1:8000 with hot-reload
hatch run docs:serveFor further assistance, please refer to our SUPPORT.md.