Skip to content

chore(codegen): use alphabetical order in the generated API - #3242

Open
Pavel Feldman (pavelfeldman) wants to merge 2 commits into
microsoft:mainfrom
pavelfeldman:codegen-docs-order
Open

Pavel Feldman (pavelfeldman) wants to merge 2 commits into
microsoft:mainfrom
pavelfeldman:codegen-docs-order

Conversation

@pavelfeldman

@pavelfeldman Pavel Feldman (pavelfeldman) commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Summary

- The generator writes playwright/_impl/_api_structures.py
  (`--flavor structs`): every struct that the API uses, nested ones
  included. update_api.sh runs it.
- The internal types move to the hand-written
  playwright/_impl/_internal_structures.py.
- python_rules.js names the nested storage state structs, and keeps the
  shipped `total=` of 5 TypedDicts (structTotal).
- compare_api.py compares TypedDicts. Against the hand-written file it
  finds no difference; the text diff only reorders the DropPayload.files
  union.
- legacy_order.json keeps the hand-written class order, so that the diff
  is small.
- Removes scripts/codegen/legacy_order.json and the code that applied it.
- Classes, members, keyword-only parameters, events and TypedDicts are in
  alphabetical order; a class comes after the class that it extends or
  uses. Positional parameters, union members and TypedDict fields keep
  the docs order. Docstrings are wrapped after member links are
  rendered. compare_api.py shows no other difference.
- The roll skill, ROLLING.md, CONTRIBUTING.md and update_api.sh now ask
  for a microsoft/playwright checkout used only for rolls, on the exact
  release-<new> branch, and list the checks that it is on that branch,
  clean, and up to date with origin.
@pavelfeldman Pavel Feldman (pavelfeldman) changed the title chore(codegen): use the docs order in the generated API chore(codegen): use alphabetical order in the generated API Oct 13, 2026
Comment thread ROLLING.md
* change the driver pin in `DRIVER_VERSION` (the `playwright-core` npm version, e.g. `1.61.0`) and refresh `NODE_VERSION`: `python scripts/update_node_version.py`
* download the new driver: `python -m build --wheel` (fetches `playwright-core` via `npm pack` + the matching Node.js binary and assembles the bundle; no source build).
* generate API from the docs (needs a nearby `microsoft/playwright` checkout at the release branch for the new version, e.g. `release-1.64`): `PW_SRC_DIR=../playwright ./scripts/update_api.sh`
* generate API from the docs. This needs a separate `microsoft/playwright` checkout used only for rolls, on the exact release branch for the new version (e.g. `release-1.64`), clean and up to date with `origin`: `PW_SRC_DIR=../playwright-for-python ./scripts/update_api.sh`

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.

I do not plan to have a "separate checkout used only for rolls"!

This branch has not been deployed

No deployments
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.

3 participants