lightpanda-io / lightpanda-io/lightpanda-python

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

Open
#6 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2
Forks
0
Avg merge
5m
Merged PRs (30d)
9

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read scripts/generate_methods.py and the generated lightpanda/_methods.py, then locate the Session class and inspect how the docs generator currently adds its conventions paragraph. Determine how the tool schema exposes return shapes and document the Session conventions in the class docstring; done means the generated reference and IDE hover text contain both pieces of information.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation, tooling
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.