Repository navigation
feat!: generate the SDK from the v5 API with Fern (5.0.0rc1), replacing Stainless - #87
Merged
Merged
Conversation
Generate src/supermemory from https://api.supermemory.ai/v5/openapi using Fern's open-source Python generator run locally in Docker (the approach cloudflare/forge uses), so no hosted codegen service or plan is needed. - fern/: spec snapshot, overlay (method surface matching sdk-ts v5), schemas.yaml (named types: Document, Memory, SearchResult, Connector, ...) - custom/: hand-written 3.x-compatible client conventions (options, env vars, extra_headers/extra_query/extra_body/timeout, with_options, exception hierarchy, with_raw_response.parse, to_dict/to_json) plus two patches for bugs in Fern's generated core (recursive filter serialization, py3.9) - scripts/generate: fetch spec, name schemas, run Fern, layer custom/ - CI: py3.10-3.14 + pydantic v1 tests, lint, mypy, generated-code drift check, optional live-API tests; Generate SDK workflow opens a version-bumped PR when the spec changes; merging publishes to PyPI - tests: wire-level route/auth/body tests, compat tests, every README and MIGRATION snippet executed against a mock API - version 5.0.0rc1; requires Python 3.10+ BREAKING CHANGE: namespace-first v5 methods (client.add(namespace, ...), client.search(namespace, query=...)); container tags become namespaces. See MIGRATION.md. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
list_providers was wrong: the route lists connectors across the org, not providers. Matches the TypeScript SDK (listAll) and the docs.
MaheshtheDev
approved these changes
Oct 5, 2026
MaheshtheDev
enabled auto-merge
October 5, 2026 17:30
The compat layer handed Fern only timeout.read, so a per-request float replaced the client's httpx.Timeout and dropped connect/write/pool. It now forwards the whole Timeout object, which Fern passes straight to httpx. Fern's HTTP client only retried ConnectError and RemoteProtocolError; a new patch adds httpx.TimeoutException so read timeouts honor max_retries as before.
Brings back the NOT_GIVEN sentinel so "not supplied" and an explicit None stay distinct. Omitted keeps the default (60 s read, 5 s connect); None at construction, per call, or via with_options turns all timeout phases off. NOT_GIVEN and NotGiven are exported again.
sohamd22
approved these changes
Oct 5, 2026
MaheshtheDev
added a commit
that referenced
this pull request
Oct 5, 2026
…88) Picks up the two regenerations that landed on `fern-v5` after #87 merged, so they never shipped in rc1: - `connectors.delete(..., delete_documents=False)` is a bool (mono#3411 made the query flag a boolean). - `namespaces.delete` returns `NamespaceDeleted_Deleted | NamespaceDeleted_Queued` with a `status` discriminator (mono#3412). Version bumped to 5.0.0rc2 so `publish-pypi.yml` publishes on merge. Tests, ruff, mypy pass; both changes were exercised against production.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Replaces the Stainless-generated SDK with one generated from the v5 API (
https://api.supermemory.ai/v5/openapi) by Fern's open-source Python generator. It runs locally in Docker, the same way cloudflare/forge generates its SDKs, so there's no hosted codegen service or per-language plan. It's versioned 5.0.0rc1, a prerelease, sopip install supermemorystays on 3.62.0 until 5.0.0.The SDK
Method names match the TypeScript SDK's v5 surface. Everything around the methods keeps the 3.x conventions.
client.{add, search, profile, list}documents.{get, update, delete, batch_add, upload_file, replace_with_file, update_file}memories.{forget, forget_matching}profiles.{get_buckets, set_buckets, delete_buckets}connectors.{list_providers, list, create, get, update, delete, sync}namespaces.*andorganization.*api_key,base_url,timeout,max_retries,default_headers,default_query,http_clientSUPERMEMORY_*env varsextra_headers,extra_query,extra_body,timeout, pluswith_optionsNotFoundErrorandRateLimitError, with.responseand.requestwith_raw_response.parse(),.to_dict()/.to_json(), and plain dicts for request params, typed as TypedDictsDocument,Memory,SearchResult,Connector,Profile,FilterAnd, … 104 types instead of 204, set infern/schemas.yaml.MIGRATION.md.How it's built
fern/overlay.yamlfern/schemas.yamlfern/generators.yml,fern/openapi.jsoncustom/case_sensitiveinstead ofcaseSensitive), and a crash on Python 3.9 with current pydanticscripts/generatefern generate --local→ layercustom/→ formatsrc/supermemoryis never edited by hand. CI fails if it doesn't match a fresh generation.Automation
generate.yml) runs onrepository_dispatch: openapi-updatedfrom the API deploy, a daily cron, or a manual run with an optional version. If the generated code changed, it bumps the version (rc1 → rc2, 5.0.0 → 5.0.1), runs the tests and opens a PR.mainwhen the version is new: it builds, publishes withSUPERMEMORY_PYPI_TOKEN, then creates a tag and GitHub release.Testing
README.mdandMIGRATION.md, run against a mock APIactionlintpasses.tests/live/) haven't passed yet. The key used locally got401 Unauthorizedon every v5 route, includingGET /organization. Needs a valid key to confirm.Before merging
CODEGEN_PR_TOKEN(a fine-grained PAT or app token with contents and pull-requests write). PRs opened with the default token don't trigger CI.SUPERMEMORY_LIVE_API_KEYto turn on the live tests, and run them once.gh api repos/supermemoryai/python-sdk/dispatches -f event_type=openapi-updated.supermemory==5.0.0rc1to PyPI.🤖 Generated with Claude Code