You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit acb3c24
Browse filesBrowse the repository at this point in the historyBrowse files
Release Python SDK 2.0 with asyncio and Python 3.12+ (#56)
Add AsyncTransloadit over the handwritten SDK client surface and require Python 3.12+. Prepare version 2.0.0, update runtime/tooling and document migration.
Contract-generated endpoints are deferred to #61 and API2-owned emitters in transloadit/api2#9252.
Closes#9.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,8 @@
1
+
### 2.0.0 / Unreleased ###
2
+
* Added `AsyncTransloadit` with asyncio support for the existing synchronous client's Assembly, Template and billing methods, plus Smart CDN URL signing. Polling uses `asyncio.sleep`; resumable uploads run tuspy in worker threads.
3
+
***Breaking Change**: Python 3.12 or newer is required. Upgrade development, CI and deployment interpreters before installing 2.0. Applications that need Python 3.9–3.11 can pin `pytransloadit<2` (latest 1.x: 1.0.4).
4
+
***Upgrade notes**: Update application constraints for `requests>=2.33,<3` and `urllib3>=2.7,<3`, then regenerate your lockfile. Existing synchronous imports and methods remain available; asyncio applications can use `async with AsyncTransloadit(...)` and await network operations. See README for request-handling corrections, including explicit polling retry exhaustion, trusted Assembly URLs, redirect handling and Smart CDN validation/boolean serialization. Keep file context managers open around awaited uploads; cancellation waits for active file reads and resumable workers to finish. Resumable transfers do not inherit an injected aiohttp session's proxy/TLS settings. Source contributors use Poetry 2.4.1 with `[project]` metadata; isolated source builds require `poetry-core>=2.2,<3`.
5
+
1
6
### 1.0.4 / 2026-05-20 ###
2
7
* Refreshed locked runtime and development dependencies, including `aiohttp` 3.13.5, `idna` 3.15, `pygments` 2.20.0, Python-version-specific `requests` updates, and `tuspy` 1.1.0.
3
8
* Updated development tooling to Python 3.9-compatible majors: `pytest` 8.4, `pytest-cov` 7.1, `Sphinx` 7.4, and `sphinx-autobuild` 2024.10.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+17-11Lines changed: 17 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,36 +7,42 @@
7
7
- Push access to `transloadit/python-sdk`
8
8
- PyPI API token with publish rights (`PYPI_TOKEN`), exported or stored in `.env`
9
9
10
-
**Steps for version `1.0.3` (example)**
11
-
1. Bump version in `pyproject.toml`, `transloadit/__init__.py`, and `tests/test_request.py`.
12
-
2.Add the `### 1.0.3 / YYYY-MM-DD ###` entry to`CHANGELOG.md`.
13
-
3. Run the matrix (add `PYTHON_SDK_E2E=1` if you want the live upload):
10
+
**Steps for version `2.0.0` (example)**
11
+
1. Bump version in `pyproject.toml`, `transloadit/__init__.py`, and `tests/test_request.py`, and update `version`/`release` in `docs/source/conf.py`. PR #56 prepares these as `2.0.0`/`2.0` already.
12
+
2.Replace `Unreleased` in the `### 2.0.0 / Unreleased ###` entry in`CHANGELOG.md` with the actual release date (`YYYY-MM-DD`). Review the breaking changes and upgrade notes in README and the Sphinx docs. The publishing helper rejects an `Unreleased` entry; `--dry-run` allows it so a prepared release can still be validated.
13
+
3. Run the full Python 3.12, 3.13, and 3.14 matrix, then the optional live upload with test-account credentials:
The synchronous imports and methods remain available on supported interpreters.
37
+
SDK 2.0 adds the separate `AsyncTransloadit` client for asyncio
38
+
applications. The dependency refresh shipped in 1.0.4 does not require upgrading
39
+
to 2.0.
40
+
41
+
Request-handling changes to account for when upgrading:
42
+
43
+
- Smart CDN boolean parameters use `true`/`false` to match the reference CLI. Workspace slugs must be DNS-safe; `auth_key`, `exp` and `sig` are reserved query keys.
- HTTP redirects are returned to the caller instead of followed automatically. Invalid service URLs and empty/dot-segment Template IDs raise `ValueError`.
46
+
- Template creation sends steps inside the `template` object. When combining a `template` option with `add_step`, supply an object rather than a serialized JSON string.
47
+
- Non-JSON responses return text or bytes in `Response.data`; empty bodies return an empty string. With `wait=True`, exhausting consecutive status rate-limit retries raises `AssemblyPollingError` (a `RuntimeError` subclass). The Assembly may still be running: use the error's `assembly_url` to resume polling or cancel, and inspect `assembly_response`/`last_response` for creation and rate-limit details. Normal API error responses still need an `error` check.
48
+
49
+
Source contributors use Poetry 2.4.1 with the new `[project]` metadata; isolated
50
+
source builds require `poetry-core>=2.2,<3`. Normal pip installation manages the
The async client keeps polling on `asyncio.sleep`. Resumable uploads still use the existing TUS client, but are offloaded to worker threads so the event loop stays responsive.
90
+
91
+
An injected aiohttp session configures Assembly creation and polling. Resumable
92
+
file transfers use tuspy's separate Requests transport and do not inherit that
93
+
session's explicit proxy or TLS connector settings; configure the Requests
94
+
environment for those transfers.
95
+
96
+
Cancellation of a resumable upload waits for the tuspy upload batch, including
97
+
retries, to finish before releasing your files. Multipart cancellation waits for
98
+
any active file read. Timeout and shutdown cleanup can therefore exceed the
99
+
requested deadline; keep file context managers open around the awaited call.
100
+
101
+
If you do not use `async with`, call `await tl.aclose()` when you are done with the session.
102
+
103
+
## Client features
104
+
105
+
`AsyncTransloadit` mirrors the existing synchronous client: Assembly creation,
106
+
retrieval, listing and cancellation; Template creation, retrieval, listing,
107
+
updates and deletion; monthly billing; and Smart CDN URL signing. Use the
108
+
Assembly helpers for multipart or resumable uploads and completion polling.
109
+
Await the async client's network methods; local factories and URL signing stay
sync and async Template lifecycle management, and Smart CDN URL signing.
42
119
43
120
## Documentation
44
121
@@ -56,21 +133,21 @@ scripts/test-in-docker.sh
56
133
57
134
This script will:
58
135
59
-
- build images for the Python versions we test in CI (3.9–3.13)
60
-
- install Poetry, Node.js 20, and the Transloadit CLI
136
+
- build images for the Python versions we test in CI (3.12, 3.13, and 3.14)
137
+
- install Poetry, Node.js 24, and the Transloadit CLI
61
138
- pass credentials from `.env` (if present) so end-to-end tests can run against real Transloadit accounts
62
139
63
-
Signature parity tests use `npx transloadit smart_sig` under the hood, matching the reference implementation used by our other SDKs. Our GitHub Actions workflow also runs the E2E upload against Python 3.12 on every push/PR using a dedicated Transloadit test account (wired through the `TRANSLOADIT_KEY` and `TRANSLOADIT_SECRET` secrets).
140
+
Signature parity tests use `npx transloadit smart_sig` under the hood, matching the reference implementation used by our other SDKs. Our GitHub Actions workflow also runs the E2E upload and quickstart examples against Python 3.14 on every push/PR using a dedicated Transloadit test account (wired through the `TRANSLOADIT_KEY` and `TRANSLOADIT_SECRET` secrets).
64
141
65
-
Pass `--python 3.12` (or set `PYTHON_VERSIONS`) to restrict the matrix, or append a custom command after `--`, for example `scripts/test-in-docker.sh -- pytest -k smartcdn`.
142
+
Pass `--python 3.14` (or set `PYTHON_VERSIONS`) to restrict the matrix, or append a custom command after `--`, for example `scripts/test-in-docker.sh -- pytest -k smartcdn`.
66
143
67
144
To exercise the optional end-to-end upload against a real Transloadit account, provide `TRANSLOADIT_KEY` and `TRANSLOADIT_SECRET` (via environment variables or `.env`) and set `PYTHON_SDK_E2E=1`:
0 commit comments