Skip to content

Retire the hand-written Python SDK reference in favor of the generated page - #95

Merged
arrufat merged 3 commits into
mainfrom
drop-handwritten-python-reference
Sep 4, 2026
Merged

arrufat merged 3 commits into
mainfrom
drop-handwritten-python-reference

Conversation

@arrufat

@arrufat arrufat commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

The generated page from #94 already covers every public class, method, property and exception, while the hand-written reference/python.mdx had to be re-synced with the package on every release and carried wheel-specific notes that go stale silently.

  • Delete src/content/reference/python.mdx; the generated page takes the "Python SDK" title and sidebar slot, at its existing /reference/python-api URL.
  • Move the conventions worth keeping into the generator's fixed intro: keyword-only snake_case actions, the selector / backend_node_id pair, Session.call as the escape hatch, ToolError on failure. Regenerated the page accordingly.
  • Redirect /reference/python to the generated page and retarget the Python guide's link.

The one thing the generated page cannot yet express is the return shape of each action, since every generated method is annotated -> Any. That, and moving the conventions paragraph into the Session docstring, is tracked in lightpanda-io/lightpanda-python#6.

…d page

The generated page already covers every class, method, property and
exception, and the hand-written tables had to be re-synced with the package
on every release. Drop reference/python.mdx, give the generated page the
"Python SDK" title and sidebar slot, and move the conventions worth keeping
(keyword-only snake_case actions, the selector / backend_node_id pair,
Session.call as the escape hatch, ToolError on failure) into the generator's
fixed intro until they live in the Session docstring upstream. Redirect
/reference/python to the generated page and retarget the guide's link.
@arrufat
arrufat requested a review from cdebled September 4, 2026 07:47

@cdebled cdebled 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.

So cool to have a generated page this well formatted! Would it be possible to do the same for the MCP tools and Pandascript reference pages too? ;)

Comment thread src/content/reference/_meta.ts Outdated
Comment thread src/content/reference/python-api.mdx Outdated
Comment thread src/content/reference/python-api.mdx Outdated

```python
class Browser(
binary: str | os.PathLike | None = None,

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.

For all arguments and methods, would it be possible to add a short description, as we had before? Or is it omitted when it's not relevant enough?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Two separate gaps, both fixable upstream rather than here, since the page only renders what the package carries:

  • Constructor arguments like binary, env, timeout and verbose, and methods like new_session and close, have no docstring in the package today. Writing them in lightpanda-python makes them show up here and in IDE hover text.
  • Action arguments can get descriptions for free: the browser's tool schemas already describe every property (e.g. click describes both selector and backendNodeId), but scripts/generate_methods.py only uses the tool-level description. Emitting an Args section per generated docstring is a small change there, and pdoc's docstring conversion renders it.

Tracked in lightpanda-io/lightpanda-python#6.

@cdebled

cdebled commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

In the .yml file you created in the merged PR, I would have removed the scheduled cron: #94. In my opinion, it would be more efficient to trigger the script from CI only when the Python package is updated.

… intro

Rename the generated page to reference/python.mdx so the URL already
published on the website stays valid, and redirect the short-lived
/reference/python-api to it instead. Split the conventions into one
paragraph per subject, move the Session.call and ToolError sentences under
the Session heading, and stop rendering the package's module docstring since
the guide is already linked as the practical documentation.
@arrufat

arrufat commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator Author

On the cron: agreed that a push-triggered run is better than polling. It needs a cross-repo trigger though: a repository_dispatch event on this workflow, fired from a job in lightpanda-python on pushes to main with a fine-grained PAT that has Actions write on this repo. Since that touches both repos and needs a secret, I'd do it as its own PR after this one, keeping workflow_dispatch for manual runs. The daily cron can go at that point.

On generating the MCP tools and PandaScript pages the same way: MCP tools is the natural next one, since the workflow can download the release binary and read the same tool schemas the hand-written table was copied from. PandaScript would need a matching export from the browser's script schema. Both as follow-ups.

@arrufat
arrufat merged commit 0cff4cf into main Sep 4, 2026
2 checks passed
@arrufat
arrufat deleted the drop-handwritten-python-reference branch September 4, 2026 19:12
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