Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @SchematicHQ/devtools
88 changes: 88 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Overview

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.

## Environment Setup

```bash
# Install dependencies using Poetry
poetry install

# Or install via pip
pip install schematichq
```

## Development Commands

### Building and Testing

```bash
# 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
```

### Code Quality

```bash
# Type checking
poetry run mypy src

# Run linter
poetry run ruff check src
```

## Project Structure

- `src/schematic/` - Main SDK code
- `client.py` - Main client entry point, provides Schematic and AsyncSchematic classes
- `base_client.py` - Base client implementation
- `event_buffer.py` - Buffer for events with retry logic
- `cache.py` - Local cache implementation for flag checks
- `core/` - Core functionality like HTTP client, API error handling
- `webhook_utils/` - Utilities for webhook verification
- Various services organized by API section (companies, events, features, etc.)

## Key Components

### Clients

The SDK provides two main client classes:

1. `Schematic` - Synchronous client
2. `AsyncSchematic` - Asynchronous client

Both clients have the same interface but the async client returns awaitable objects.

### Event Buffer

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.

### Configuration

Clients can be configured with:

- Custom HTTP clients
- Flag defaults for offline/fallback mode
- Cache settings
- Timeout settings
- Retry settings

### Webhook Verification

The SDK provides utilities for verifying webhook signatures from Schematic to ensure security:

- `verify_webhook_signature` - For web request verification
- `verify_signature` - For manual signature verification
9 changes: 6 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "schematichq"

[tool.poetry]
name = "schematichq"
version = "1.0.8"
version = "1.0.9"
description = ""
readme = "README.md"
authors = []
Expand Down
Loading