Skip to main content

Python SDK for Tusk Drift instrumentation and replay

Project description

Tusk Drift Banner

PyPI version PyPI - Python Version License: Apache 2.0 Tusk X account Tusk Community Slack

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

Tusk Drift Animated Diagram Tusk Drift Animated Diagram

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:

  1. 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.

  2. Create configuration: Run tusk init to create your .tusk/config.yaml config file interactively, or create it manually per the configuration docs.

  3. Initialize the SDK: Refer to the initialization guide to instrument the SDK in your service.

  4. Record and replay: Follow the quick start guide to record and replay your first test!

Troubleshooting

Having issues?

Community

Join our open source community on Slack.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tusk_drift_python_sdk-0.1.27.tar.gz (299.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tusk_drift_python_sdk-0.1.27-py3-none-any.whl (357.8 kB view details)

Uploaded Python 3

File details

Details for the file tusk_drift_python_sdk-0.1.27.tar.gz.

File metadata

  • Download URL: tusk_drift_python_sdk-0.1.27.tar.gz
  • Upload date:
  • Size: 299.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tusk_drift_python_sdk-0.1.27.tar.gz
Algorithm Hash digest
SHA256 4dc5e70b72fb5ae18b026e4b8e55aeb38be5edeafd34920ec96b8605869be66e
MD5 ae1c1d4d958b9ba8a41af563d3388455
BLAKE2b-256 c1cd94745498e36aaf14df84a915478023f01cd38fab7671ceecaf7a73bd067d

See more details on using hashes here.

Provenance

The following attestation bundles were made for tusk_drift_python_sdk-0.1.27.tar.gz:

Publisher: publish-python-sdk.yml on Use-Tusk/drift-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tusk_drift_python_sdk-0.1.27-py3-none-any.whl.

File metadata

File hashes

Hashes for tusk_drift_python_sdk-0.1.27-py3-none-any.whl
Algorithm Hash digest
SHA256 1aac1f664abedcd598b26cd48c4a76e0715e5547e23208d74f0dae6f7f0b88b2
MD5 27d3ed80f3286747e8454ef115fa3295
BLAKE2b-256 936835281fa57c07ded9ad39268fb640120ca2abeab8bd00f417b677c94a64e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for tusk_drift_python_sdk-0.1.27-py3-none-any.whl:

Publisher: publish-python-sdk.yml on Use-Tusk/drift-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page