Skip to content

Make the generated methods self-documenting: return shapes and the Session conventions #6

Description

@arrufat

The docs site now publishes the Python reference generated from this repository's main branch (https://lightpanda.io/docs/reference/python-api, built by the docs repo's python-reference workflow), and the hand-written reference page is being retired. Two pieces of information that page carried cannot be derived from the package today:

  1. Return shapes. Every generated method in lightpanda/_methods.py is annotated -> Any, so the reference cannot say whether a call returns text, parsed JSON (dict/list), or bytes. The retired page had a Returns column for this. Options: have scripts/generate_methods.py emit narrower annotations where the tool schema makes the shape known, or state the return shape in the docstrings taken from the tool descriptions.

  2. Session conventions. Keyword-only arguments, snake_case names derived from the browser's action names, the selector / backend_node_id pair where one is required and selector wins, Session.call as the escape hatch with the browser's own names, and ToolError on failure. This is currently a fixed paragraph in the docs generator; it belongs in the Session class docstring so it also shows up in IDE hover text and stays next to the code it describes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions