explaingit

stainlu/stainful

78Python

TLDR

stainful is an open-source tool that takes an API description in OpenAPI 3 format plus a configuration file called stainless.yml, and uses them to generate a Python SDK.

Mindmap

A visual breakdown will appear here once this repo is fully enriched.

In plain English

stainful is an open-source tool that takes an API description in OpenAPI 3 format plus a configuration file called stainless.yml, and uses them to generate a Python SDK. An SDK is a library that other developers can install with pip and use to call your API from their own Python code. The project bills itself as a continuation path for users of Stainless, a commercial SDK generator that Anthropic acquired and is winding down. If you already have a stainless.yml file from that service, stainful is meant to read it without changes. The goal is to produce SDK code that reads as if a person wrote it by hand, rather than the verbose, awkward code that mechanical generators typically emit. The README contrasts these styles directly: a typical generator gives you something like api.agency_agency_id_json_get(id), while a stainful-generated SDK gives you client.agency.retrieve(id). The generated SDKs include typed data models built on pydantic v2, real Python exception classes for errors like rate limits, automatic pagination so you can write a for-loop over results, retries with backoff and jitter, streaming over Server-Sent Events, and both sync and async versions from a single source. Generated SDKs depend only on httpx and pydantic. The tool runs entirely on your machine or in CI, with no hosted service or account required. Beyond the SDK itself, stainful can emit a Mintlify-compatible api.md documentation file and a Model Context Protocol server that exposes each HTTP method as a tool for AI assistants like Claude, Cline, or mcp-cli to call. The internal pipeline parses the OpenAPI spec and stainless.yml into an intermediate representation, resolves things like $ref and allOf, and then a Python emitter renders the SDK over a hand-written vendored runtime. At version 0.4.0, the project is verified against the real Stainless-generated SDKs for OneBusAway and OpenAI: 29 of 29 OneBusAway test files import unchanged against stainful's output, and the public OpenAI spec produces a mypy-clean SDK. The repository reports 118 tests, ruff clean, and CI green on Python 3.10 through 3.12. One documented gap is that operations with multiple request body content types still pick the first match. The stated roadmap is Python first, then MCP server polish, then a second language, then a docs site.

Open on GitHub → Explain another repo

Generated 2026-05-21 · Model: sonnet-4-6 · Verify against the repo before relying on details.