Python SDK for Tusk Drift instrumentation and replay
Project description
The Python Tusk Drift SDK enables fast and deterministic API testing by capturing and replaying API calls made to/from your service. Automatically record real-world API calls, then replay them as tests using the Tusk CLI to find regressions. During replay, all outbound requests are intercepted with recorded data to ensure consistent behavior without side-effects.
Documentation
For comprehensive guides and API reference, visit our full documentation.
SDK Guides
- Initialization Guide - Set up the SDK in your Python application
- Environment Variables - Environment variables reference
- Quick Start Guide - Record and replay your first trace
Requirements
- Python 3.9+
Tusk Drift currently supports the following packages and versions:
| Package | Supported Versions |
|---|---|
| Flask | >=2.0.0 |
| FastAPI | >=0.68.0 |
| Django | >=3.2.0 |
| Requests | all versions |
| HTTPX | all versions |
| aiohttp | all versions |
| urllib3 | all versions |
| grpcio (client-side only) | all versions |
| psycopg | >=3.1.12 |
| psycopg2 | all versions |
| SQLAlchemy | all versions |
| Redis | >=4.0.0 |
| Kinde | >=2.0.1 |
| PyJWT | all versions |
| urllib.request | all versions |
If you're using packages or versions not listed above, please create an issue with the package + version you'd like an instrumentation for.
Installation
Step 1: Install the CLI
First, install the Tusk Drift CLI by following our CLI installation guide.
Step 2: Set up Tusk Drift
AI-powered setup (recommended)
Use our AI agent to automatically set up Tusk Drift for your service:
cd path/to/your/service
export ANTHROPIC_API_KEY=your-api-key
tusk drift setup
The agent will analyze your codebase, install the SDK, instrument it into your application, create configuration files, and test the setup with recording and replay.
Manual setup
Alternatively, you can set up Tusk Drift manually:
-
Install the SDK:
# Use Rust bindings for better performance pip install tusk-drift-python-sdk[rust] # Fallback if no platform-compatible wheel pip install tusk-drift-python-sdk
For more information about Rust acceleration, refer to this doc.
-
Create configuration: Run
tusk initto create your.tusk/config.yamlconfig file interactively, or create it manually per the configuration docs. -
Initialize the SDK: Refer to the initialization guide to instrument the SDK in your service.
-
Record and replay: Follow the quick start guide to record and replay your first test!
Troubleshooting
Having issues?
- Check our initialization guide for common setup issues
- Create an issue or reach us at support@usetusk.ai.
Community
Join our open source community on Slack.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tusk_drift_python_sdk-0.1.29.tar.gz.
File metadata
- Download URL: tusk_drift_python_sdk-0.1.29.tar.gz
- Upload date:
- Size: 299.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88aab1cf4fd9a54e09e93bb4f815dab2307c269c548efd8f79ff9e3ef004ea1d
|
|
| MD5 |
e52ef044f4e503230f6fcd24e5e680a9
|
|
| BLAKE2b-256 |
4a0a6bdf7eecb913a00997378f7d2559fc6d86497b96c78a5c1d6dc4d7088f3b
|
Provenance
The following attestation bundles were made for tusk_drift_python_sdk-0.1.29.tar.gz:
Publisher:
publish-python-sdk.yml on Use-Tusk/drift-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tusk_drift_python_sdk-0.1.29.tar.gz -
Subject digest:
88aab1cf4fd9a54e09e93bb4f815dab2307c269c548efd8f79ff9e3ef004ea1d - Sigstore transparency entry: 1468791627
- Sigstore integration time:
-
Permalink:
Use-Tusk/drift-python-sdk@30742a903fb4618595eb9804f3498fba1562d6b1 -
Branch / Tag:
refs/tags/v0.1.29 - Owner: https://github.com/Use-Tusk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-sdk.yml@30742a903fb4618595eb9804f3498fba1562d6b1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tusk_drift_python_sdk-0.1.29-py3-none-any.whl.
File metadata
- Download URL: tusk_drift_python_sdk-0.1.29-py3-none-any.whl
- Upload date:
- Size: 357.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d077ae002297ab11c2111e81cc08545661f635e43e1e30f5c287a7942b757acd
|
|
| MD5 |
6a58dc86a1b93c72419289776e6fb51c
|
|
| BLAKE2b-256 |
89818f85e92f1ef9cc1b3328390d789b86521e9810d00ff959e6198b72ed304c
|
Provenance
The following attestation bundles were made for tusk_drift_python_sdk-0.1.29-py3-none-any.whl:
Publisher:
publish-python-sdk.yml on Use-Tusk/drift-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tusk_drift_python_sdk-0.1.29-py3-none-any.whl -
Subject digest:
d077ae002297ab11c2111e81cc08545661f635e43e1e30f5c287a7942b757acd - Sigstore transparency entry: 1468791762
- Sigstore integration time:
-
Permalink:
Use-Tusk/drift-python-sdk@30742a903fb4618595eb9804f3498fba1562d6b1 -
Branch / Tag:
refs/tags/v0.1.29 - Owner: https://github.com/Use-Tusk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-sdk.yml@30742a903fb4618595eb9804f3498fba1562d6b1 -
Trigger Event:
release
-
Statement type: