Skip to content

Dx 2777 - Add Python SDK#185

Merged
alitariksahin merged 12 commits into
mainfrom
DX-2777
Jun 24, 2026
Merged

Dx 2777 - Add Python SDK#185
alitariksahin merged 12 commits into
mainfrom
DX-2777

Conversation

@alitariksahin

Copy link
Copy Markdown
Collaborator

No description provided.

@alitariksahin alitariksahin self-assigned this Jun 19, 2026
@linear-code

linear-code Bot commented Jun 19, 2026

Copy link
Copy Markdown

DX-2777

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a first-party Python SDK (packages/python-sdk) for Upstash Box, including async + generated sync clients, typed models, tests, tooling, and CI workflows to keep the Python surface in parity with the existing TypeScript SDK.

Changes:

  • Introduces upstash_box package (async source-of-truth + generated sync client), shared types/helpers, and custom harness helper.
  • Adds comprehensive unit + integration test suites, plus JS↔Python public-surface parity enforcement tooling.
  • Adds Python SDK packaging/docs and CI/publish workflows (ruff/mypy/pytest/parity, PyPI publish via tag).

Reviewed changes

Copilot reviewed 68 out of 69 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/python-sdk/upstash_box/types.py Shared enums, TypedDict inputs, chunk dataclasses, and Pydantic response models.
packages/python-sdk/upstash_box/py.typed Marks package as typed for type checkers.
packages/python-sdk/upstash_box/errors.py Defines BoxError with optional HTTP status code.
packages/python-sdk/upstash_box/custom_harness.py Helper to implement the box-sse-v1 custom harness protocol.
packages/python-sdk/upstash_box/_sync/client.py Generated synchronous client implementation.
packages/python-sdk/upstash_box/_sync/_sse.py Generated sync SSE parsers for run-stream and exec/code-stream.
packages/python-sdk/upstash_box/_sync/_fallbacks.py Handwritten sync escape hatch for non-generatable constructs (currently empty).
packages/python-sdk/upstash_box/_sync/init.py Exposes generated sync public symbols.
packages/python-sdk/upstash_box/_common.py Transport-agnostic helpers (schema conversion, agent config, files, network policy).
packages/python-sdk/upstash_box/_async/_sse.py Async SSE parsers (source-of-truth for sync generation).
packages/python-sdk/upstash_box/_async/init.py Exposes async public symbols.
packages/python-sdk/upstash_box/init.py Top-level package exports, version, and public surface.
packages/python-sdk/tests/integration/test_sync_subset.py Real-API smoke test for sync client.
packages/python-sdk/tests/integration/test_snapshot_async.py Real-API snapshot lifecycle test (async).
packages/python-sdk/tests/integration/test_schedule_async.py Real-API schedule lifecycle test (async).
packages/python-sdk/tests/integration/test_public_url_async.py Real-API public URL CRUD test (async).
packages/python-sdk/tests/integration/test_lifecycle_async.py Real-API lifecycle/config/status/logs/runs tests (async).
packages/python-sdk/tests/integration/test_git_async.py Real-API git operations test (async, no push/PR).
packages/python-sdk/tests/integration/test_files_async.py Real-API files/code/cwd/download test (async).
packages/python-sdk/tests/integration/test_ephemeral_async.py Real-API ephemeral box smoke test (async).
packages/python-sdk/tests/integration/test_env_async.py Real-API env var management test (async).
packages/python-sdk/tests/integration/test_agent_async.py Real-API agent run/stream smoke test (async).
packages/python-sdk/tests/integration/conftest.py Integration gating via env + opts fixture.
packages/python-sdk/tests/helpers.py Shared respx/httpx mocking helpers + SSE stream builders.
packages/python-sdk/tests/conftest.py Ensures test helpers are importable across modules.
packages/python-sdk/tests/_sync/test_sync_client.py Handwritten sync unit suite focusing on streaming/multipart/polling edge cases.
packages/python-sdk/tests/_sync/test_sse_golden.py Golden parity test between async and generated sync SSE parsers.
packages/python-sdk/tests/_async/test_run.py Async run behaviors (cancel, logs filtering/format).
packages/python-sdk/tests/_async/test_models.py Field-level assertions for key response models/chunks.
packages/python-sdk/tests/_async/test_infer_provider.py Tests provider inference helper.
packages/python-sdk/tests/_async/test_errors.py Tests BoxError behavior.
packages/python-sdk/tests/_async/test_ephemeral_box.py Async ephemeral box unit tests.
packages/python-sdk/tests/_async/test_custom_harness.py Tests harness arg parsing + SSE emission contract.
packages/python-sdk/tests/_async/test_common.py Unit tests for _common helpers (schema, files, policies, etc.).
packages/python-sdk/tests/_async/test_box_statics.py Async static methods tests (list/delete/env management).
packages/python-sdk/tests/_async/test_box_snapshot.py Async snapshot/from_snapshot unit tests.
packages/python-sdk/tests/_async/test_box_schedule.py Async schedule namespace unit tests.
packages/python-sdk/tests/_async/test_box_prompt_files.py Async prompt file attachment tests (JSON/multipart/webhook).
packages/python-sdk/tests/_async/test_box_misc.py Async misc namespaces (skills, init command, lifecycle, public URLs).
packages/python-sdk/tests/_async/test_box_instance.py Async instance property/cwd/context manager/close tests.
packages/python-sdk/tests/_async/test_box_git.py Async git namespace unit tests.
packages/python-sdk/tests/_async/test_box_files.py Async files namespace unit tests.
packages/python-sdk/tests/_async/test_box_exec.py Async exec/code/exec-stream unit tests.
packages/python-sdk/tests/_async/test_box_create.py Async create/polling/error handling unit tests.
packages/python-sdk/tests/_async/test_box_agent_run.py Async agent run/stream behaviors, structured output, callbacks.
packages/python-sdk/scripts/generate_sync.py unasync-based generator for _sync/ from _async/.
packages/python-sdk/scripts/extract_js_surface.mjs TypeScript-compiler-based JS SDK public surface extractor.
packages/python-sdk/scripts/check_parity.py CI parity enforcement between JS and Python public surfaces.
packages/python-sdk/RELEASE.md Python SDK release process and versioning policy.
packages/python-sdk/README.md Package documentation + examples.
packages/python-sdk/pyproject.toml Packaging metadata, deps, ruff/mypy/pytest config.
packages/python-sdk/PARITY.md Parity checklist and tracked drift notes.
packages/python-sdk/LICENSE MIT license for the Python SDK package.
packages/python-sdk/examples/webhook.py Webhook (fire-and-forget) async example.
packages/python-sdk/examples/sync_basic.py Basic sync usage example.
packages/python-sdk/examples/streaming_structured.py Streaming + Pydantic structured output example.
packages/python-sdk/examples/snapshot_restore.py Snapshot + restore example.
packages/python-sdk/examples/git_pr.py Git + agent + PR creation flow example.
packages/python-sdk/examples/file_upload.py File upload example (ephemeral box).
packages/python-sdk/examples/custom_harness.py Custom harness process example.
packages/python-sdk/examples/basic.py Basic async quickstart example.
packages/python-sdk/CONTRIBUTING.md Contribution guide emphasizing async source-of-truth + sync generation.
packages/python-sdk/CHANGELOG.md Initial release changelog entry.
packages/python-sdk/.gitignore Python SDK local build/test/env ignores.
AGENTS.md Adds Python SDK workflow guidance to repo agent instructions.
.pre-commit-config.yaml Optional pre-commit hooks for Python SDK generation + ruff.
.github/workflows/python-sdk-publish.yml Tagged/manual gated PyPI publish workflow.
.github/workflows/python-sdk-ci.yml Python SDK CI workflow (ruff, generation check, mypy, pytest, parity).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/python-sdk/upstash_box/types.py
Comment thread packages/python-sdk/scripts/generate_sync.py
Comment thread packages/python-sdk/PARITY.md
Comment thread packages/python-sdk/scripts/check_parity.py
Comment thread packages/python-sdk/README.md

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 68 out of 69 changed files in this pull request and generated 2 comments.

Comment thread packages/python-sdk/upstash_box/custom_harness.py
Comment thread packages/python-sdk/upstash_box/_sync/client.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 68 out of 69 changed files in this pull request and generated 1 comment.

Comment thread packages/python-sdk/scripts/check_parity.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 68 out of 69 changed files in this pull request and generated 2 comments.

Comment thread packages/python-sdk/upstash_box/_common.py Outdated
Comment thread packages/python-sdk/upstash_box/_sync/client.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 68 out of 69 changed files in this pull request and generated 6 comments.

Comment thread packages/python-sdk/upstash_box/_async/client.py
Comment thread packages/python-sdk/upstash_box/_sync/client.py
Comment thread packages/python-sdk/upstash_box/_async/client.py
Comment thread packages/python-sdk/upstash_box/_async/client.py
Comment thread packages/python-sdk/upstash_box/_sync/client.py
Comment thread packages/python-sdk/upstash_box/_sync/client.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 68 out of 69 changed files in this pull request and generated 1 comment.

Comment thread packages/python-sdk/upstash_box/_async/client.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 68 out of 69 changed files in this pull request and generated 2 comments.

Comment thread packages/python-sdk/upstash_box/types.py
Comment thread packages/python-sdk/README.md

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 68 out of 69 changed files in this pull request and generated 4 comments.

Comment thread packages/python-sdk/tests/helpers.py Outdated
Comment thread packages/python-sdk/tests/helpers.py Outdated
Comment thread packages/python-sdk/tests/helpers.py Outdated
Comment thread packages/python-sdk/tests/helpers.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 68 out of 69 changed files in this pull request and generated 2 comments.

Comment thread packages/python-sdk/upstash_box/types.py
Comment thread packages/python-sdk/upstash_box/types.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 68 out of 69 changed files in this pull request and generated 2 comments.

Comment on lines +876 to +881
for f in files:
resolved = self._resolve_path(f["destination"])
with open(f["path"], "rb") as fh:
content = fh.read()
data_paths.append(resolved)
upload_files.append(("files", (f["destination"], content)))
Comment on lines +1566 to +1572
def _build_multipart_files(file_paths: List[str]) -> List[Any]:
out = []
for path in file_paths:
with open(path, "rb") as fh:
content = fh.read()
out.append(("files", (os.path.basename(path), content, common.mime_for_path(path))))
return out
@CahidArda

CahidArda commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

some test steps running twice

image

also, we name the python text with "Python ...", let's update typescript test names to include "TypeScript ..." in their names

Comment thread .github/workflows/python-sdk-ci.yml Outdated
Comment thread packages/python-sdk/pyproject.toml
Comment thread packages/python-sdk/upstash_box/_async/client.py Outdated
Comment thread packages/python-sdk/upstash_box/_async/client.py Outdated
Comment thread packages/python-sdk/upstash_box/_async/client.py Outdated
Comment thread packages/python-sdk/upstash_box/_async/client.py Outdated
Comment thread packages/python-sdk/upstash_box/_async/client.py
Comment thread packages/python-sdk/upstash_box/_async/client.py Outdated
Comment thread packages/python-sdk/upstash_box/_async/client.py Outdated
@alitariksahin alitariksahin merged commit 41f045f into main Jun 24, 2026
10 of 11 checks passed
@alitariksahin alitariksahin deleted the DX-2777 branch June 24, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants