Skip to content

Commit 18695da

Browse files
committed
docs(feat[requirements]): document sphinx 8.1+ floor and typed domain idiom
why: Record the new Sphinx 8.1+ workspace floor where contributors and downstream users look for it, and codify the typed-accessor convention so the `env.get_domain(<literal>)` / `t.cast` pattern does not creep back in. CLAUDE.md is a symlink to AGENTS.md so both surfaces update in one edit. what: - AGENTS.md: add `Sphinx 8.1+` to the Development Environment list; add a new `Sphinx domain access` Coding-Standards subsection explaining `env.domains.<name>_domain` and listing the core typed accessors - README.md: add a top-level `Requirements` section (Python 3.10+, Sphinx 8.1+) above the install instructions - packages/sphinx-autodoc-fastmcp/README.md: tighten the `Dependencies` list entry from `Sphinx` to `Sphinx 8.1+`
1 parent 5f10760 commit 18695da

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Key features:
2626

2727
This project uses:
2828
- Python 3.10+
29+
- Sphinx 8.1+ (required for the typed `env.domains.<name>_domain` accessors)
2930
- [uv](https://github.com/astral-sh/uv) for dependency management
3031
- [ruff](https://github.com/astral-sh/ruff) for linting and formatting
3132
- [mypy](https://github.com/python/mypy) for type checking
@@ -448,6 +449,22 @@ Key highlights:
448449
- **For typing**, use `import typing as t` and access via namespace: `t.NamedTuple`, etc.
449450
- **Use `from __future__ import annotations`** at the top of all Python files
450451

452+
### Sphinx domain access
453+
454+
Prefer the typed accessors on `env.domains` over `env.get_domain(<literal>)`:
455+
456+
- `env.domains.standard_domain` — not `env.get_domain("std")`
457+
- `env.domains.python_domain` — not `env.get_domain("py")`
458+
- Similarly: `c_domain`, `cpp_domain`, `javascript_domain`,
459+
`restructuredtext_domain`, `changeset_domain`, `citation_domain`,
460+
`index_domain`, `math_domain`
461+
462+
The typed accessors return the concrete domain subclass
463+
(`StandardDomain`, `PythonDomain`, etc.), so mypy sees subclass-specific
464+
attributes (`progoptions`, `add_program_option`, `data["objects"]`, …)
465+
without `t.cast` or `# type: ignore`. The accessors were added in Sphinx
466+
8.1 (`_DomainsContainer`), which is the workspace floor.
467+
451468
### Docstrings
452469

453470
Follow NumPy docstring style for all functions and methods:

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Integrated autodoc design system for Sphinx. Twelve packages in three tiers
44
that replace ~300 lines of duplicated `docs/conf.py` with ~10 lines and
55
produce beautiful, consistent API documentation.
66

7+
## Requirements
8+
9+
- Python 3.10+
10+
- Sphinx 8.1+
11+
712
## Install
813

914
```console

packages/sphinx-autodoc-fastmcp/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ See the package docstrings and `sphinx_autodoc_fastmcp.setup()` for defaults.
4343
## Dependencies
4444

4545
- Python 3.10+
46-
- Sphinx
46+
- Sphinx 8.1+
4747
- `sphinx-ux-badges`, `sphinx-ux-autodoc-layout`, and `sphinx-autodoc-typehints-gp`
4848
are declared dependencies and installed automatically with this package.
4949

0 commit comments

Comments
 (0)