Skip to content

feat(template): replace MkDocs with Sphinx + Shibuya docs - #42

Merged
hasansezertasan merged 3 commits into
mainfrom
feat/garrulous-polyester
Jun 25, 2026
Merged

feat(template): replace MkDocs with Sphinx + Shibuya docs#42
hasansezertasan merged 3 commits into
mainfrom
feat/garrulous-polyester

Conversation

@hasansezertasan

@hasansezertasan hasansezertasan commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary

Migrates generated-project documentation from MkDocs (mkdocs + mkdocs-material) to Sphinx with the bare Shibuya theme — the same stack behind the Litestar-org docs sites (Litestar, Advanced Alchemy, Polyfactory). Motivated by MkDocs 2.0 instability and by the fact that the old setup shipped mkdocs-material without ever activating it and hand-maintained the "API reference."

Decisions (see ADR-006): bare Shibuya (PyPI, no Litestar branding) over litestar-sphinx-theme (git dep) · reStructuredText · autodoc + napoleon for a real API reference. Docs remain unconditional (no include_docs toggle).

Changes

  • New: docs/conf.py.jinja (Shibuya theme; autodoc, napoleon, intersphinx, sphinx-design/copybutton/togglebutton/paramlinks, auto-pytabs, myst-parser, and sphinx-click only when include_cli) and docs/{index,installation,usage,modules}.rst.jinja. modules.rst is conditional .. automodule:: directives.
  • Removed: mkdocs.yml.jinja and the four *.md.jinja pages.
  • pyproject: new exactly-pinned docs dependency group; tox docs-build/docs-server now run sphinx-build/sphinx-autobuild with extras = ["all"] (autodoc must import the package + optional deps); keyword mkdocssphinx; docs/conf.py added to ruff INP001 ignores.
  • CI: both workflows build with sphinx-build and publish with ghp-import — the same tool MkDocs used under the hood, so the gh-pages-branch model and Pages settings are unchanged.
  • Cleanup: dropped check-yaml --unsafe (only needed for mkdocs.yml's !!python/name tags); removed a redundant docstring Attributes: block in logging_setup.py that caused a duplicate-autodoc warning; updated README/AGENTS/CLAUDE/ADR-002 references.

Verification

  • docs-build succeeds with zero warnings across empty, FastAPI, and Litestar variants (conditional autodoc, sphinx-click, and pydantic intersphinx all resolve).
  • Full tox run green across Python 3.10–3.14 (21 tests) plus the complete style env (ruff, mypy, basedpyright, ty, pyrefly, zuban, vulture, slotscheck, taplo, validate-pyproject, typos, actionlint).

Notes

  • Downstream impact: existing projects will see a materially different docs setup on copier update.

Follow-up fixes (review)

Verification on freshly generated projects surfaced issues the original commit's checks masked (tox runs ruff format without --check, so it auto-fixed locally; uv lock resolution wasn't re-run against the 3.10 floor). Fixed in a follow-up commit:

  • Python 3.10 resolution: sphinx-autobuild (2025.8.25) and sphinx-design (0.7.0) require Python ≥3.11, making the docs group unsatisfiable on the 3.10 split of uv's universal lock. Pinned to the last 3.10-compatible releases — sphinx-autobuild==2024.10.3 and sphinx-design==0.6.1. (These intentionally trail latest; do not let Renovate bump them past the 3.11 cutoff while 3.10 is supported.)
  • ruff-format (prek hooks job): conf.py shipped multi-line source_suffix/intersphinx_mapping literals that violate skip-magic-trailing-comma. Single-lined them; conditional pydantic mapping now added via assignment.
  • auto-pytabs: set auto_pytabs_min_version=(3,10) / max_version=(3,14) (defaults are (3,7)).
  • intersphinx: pydantic mapping now also added for web variants (FastAPI/Litestar use pydantic), not just pydantic-settings/worker.
  • copyright: derived at build time instead of hardcoded 2025.

Re-verified across empty/FastAPI/Litestar: uv lock resolves on 3.10–3.14, sphinx-build -W builds cleanly, and the full tox style env passes (all 15 checks).

Migrate generated-project documentation from MkDocs/mkdocs-material to
Sphinx with the bare Shibuya theme, reStructuredText, and an autodoc API
reference (autodoc + napoleon). Replaces mkdocs.yml + the four Markdown
pages with docs/conf.py and .rst pages; switches the tox docs envs and
both CI workflows from `mkdocs gh-deploy` to `sphinx-build` + `ghp-import`
(unchanged gh-pages-branch model). Drops the now-unneeded check-yaml
`--unsafe` flag and pins the docs dependency group exactly. See ADR-006.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @hasansezertasan, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6d41ed4d7a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread template/docs/modules.rst.jinja Outdated
The MkDocs->Sphinx migration shipped a docs setup that failed for freshly
generated projects on the supported Python floor:

- sphinx-autobuild 2025.8.25 and sphinx-design 0.7.0 require Python >=3.11,
  making uv's universal lock unsatisfiable for the 3.10 split (requires-python
  is >=3.10). Pin to the last 3.10-compatible releases (2024.10.3 / 0.6.1).
- conf.py shipped multi-line `source_suffix`/`intersphinx_mapping` literals
  that violate `skip-magic-trailing-comma`, so the prek `ruff-format` CI hook
  would fail. Single-line the literals; add the conditional pydantic mapping
  via assignment.

Also tightens the new Sphinx config:

- Configure auto_pytabs_min/max_version to (3,10)/(3,14) so version tabs match
  the project's supported range instead of auto-pytabs' (3,7) default.
- Add pydantic intersphinx for web variants (FastAPI/Litestar use pydantic),
  not just pydantic-settings/worker.
- Derive the copyright year at build time instead of hardcoding 2025.

Verified across empty/FastAPI/Litestar variants: uv lock resolves on
3.10-3.14, `sphinx-build -W` builds cleanly, and the full tox `style` env
passes.
The "Modules" heading in docs/modules.rst is exactly 7 characters, so its RST
underline rendered as `=======` — a 7-char `=` line that `git diff --check`
(and pre-commit's check-merge-conflict) treats as a leftover merge-conflict
separator. Lengthen the underline past 7 characters and document why, so the
generated docs/modules.rst is no longer flagged as containing a conflict marker.
@hasansezertasan
hasansezertasan merged commit 20eac5b into main Jun 25, 2026
2 checks passed
@hasansezertasan
hasansezertasan deleted the feat/garrulous-polyester branch June 25, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant