Skip to content

Generate the Python SDK API reference as a native docs page - #94

Merged
arrufat merged 1 commit into
mainfrom
python-api-reference
Sep 3, 2026
Merged

Generate the Python SDK API reference as a native docs page#94
arrufat merged 1 commit into
mainfrom
python-api-reference

Conversation

@arrufat

@arrufat arrufat commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Replaces the pdoc HTML approach from #92 with a generated MDX page, src/content/reference/python-api.mdx, so the API reference renders like the rest of the docs: sidebar entry under "Python SDK", Pagefind search, dark mode, and stable deep links such as /reference/python-api#session-wait-for-selector.

  • scripts/generate-python-reference.py walks the lightpanda package with pdoc's Python API and emits one section per public class, method, property, function and exception. Docstrings are converted from reST and escaped for MDX; sync classes are listed in full and their Async* twins list only what they add.
  • .github/workflows/python-reference.yml regenerates the page daily from the lightpanda-python main branch and opens a PR when it changed. It also smoke-runs on PRs that touch the generator.
  • The curated Python SDK page and the Python guide now link to the new page; /docs/python redirects to it so the links already in the package README resolve.

Supersedes #93.

Follow-up in lightpanda-python: retarget the two README links from lightpanda.io/docs/python/ to lightpanda.io/docs/reference/python-api, and the sentence saying the reference is regenerated from the PyPI package (it is now generated from main).

Add scripts/generate-python-reference.py, which walks the lightpanda package
with pdoc's Python API and writes src/content/reference/python-api.mdx: one
section per public class, method, property, function and exception, with the
signatures and docstrings shipped in the code. Emitting MDX instead of pdoc's
HTML keeps the page inside the Nextra site, so it gets the sidebar, Pagefind
search, dark mode and stable deep links like every other page. Sync classes
are listed in full; their Async twins list only what they add.

A daily workflow regenerates the page from the lightpanda-python main branch
(snake_case-only API, matching the hand-written docs) and opens a pull
request when it changed; it also smoke-runs on pull requests that touch the
generator. Seed the page from a local run, list it in the sidebar after the
curated Python SDK page, point that page and the Python guide at it, and
redirect /docs/python to it so the links in the package README resolve.
@arrufat
arrufat merged commit c60f115 into main Sep 3, 2026
2 checks passed
@arrufat
arrufat deleted the python-api-reference branch September 3, 2026 12:23
@cdebled

cdebled commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Wouldn't it be better to to integrate the generated content in the "Python SDK" page instead of adding a new one and duplicate some of the content?

@arrufat

arrufat commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

yes, I think we can just have one, I added as a separate one, just to compare

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.

2 participants