Skip to content

Commit 177bdd8

Browse files
committed
📝 docs: add mkdocs
1 parent c17f289 commit 177bdd8

20 files changed

Lines changed: 900 additions & 1 deletion

.github/workflows/docs.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "docs/**"
9+
- "mkdocs.yml"
10+
pull_request:
11+
paths:
12+
- "docs/**"
13+
- "mkdocs.yml"
14+
workflow_dispatch:
15+
16+
permissions:
17+
contents: write
18+
19+
concurrency:
20+
group: docs-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
docs:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
31+
- uses: astral-sh/setup-uv@v6
32+
33+
- uses: actions/setup-python@v5
34+
with:
35+
python-version: "3.12"
36+
37+
- name: Install dependencies
38+
run: uv pip install --system -r docs/requirements.txt
39+
40+
- name: Build documentation
41+
if: github.event_name == 'pull_request'
42+
run: mkdocs build --strict
43+
env:
44+
CI: "true"
45+
46+
- name: Deploy documentation
47+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
48+
run: mkdocs gh-deploy --force
49+
env:
50+
CI: "true"
51+
DEPLOY: "true"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ A modern, batteries‑included [Copier](https://github.com/copier-org/copier) te
7373
- **Dependency Updates** (optional): Choose between Dependabot or self-hosted Renovate via the `dependency_updater` template variable.
7474
- **Dependabot** (`dependabot.yml`): Opens weekly PRs to keep GitHub Actions dependencies up to date.
7575
- **Renovate** (`renovate.yaml` + `renovate.json5`): Self-hosted via GitHub Actions. Updates all dependencies (Python packages, pre-commit hooks, GitHub Actions, lock files) with smart grouping and automerge.
76-
Supports PAT or GitHub App authentication via the `renovate_auth_method` variable. See the [Renovate setup guide](docs/renovate-setup.md) for detailed instructions.
76+
Supports PAT or GitHub App authentication via the `renovate_auth_method` variable. See the [Renovate setup guide](renovate-setup.md) for detailed instructions.
7777

7878
These workflows are generated into `.github/workflows/` in the scaffolded project. You can customize them further as needed.
7979

docs/configuration/variables.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Template Variables
2+
3+
When running `copier copy`, you'll be prompted for the following variables. They control what gets generated in your project.
4+
5+
## Project Information
6+
7+
| Variable | Description | Default |
8+
|----------|-------------|---------|
9+
| `project_name` | Project name (lowercase, letters/digits/dashes) | Current folder name |
10+
| `project_description` | Short summary of what your project does | -- |
11+
| `project_keywords` | Comma-separated keywords for the package | `python,<project_name>` |
12+
| `author_fullname` | Your full name | From `git config` |
13+
| `author_email` | Your email address | From `git config` |
14+
15+
## Repository
16+
17+
| Variable | Description | Default |
18+
|----------|-------------|---------|
19+
| `repository_provider` | Where you host your repo (`github` or `other`) | `github` |
20+
| `author_github_handle` | Your GitHub username | Derived from `author_fullname` |
21+
| `homepage` | Project homepage URL | `https://<user>.github.io/<project>` |
22+
| `repository` | Repository URL | `https://github.com/<user>/<project>` |
23+
| `documentation` | Documentation URL | Same as `homepage` |
24+
25+
## Python
26+
27+
| Variable | Description | Default |
28+
|----------|-------------|---------|
29+
| `python_version` | Default Python version for development | `3.12` |
30+
| `min_python_version` | Minimum supported Python version | `3.10` |
31+
32+
## Features
33+
34+
| Variable | Description | Default |
35+
|----------|-------------|---------|
36+
| `with_typer_cli` | Include a [Typer](https://typer.tiangolo.com/) CLI scaffold | `false` |
37+
| `cli_name` | CLI command name (if Typer enabled) | `<project_name>` |
38+
| `with_strict_typing` | Enable strict typing with `py.typed` marker | `false` |
39+
| `with_settings` | Include [Pydantic Settings](https://docs.pydantic.dev/latest/concepts/pydantic_settings/) | `true` |
40+
| `with_doppler` | Add [Doppler](https://www.doppler.com/) secrets integration | `false` |
41+
| `doppler_project` | Doppler project name (if Doppler enabled) | `<project_name>` |
42+
43+
## Testing
44+
45+
| Variable | Description | Default |
46+
|----------|-------------|---------|
47+
| `tox` | Include Tox configuration for multi-version testing | `true` |
48+
| `pytest_xdist` | Enable parallel test execution with pytest-xdist | `false` |
49+
| `coverage_threshold` | Minimum test coverage percentage (0-100) | `100` |
50+
51+
## Commits & Releases
52+
53+
| Variable | Description | Default |
54+
|----------|-------------|---------|
55+
| `with_conventional_commits` | Enforce [Conventional Commits](https://www.conventionalcommits.org/) | `true` |
56+
| `cz_gitmoji` | Include emojis in commit messages | `true` |
57+
| `publish_to_pypi` | Publish releases to PyPI | `false` |
58+
59+
## Docker
60+
61+
| Variable | Description | Default |
62+
|----------|-------------|---------|
63+
| `dockerfile` | Generate Dockerfile and Compose files | `true` |
64+
| `privileged_container` | Run container as root | `false` |
65+
| `gpus` | Enable GPU support in Docker | `false` |
66+
67+
## Dependencies
68+
69+
| Variable | Description | Default |
70+
|----------|-------------|---------|
71+
| `dependency_updater` | Dependency update tool (`none`, `dependabot`, `renovate`) | `renovate` |
72+
| `renovate_auth_method` | Renovate auth method (`pat` or `github_app`) | `pat` |
73+
74+
## License
75+
76+
| Variable | Description | Default |
77+
|----------|-------------|---------|
78+
| `copyright_license` | Project license | `MIT License` |
79+
| `copyright_holder` | Copyright holder name | `<author_fullname>` |
80+
81+
!!! tip
82+
See the full variable definitions with validators in [`copier.yaml`](https://github.com/bassemkaroui/python-template-uv/blob/main/copier.yaml).

docs/css/overrides.css

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
11
html {
22
font-size: 18px;
33
}
4+
5+
/* Hero section */
6+
.hero {
7+
text-align: center;
8+
padding: 2rem 1rem 3rem;
9+
}
10+
11+
.hero-content h1 {
12+
font-size: 2.4rem;
13+
font-weight: 700;
14+
margin-bottom: 0.5rem;
15+
}
16+
17+
.hero-content p:first-of-type {
18+
font-size: 1.15rem;
19+
color: var(--md-default-fg-color--light);
20+
max-width: 40rem;
21+
margin: 0 auto 1.5rem;
22+
}
23+
24+
.hero-icon {
25+
color: var(--md-primary-fg-color);
26+
}
27+
28+
.hero .md-button {
29+
margin: 0.3rem;
30+
}
31+
32+
/* Feature grid cards */
33+
.grid.cards > ul > li {
34+
border: 1px solid var(--md-default-fg-color--lightest);
35+
border-radius: 0.4rem;
36+
transition: border-color 0.2s, box-shadow 0.2s;
37+
}
38+
39+
.grid.cards > ul > li:hover {
40+
border-color: var(--md-accent-fg-color);
41+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
42+
}

docs/features/ci-cd.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# CI/CD
2+
3+
The template generates GitHub Actions workflows for continuous integration, testing, and release automation.
4+
5+
## Main Pipeline (`main.yaml`)
6+
7+
The primary CI/CD workflow runs on pushes to `main` and pull requests:
8+
9+
- **Checks** -- Linting (Ruff), type checking (Mypy), documentation build
10+
- **Tests** -- Runs pytest across supported Python versions using a matrix strategy
11+
- **Releases** -- Automatically publishes releases when a Git tag is pushed
12+
- **Docs Deployment** -- Deploys MkDocs documentation to GitHub Pages
13+
- **Package Publishing** (optional) -- Publishes to PyPI if `publish_to_pypi` is enabled
14+
15+
## PR Thank You (`pr-thank-you.yaml`)
16+
17+
Posts a fun GIPHY comment on new pull requests using [`docker-action-pr-giphy-comment`](https://github.com/bassemkaroui/docker-action-pr-giphy-comment).
18+
19+
**Required secret:** `GIPHY_API_KEY`
20+
21+
To obtain one, sign up at [GIPHY Developers](https://developers.giphy.com/), create an app, and copy the API key.
22+
23+
## Dependency Updates
24+
25+
Choose your preferred dependency update tool via the `dependency_updater` variable:
26+
27+
### Renovate (`dependency_updater: renovate`)
28+
29+
Self-hosted via GitHub Actions. Updates all dependencies with smart grouping and automerge:
30+
31+
- Python packages and lock files
32+
- Pre-commit hooks
33+
- GitHub Actions
34+
- Docker base images
35+
36+
Supports PAT or GitHub App authentication via the `renovate_auth_method` variable. See the [Renovate setup guide](https://github.com/bassemkaroui/python-template-uv/blob/main/renovate-setup.md) for detailed instructions.
37+
38+
### Dependabot (`dependency_updater: dependabot`)
39+
40+
GitHub-native solution. Opens weekly PRs to keep GitHub Actions dependencies up to date.
41+
42+
## Required Secrets
43+
44+
| Secret | Required For | How to Set |
45+
|--------|-------------|------------|
46+
| `GIPHY_API_KEY` | PR thank-you comments | `gh secret set GIPHY_API_KEY` |
47+
| `PYPI_TOKEN` | PyPI publishing (if enabled) | `gh secret set PYPI_TOKEN` |
48+
| `RENOVATE_TOKEN` | Renovate with PAT auth | `gh secret set RENOVATE_TOKEN` |
49+
| `RENOVATE_APP_ID` | Renovate with GitHub App auth | `gh secret set RENOVATE_APP_ID` |
50+
| `RENOVATE_APP_PRIVATE_KEY` | Renovate with GitHub App auth | `gh secret set RENOVATE_APP_PRIVATE_KEY` |

docs/features/docker.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Docker
2+
3+
When `dockerfile: true` (the default), the template generates Docker configuration for both production and development use.
4+
5+
## Generated Files
6+
7+
| File | Purpose |
8+
|------|---------|
9+
| `Dockerfile` | Multi-stage production build |
10+
| `compose.yaml` | Production service definition |
11+
| `compose.override.yaml` | Development overrides (hot-reload, exposed ports) |
12+
13+
## Commands
14+
15+
```bash
16+
# Build Docker images
17+
make docker-build
18+
19+
# Start services
20+
make docker-start
21+
22+
# Stop and remove services
23+
make docker-stop
24+
```
25+
26+
## GPU Support
27+
28+
Enable GPU support by setting `gpus: true` during generation. This adds NVIDIA GPU configuration to the Docker setup:
29+
30+
- NVIDIA base image for CUDA support
31+
- GPU device requests in compose files
32+
- Appropriate runtime configuration
33+
34+
## Container Security
35+
36+
By default, the container runs as a non-root user matching your host UID/GID. Set `privileged_container: true` during generation if root access is required.
37+
38+
## Development Workflow
39+
40+
The `compose.override.yaml` file is loaded automatically by Docker Compose and adds:
41+
42+
- Volume mounts for live code reloading
43+
- Exposed ports for local development
44+
- Environment variable overrides

docs/features/documentation.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Documentation
2+
3+
Generated projects include a fully configured [MkDocs](https://github.com/mkdocs/mkdocs) setup with the [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) theme.
4+
5+
## What's Included
6+
7+
- **MkDocs Material** theme with dark/light mode, search, and navigation features
8+
- **mkdocstrings** for auto-generated API documentation from docstrings
9+
- **Code highlighting** with copy buttons and annotations
10+
- **Admonitions**, tabbed content, and other Material extensions
11+
12+
## Local Development
13+
14+
```bash
15+
# Serve docs with live reload (localhost:8080)
16+
make docs-serve
17+
18+
# Check that docs build without errors
19+
make docs-check
20+
```
21+
22+
## Deployment
23+
24+
```bash
25+
# Deploy to GitHub Pages
26+
make docs-deploy
27+
```
28+
29+
The CI/CD pipeline also deploys docs automatically on pushes to `main`.
30+
31+
## Structure
32+
33+
```
34+
docs/
35+
index.md # Landing page
36+
modules.md # Auto-generated API reference
37+
css/
38+
overrides.css # Custom styling
39+
mkdocs.yml # MkDocs configuration
40+
```
41+
42+
## API Documentation
43+
44+
The template uses [mkdocstrings](https://mkdocstrings.github.io/) with the Python handler to generate API docs from your source code docstrings. Simply document your modules and classes with docstrings, and they appear in the docs automatically.

docs/features/optional.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Optional Features
2+
3+
These features can be toggled during project generation via template variables.
4+
5+
## Typer CLI (`with_typer_cli`)
6+
7+
Scaffolds a [Typer](https://typer.tiangolo.com/) CLI application with:
8+
9+
- Entry point configured in `pyproject.toml`
10+
- CLI module with a sample command
11+
- Customizable CLI name via the `cli_name` variable
12+
13+
```bash
14+
# Install CLI globally after generation
15+
make setup-cli
16+
```
17+
18+
## Strict Typing (`with_strict_typing`)
19+
20+
Enables strict type checking and adds a `py.typed` marker file for [PEP 561](https://peps.python.org/pep-0561/) compliance. This signals to downstream consumers that your package ships inline type information.
21+
22+
## Pydantic Settings (`with_settings`)
23+
24+
Adds [Pydantic Settings](https://docs.pydantic.dev/latest/concepts/pydantic_settings/) for typed configuration management. Settings are loaded from environment variables with type validation and can be nested.
25+
26+
Enabled by default (`with_settings: true`).
27+
28+
## Doppler Integration (`with_doppler`)
29+
30+
Adds [Doppler](https://www.doppler.com/) integration for secure secret management. Doppler injects environment variables at runtime, which Pydantic Settings then validates and parses.
31+
32+
Requires `with_settings: true` and a Doppler project name (`doppler_project`).
33+
34+
## Parallel Testing (`pytest_xdist`)
35+
36+
Adds [pytest-xdist](https://github.com/pytest-dev/pytest-xdist) for parallel test execution, which can significantly speed up large test suites.
37+
38+
## Conventional Commits (`with_conventional_commits`)
39+
40+
Enforces the [Conventional Commits](https://www.conventionalcommits.org/) standard using [Commitizen](https://github.com/commitizen-tools/commitizen). Optionally includes [gitmoji](https://github.com/ljnsn/cz-conventional-gitmoji) for emoji-enhanced commit messages (`cz_gitmoji`).
41+
42+
Enables automated changelog generation and semantic version bumping via `make release`.

docs/features/overview.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Features Overview
2+
3+
python-template-uv generates a fully configured Python project with modern tooling. Here's what you get out of the box:
4+
5+
## Project Management
6+
7+
- **[Task Runner](task-runner.md)** -- All project tasks defined in `mise.toml` with a `Makefile` wrapper for convenience
8+
- **[uv](https://docs.astral.sh/uv/)** -- Fast Python package and project manager for dependency resolution and virtual environments
9+
10+
## Code Quality
11+
12+
- **[Quality Tools](quality-tools.md)** -- Ruff for formatting and linting, Mypy for type checking, pre-commit hooks for automated checks
13+
- **[Testing](testing.md)** -- pytest with coverage, optional parallel execution, and multi-version testing with Tox
14+
15+
## Infrastructure
16+
17+
- **[Documentation](documentation.md)** -- MkDocs with Material theme, auto-generated API docs, GitHub Pages deployment
18+
- **[Docker](docker.md)** -- Production Dockerfile, compose files, development overrides, optional GPU support
19+
- **[CI/CD](ci-cd.md)** -- GitHub Actions workflows for testing, releasing, docs, and dependency updates
20+
21+
## Customization
22+
23+
- **[Optional Features](optional.md)** -- Typer CLI, strict typing, Pydantic Settings, Doppler integration
24+
- **[Template Variables](../configuration/variables.md)** -- Full control over what gets generated

0 commit comments

Comments
 (0)