Getting Started¶
This guide covers installing the project, working with the documentation locally, and understanding how links behave across different viewing contexts.
Prerequisites¶
- Python 3.11+ — Download
- Git — Download
- Hatch (recommended) —
pip install hatchorpipx install hatch - Task (optional) — shortest commands, wraps Hatch
One-command setup
For fresh clones, the bootstrap.py script
handles all setup in one step:
It installs pre-commit hooks, verifies your environment, and enters the Hatch shell.
Installation¶
With Hatch (recommended)¶
Hatch manages environments automatically — no manual install step needed. Just
run any hatch run docs:* command and the environment is created on first use.
hatch shell # enter the default dev environment
hatch run docs:serve # or jump straight to a docs command
With pip (editable install + docs dependencies)¶
With Taskfile shortcuts¶
If you have Task installed, the Taskfile wraps common commands:
Serving docs locally¶
Open http://127.0.0.1:8000 in your browser. Changes to Markdown files are picked up automatically via live-reload.
Building docs¶
The --strict flag treats warnings as errors, which is the same mode used by
the CI build. When using Taskfile or Hatch, --strict is applied automatically
by the docs environment script — you don't need to add it.
How Links Work¶
Documentation files in this project use relative Markdown links to
reference files across the repository — both within docs/ and outside it
(e.g. ../../pyproject.toml, ../scripts/clean.py). This creates a
challenge because the same links need to work in two different contexts:
| Context | How links resolve |
|---|---|
| Browsing on GitHub | GitHub resolves relative paths natively — all links just work |
| Deployed MkDocs site | MkDocs can only resolve links within docs/ — external links break |
Local mkdocs serve |
Same as deployed site — limited to docs/ |
The repo_links.py Hook¶
The repo_links.py MkDocs build hook
solves this automatically. During mkdocs build or mkdocs serve, it
intercepts every Markdown link that points outside docs/ and rewrites it
to an absolute GitHub URL (e.g. https://github.com/OWNER/REPO/blob/main/pyproject.toml).
The hook handles three link formats:
- Standard Markdown:
[text](../../path/to/file) - HTML anchors:
<a href="../../path/to/file"> - Reference-style:
[ref]: ../../path/to/file
Code blocks, inline code, and HTML comments are automatically protected — example links in documentation are never accidentally rewritten.
This means:
- Authors write natural relative links — no need to think about deployment
- Links work on GitHub — relative paths resolve natively
- Links work on the deployed site — the hook rewrites them at build time
- No source files are modified — the rewrite happens in memory only
The hook reads repo_url from mkdocs.yml. Template users only need to set
that value correctly. See mkdocs-hooks/README.md
for configuration options.
Link Types at a Glance¶
| Link type | Example | Where it works natively | Hook needed? |
|---|---|---|---|
| Within-docs relative | [ADRs](../adr/README.md) |
GitHub + MkDocs | No |
| Repo-relative (outside docs) | [pyproject](../../pyproject.toml) |
GitHub only | Yes |
| Absolute URL | [Python](https://python.org) |
Everywhere | No |
| Fragment / anchor | [section](#my-heading) |
GitHub + MkDocs | No |
| Repo-relative with fragment | [config](../../pyproject.toml#L10) |
GitHub only | Yes |
HTML <a href> |
<a href="../../Taskfile.yml"> |
GitHub only | Yes |
| Reference-style definition | [ref]: ../../LICENSE |
GitHub only | Yes |
Read the Docs¶
This project is configured for Read the Docs via
.readthedocs.yaml. RTD builds are triggered automatically on push and use
the project's built-in versioning (tags and branches) — no additional tooling
like mike or GitHub Pages is required.
GitHub Pages¶
Docs are also deployed via GitHub Pages using the docs-deploy.yml workflow.
This triggers on push to main when docs-related files change. GitHub Pages
deployment is configured in mkdocs.yml and uses the
gh-deploy
action.
Troubleshooting¶
API reference page is empty or errors
If the API reference page shows errors or is blank:
-
Confirm the package is importable. The
mkdocstringsplugin needs to import your code. Make sure you have installed the project in editable mode: -
Check that modules exist under
src/. Themkdocstringshandler is configured withpaths: [src]inmkdocs.yml. API directives likesimple_python_boilerplate.engineexpect the module to be atsrc/simple_python_boilerplate/engine.py. -
Avoid top-level side effects. Modules rendered by
mkdocstringsare imported at build time. Guard any executable code behindif __name__ == "__main__":to prevent unintended execution during the docs build.
Clearing stale build artifacts
If the site behaves unexpectedly after changes, delete the build output and rebuild:
Or use Taskfile / Hatch:
Broken links in the MkDocs build
If mkdocs build reports INFO warnings about links not found, check:
- Links outside
docs/— these should be caught by therepo_links.pyhook. Verify the hook is registered inmkdocs.ymlunderhooks:. - Links to directories — MkDocs needs an explicit file target.
Use
../adr/README.mdinstead of../adr/. - Links to excluded files — files in
exclude_docsor not in thenavmay not resolve.
For comprehensive troubleshooting, see the Troubleshooting & FAQ page.
Next Steps¶
- Development Environment Setup — full env setup including VS Code, pre-commit, and Python version management
- Developer Commands — complete command reference for testing, linting, formatting, and more
- Command Reference — auto-generated reference of all Taskfile tasks, scripts, Hatch envs, and CLI entry points
- Command Workflows — how commands flow through Taskfile → Hatch → Python tools
- Pull Requests — PR guidelines and conventions
- Using This Template — full customization guide if you're forking the boilerplate
Something not working?
See Troubleshooting & FAQ for solutions to common errors with installation, pre-commit hooks, Git, CI/CD, testing, documentation builds, and more. Check there before opening an issue.