Retire the hand-written Python SDK reference in favor of the generated page - #95
Conversation
…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.
cdebled
left a comment
There was a problem hiding this comment.
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? ;)
|
|
||
| ```python | ||
| class Browser( | ||
| binary: str | os.PathLike | None = None, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Two separate gaps, both fixable upstream rather than here, since the page only renders what the package carries:
- Constructor arguments like
binary,env,timeoutandverbose, and methods likenew_sessionandclose, 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.
clickdescribes bothselectorandbackendNodeId), butscripts/generate_methods.pyonly 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.
|
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.
|
On the cron: agreed that a push-triggered run is better than polling. It needs a cross-repo trigger though: a 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. |
The generated page from #94 already covers every public class, method, property and exception, while the hand-written
reference/python.mdxhad to be re-synced with the package on every release and carried wheel-specific notes that go stale silently.src/content/reference/python.mdx; the generated page takes the "Python SDK" title and sidebar slot, at its existing/reference/python-apiURL.selector/backend_node_idpair,Session.callas the escape hatch,ToolErroron failure. Regenerated the page accordingly./reference/pythonto 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 theSessiondocstring, is tracked in lightpanda-io/lightpanda-python#6.