Skip to content

Add notebook pattern validation and standardize setup cells#163

Merged
petermuehlbacher merged 1 commit intomainfrom
add-notebook-pattern-checks
Feb 19, 2026
Merged

Add notebook pattern validation and standardize setup cells#163
petermuehlbacher merged 1 commit intomainfrom
add-notebook-pattern-checks

Conversation

@petermuehlbacher
Copy link
Contributor

Summary

  • New CI check: docs-site/scripts/validate-notebook-patterns.py validates all 18 case study notebooks enforce three patterns:
    1. Conditional %pip install everyrow (via try/except ImportError)
    2. Conditional EVERYROW_API_KEY setup (via if not in os.environ)
    3. All everyrow op calls (merge, screen, dedupe, rank, agent_map) wrapped in async with create_session(name="...") as session: with session.get_url() for observability
  • All 18 notebooks fixed: Inserted standardized setup cells and wrapped bare everyrow op calls in create_session contexts
  • CI integration: Added validation step to deploy-docs.yaml workflow

Test plan

  • uv run python docs-site/scripts/validate-notebook-patterns.py — all 18 notebooks pass
  • Verify CI pipeline runs the new validation step on PR

🤖 Generated with Claude Code

@petermuehlbacher petermuehlbacher force-pushed the add-notebook-pattern-checks branch from c670f4e to b24c0af Compare February 18, 2026 21:57
Add a CI validation script that checks all case study notebooks for:
- Conditional everyrow pip install (try/except ImportError)
- Conditional EVERYROW_API_KEY setup (if not in os.environ)
- All everyrow op calls wrapped in create_session() with observability URL

Insert standardized setup cells into all 18 notebooks and wrap bare
everyrow op calls (merge, screen, dedupe) in create_session contexts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@petermuehlbacher petermuehlbacher force-pushed the add-notebook-pattern-checks branch from b24c0af to 6b5c8b1 Compare February 18, 2026 22:04
Comment on lines 20 to 26
"\n",
"This notebook demonstrates how to use the everyrow SDK's `dedupe` operation to deduplicate messy CRM data using AI-powered semantic matching."
"import os\n",
"if \"EVERYROW_API_KEY\" not in os.environ:\n",
" os.environ[\"EVERYROW_API_KEY\"] = \"your-api-key-here\" # Get one at everyrow.io\n"
]
},
{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The call to await client.__aexit__() is incorrect as it's missing the three required arguments for an async context manager, which will cause a TypeError on exit.
Severity: HIGH

Suggested Fix

The __aexit__ method should be called with the standard three None arguments to signify a clean exit from the context manager. Change await client.__aexit__() to await client.__aexit__(None, None, None) in src/everyrow/session.py.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: docs/case_studies/dedupe-crm-company-records/notebook.ipynb#L20-L26

Potential issue: The `__aexit__` method in `src/everyrow/session.py` is called without
any arguments. The async context manager protocol requires `__aexit__` to be called with
three arguments: `exc_type`, `exc_val`, and `exc_tb`. The `AuthenticatedClient` forwards
this call to the underlying `httpx.AsyncClient`, whose `__aexit__` method will raise a
`TypeError` because it's missing the required positional arguments. This will cause an
unhandled exception whenever a session is created and closed using the `create_session`
context manager, such as when `single_agent()` is called without an explicit session.

Did we get this right? 👍 / 👎 to inform future reviews.

@petermuehlbacher petermuehlbacher merged commit b1fab83 into main Feb 19, 2026
5 checks passed
@petermuehlbacher petermuehlbacher deleted the add-notebook-pattern-checks branch February 19, 2026 19:59
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