This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This repository contains the Schematic Python SDK, which provides a convenient interface to the Schematic API for Python applications. The library includes type definitions for all request and response fields, and offers both synchronous and asynchronous clients powered by httpx.
# Install dependencies using Poetry
poetry install
# Or install via pip
pip install schematichq# Run all tests
poetry run pytest
# Run a specific test file
poetry run pytest tests/custom/test_client.py
# Run tests with specific markers (e.g. asyncio)
poetry run pytest -m asyncio
# Run tests with more verbose output
poetry run pytest -v# Type checking
poetry run mypy src
# Run linter
poetry run ruff check srcsrc/schematic/- Main SDK codeclient.py- Main client entry point, provides Schematic and AsyncSchematic classesbase_client.py- Base client implementationevent_buffer.py- Buffer for events with retry logiccache.py- Local cache implementation for flag checkscore/- Core functionality like HTTP client, API error handlingwebhook_utils/- Utilities for webhook verification- Various services organized by API section (companies, events, features, etc.)
The SDK provides two main client classes:
Schematic- Synchronous clientAsyncSchematic- Asynchronous client
Both clients have the same interface but the async client returns awaitable objects.
The SDK implements an event buffer for batching events before sending them to the API. Events are automatically flushed periodically or when the buffer is full. The event buffer includes retry logic with exponential backoff.
Clients can be configured with:
- Custom HTTP clients
- Flag defaults for offline/fallback mode
- Cache settings
- Timeout settings
- Retry settings
The SDK provides utilities for verifying webhook signatures from Schematic to ensure security:
verify_webhook_signature- For web request verificationverify_signature- For manual signature verification