Skip to content

[CB-0] [sdk-superfan] Fix README quickstart fence and timeout snippet import - #219

Draft
spicysouvlaki wants to merge 1 commit into
mainfrom
wschmitt/readme-quickstart-fence
Draft

spicysouvlaki wants to merge 1 commit into
mainfrom
wschmitt/readme-quickstart-fence

Conversation

@spicysouvlaki

@spicysouvlaki spicysouvlaki commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

What happened

#176: the quickstart's Python fence closes after sessions.create, so run() renders as prose and ## Examples lands inside a code block. The timeout snippet raises NameError: name 'httpx' is not defined.

Why

There's an early closing fence at README.md:43, so the bare fence at :67 opens a new block. The timeout block (:302-320) uses httpx.Timeout but never imports httpx.

Fix

Drop the early closing fence and add import httpx to the timeout snippet.

Tests

  • Added tests/test_readme.py, which checks that every fence pairs as a labelled opener and a bare closer. Before: fails. After: passes.
  • ./scripts/lint and ./scripts/test (steady mock, 3.9 + 3.14, pydantic v1/v2) pass.
  • Live: ran the fixed quickstart block against the dev API. It printed Done! and the session was released.
  • Not covered by a test: undefined names in snippets. Many snippets are continuations that rely on an existing client. I checked by hand with ruff F821.

Risk and rollout

README.md is generated by Stainless and this edit is sealed. The quickstart text likely comes from the Stainless config's readme example, so fix it there too or a regen may conflict. tests/test_readme.py is a new custom file. Docs only, no runtime change.

Fixes #176

🤖 Generated with Claude Code

The quickstart closed its ```python fence right after `sessions.create`
(README.md:43), so `def run(...)` and the `__main__` guard rendered as
Markdown, and the stray ``` before "## Examples" (README.md:67) opened a
new fence that swallowed the Examples section up to the ```bash block.
Removing the early closer makes the whole quickstart one block and turns the
later ``` back into its closer.

The timeout snippet calls `httpx.Timeout(...)` without importing httpx.
A ruff F821 pass over every README python block showed that as the only
undefined name in a standalone snippet. The rest (`client`, `response`,
`DefaultHttpxClient` in a `with_options` one-liner) are continuation
snippets by design, which is why the new test checks fence structure
only and doesn't lint names.

tests/test_readme.py asserts fences pair up as labelled-opener/bare-closer.
It fails on origin/main and passes after.

Verified live: extracted the fixed quickstart block and ran it as-is
(screenshot path redirected) against api.dev.browserbase.com with
Playwright; it printed "Done!" and the session was released.

Not fixed here (separate): the install line `pip install '--pre browserbase'`
quotes both tokens as one argument.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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.

Fix malformed README quickstart fence and non-runnable timeout snippet

1 participant