This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
VynFi Python SDK — the primary typed Python client for the VynFi synthetic financial data API. Supports Python 3.9–3.13. Currently synchronous only. The Rust SDK at /home/michael/DEV/Repos/VynFi-rust/VynFi-rust is the reference API surface — this SDK must match it.
# Install for development
pip install -e ".[dev]"
# Run all tests
pytest -v
# Run a single test file
pytest tests/test_client.py
# Run tests matching a pattern
pytest -k "test_generate"
# Lint
ruff check src/ tests/
# Format check / fix
ruff format --check src/ tests/
ruff format src/ tests/
# Type check
mypy src/vynfi/ --ignore-missing-importsThe SDK follows a resource-based pattern with three layers:
-
Client facade (
src/vynfi/__init__.py) —VynFiclass is the public entry point. Composes all 12 resource clients as attributes:.jobs,.catalog,.usage,.api_keys,.quality,.webhooks,.billing,.configs,.credits,.sessions,.scenarios,.notifications. Convenience shortcuts:.generate(),.generate_quick(). -
HTTP layer (
src/vynfi/_client.py) —SyncClienthandles all HTTP via httpx. Retry with exponential backoff for 429/5xx. Maps HTTP status codes to exception types in_exceptions.py(401, 402, 403, 404, 409, 422, 429, 5xx). -
Resource modules (
src/vynfi/resources/) — Each file wrapsSyncClientwith domain-specific methods. All methods return Pydantic models from_types.py. -
Ecosystem integrations (
src/vynfi/integrations/) — Optional pandas and polars modules for DataFrame conversion of job output and usage data. Gated by optional dependencies (pip install vynfi[pandas]).
All API response types are Pydantic v2 models in _types.py. Some API endpoints return camelCase JSON (sessions, scenarios, credits, configs, templates) — these use the _CamelModel base with alias_generator. The package is PEP 561 typed (py.typed marker).
- Ruff targets Python 3.9, line length 100, rules: E, F, I, UP, B, SIM.
api_keys.pyandwebhooks.pyhave ruff ignores (UP006, UP035, UP045) because they define alist()method that shadows the builtin — usetyping.Listin those files, notlist[...].- mypy runs in strict mode with the Pydantic plugin.
Tests use pytest + respx (httpx mock). test_client.py covers auth, error mapping, retry logic, and resource accessibility. test_resources.py covers every resource endpoint with mock responses matching actual API shapes. CI runs the full matrix across Python 3.9–3.13.
The Rust SDK is the reference. When the API adds endpoints, update both SDKs. The resources map 1:1: jobs, catalog, usage, api_keys, quality, webhooks, billing, configs, credits, sessions, scenarios, notifications.