Skip to content

Put the Session conventions in the Session docstring - #13

Merged
arrufat merged 1 commit into
mainfrom
session-conventions-docstring
Sep 30, 2026
Merged

arrufat merged 1 commit into
mainfrom
session-conventions-docstring

Conversation

@arrufat

@arrufat arrufat commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Item 2 of #6.

The rules for calling an action live in the docs site's reference generator, as a fixed CONVENTIONS list plus a CLASS_NOTES["Session"] entry with hand-written #session-call anchors. They describe this class, so a reader in an IDE never sees them, and a repository that cannot import the package decides what the package promises.

They move to the Session docstring: keyword-only methods named in snake_case after the browser's own action names, selector winning over backend_node_id when both are given, call as the escape hatch that takes the browser's own names, and ToolError on failure. help(Session) and hover text carry them now.

AsyncSession refers to Session rather than repeating the text, which is what the generated page already says about the twin.

The matching removal is lightpanda-io/docs#112. The :meth: roles resolve to the same anchors the hardcoded links spelled out — [call()](#session-call), [tree()](#session-tree), [find_element()](#session-find-element) — so the rendered page keeps its links; the paragraphs just move from above the class list into the Session section, where they apply.

Leaves items 1 (return shapes) open on #6. That one is worth doing after lightpanda-io/browser#3694 lands, since outputSchema then tells generate_methods.py which tools return the merged PageResult without a hand-maintained list.

The rules for calling an action -- keyword-only, snake_case after the
browser's own names, `selector` winning over `backend_node_id`, `call` as
the escape hatch, `ToolError` on failure -- were a fixed paragraph in the
docs site's reference generator. They describe this class, so they belong
on it: IDE hover and `help()` show them now, and they stay next to the
code they describe instead of drifting in another repository.

`AsyncSession` points at `Session` rather than repeating them.

Part of #6.
@arrufat
arrufat merged commit e3ba813 into main Sep 30, 2026
11 checks passed
@arrufat
arrufat deleted the session-conventions-docstring branch September 30, 2026 09:40
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.

1 participant