pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/BlocksecPHD/python-sdk/commit/5388bea53ad7b13db7d031cdfd27392474c89007

ss" /> docs: generate hierarchical per-module API reference pages (#2103) · BlocksecPHD/python-sdk@5388bea · GitHub
Skip to content

Commit 5388bea

Browse files
docs: generate hierarchical per-module API reference pages (modelcontextprotocol#2103)
1 parent 20dd946 commit 5388bea

7 files changed

Lines changed: 74 additions & 7 deletions

File tree

docs/api.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/hooks/gen_ref_pages.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""Generate the code reference pages and navigation."""
2+
3+
from pathlib import Path
4+
5+
import mkdocs_gen_files
6+
7+
nav = mkdocs_gen_files.Nav()
8+
9+
root = Path(__file__).parent.parent.parent
10+
src = root / "src"
11+
12+
for path in sorted(src.rglob("*.py")):
13+
module_path = path.relative_to(src).with_suffix("")
14+
doc_path = path.relative_to(src).with_suffix(".md")
15+
full_doc_path = Path("api", doc_path)
16+
17+
parts = tuple(module_path.parts)
18+
19+
if parts[-1] == "__init__":
20+
parts = parts[:-1]
21+
doc_path = doc_path.with_name("index.md")
22+
full_doc_path = full_doc_path.with_name("index.md")
23+
elif parts[-1].startswith("_"):
24+
continue
25+
26+
nav[parts] = doc_path.as_posix()
27+
28+
with mkdocs_gen_files.open(full_doc_path, "w") as fd:
29+
ident = ".".join(parts)
30+
fd.write(f"::: {ident}")
31+
32+
mkdocs_gen_files.set_edit_path(full_doc_path, path.relative_to(root))
33+
34+
with mkdocs_gen_files.open("api/SUMMARY.md", "w") as nav_file:
35+
nav_file.writelines(nav.build_literate_nav())

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ npx -y @modelcontextprotocol/inspector
6464

6565
## API Reference
6666

67-
Full API documentation is available in the [API Reference](api.md).
67+
Full API documentation is available in the [API Reference](api/mcp/index.md).

docs/migration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,6 @@ The lowlevel `Server` also now exposes a `session_manager` property to access th
883883

884884
If you encounter issues during migration:
885885

886-
1. Check the [API Reference](api.md) for updated method signatures
886+
1. Check the [API Reference](api/mcp/index.md) for updated method signatures
887887
2. Review the [examples](https://github.com/modelcontextprotocol/python-sdk/tree/main/examples) for updated usage patterns
888888
3. Open an issue on [GitHub](https://github.com/modelcontextprotocol/python-sdk/issues) if you find a bug or need further assistance

mkdocs.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ nav:
2525
- Introduction: experimental/tasks.md
2626
- Server Implementation: experimental/tasks-server.md
2727
- Client Usage: experimental/tasks-client.md
28-
- API Reference: api.md
28+
- API Reference: api/
2929

3030
theme:
3131
name: "material"
@@ -115,19 +115,22 @@ plugins:
115115
- social:
116116
enabled: !ENV [ENABLE_SOCIAL_CARDS, false]
117117
- glightbox
118+
- gen-files:
119+
scripts:
120+
- docs/hooks/gen_ref_pages.py
121+
- literate-nav:
122+
nav_file: SUMMARY.md
118123
- mkdocstrings:
119124
handlers:
120125
python:
121-
paths: [src/mcp]
126+
paths: [src]
122127
options:
123128
relative_crossrefs: true
124129
members_order: source
125130
separate_signature: true
126131
show_signature_annotations: true
127132
signature_crossrefs: true
128133
group_by_category: false
129-
# 3 because docs are in pages with an H2 just above them
130-
heading_level: 3
131134
inventories:
132135
- url: https://docs.python.org/3/objects.inv
133136
- url: https://docs.pydantic.dev/latest/objects.inv

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ dev = [
7474
]
7575
docs = [
7676
"mkdocs>=1.6.1",
77+
"mkdocs-gen-files>=0.5.0",
7778
"mkdocs-glightbox>=0.4.0",
79+
"mkdocs-literate-nav>=0.6.1",
7880
"mkdocs-material[imaging]>=9.5.45",
7981
"mkdocstrings-python>=2.0.1",
8082
]

uv.lock

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy