Skip to main content

tigris-boto3-ext

CI codecov Python Version PyPI version License

Extend boto3 with Tigris-specific features — snapshots, forks, soft delete, in-place rename and the Bundle API — while keeping full boto3 compatibility. You keep your boto3.client("s3"); this library adds the Tigris headers to the right requests and otherwise stays out of the way.

Installation

pip install tigris-boto3-ext

Requires Python 3.9+ and boto3 >= 1.26.0.

Quick start

import boto3
from tigris_boto3_ext import (
    create_snapshot,
    create_snapshot_bucket,
    get_object_from_snapshot,
    get_snapshot_version,
)

s3 = boto3.client("s3", endpoint_url="https://t3.storage.dev")

create_snapshot_bucket(s3, "my-bucket")
s3.put_object(Bucket="my-bucket", Key="config.json", Body=b'{"version": 1}')
version = get_snapshot_version(create_snapshot(s3, "my-bucket", snapshot_name="v1"))

s3.put_object(Bucket="my-bucket", Key="config.json", Body=b'{"version": 2}')
old = get_object_from_snapshot(s3, "my-bucket", "config.json", version)["Body"].read()
# b'{"version": 1}'

Credentials come from the usual boto3 sources: environment variables, a profile, or keyword arguments to boto3.client.

Features

Everything is imported from tigris_boto3_ext. Each page lists the feature's helpers, context manager and decorator, the headers it sends, and its caveats.

Feature What it does Start with Docs Example
Create bucket Public access, default storage class, region placement and anonymous listing at creation create_bucket docs/create-bucket.md create_bucket_usage.py
Bucket settings Change access, default storage class, placement, Cache-Control, custom domain, response headers and snapshot type after creation update_bucket docs/settings.md settings_usage.py
Object notifications Deliver object events to a webhook, with optional filter and authentication set_bucket_notifications docs/notifications.md notifications_usage.py
CORS boto3's standard CORS calls work on Tigris; the constraints Tigris adds s3.put_bucket_cors docs/cors.md —
Lifecycle rules boto3's standard lifecycle calls work on Tigris; the constraints Tigris adds s3.put_bucket_lifecycle_configuration docs/lifecycle.md —
Data migration Take over a bucket from another S3 provider without an upfront copy: configure the source, list either side, schedule and check object copies set_bucket_migration, migrate_object, is_object_migrated, list_objects_from_source docs/migration.md migration_usage.py
Archive restore Thaw objects in the GLACIER storage class and follow the restore restore_object, get_restore_info docs/restore.md restore_usage.py
Presigned URLs Download or upload URLs from Tigris's presign endpoint, served from the public or custom domain, optionally pinned to a snapshot presign docs/presign.md presign_usage.py
Snapshots Point-in-time copies of a bucket: create, list, read from, delete create_snapshot_bucket, create_snapshot, get_object_from_snapshot docs/snapshots.md snapshots_usage.py
Forks A new bucket from an existing bucket or one of its snapshots, zero-copy; list a bucket's forks create_fork, list_forks docs/forks.md forks_usage.py
Bucket info Snapshot and fork flags from HeadBucket; placement, storage class, forks, soft delete and size from the metadata endpoint get_bucket_info, get_bucket_metadata docs/bucket-info.md bucket_info_usage.py
Bucket listing List buckets with type, visibility, regions, forks and owner list_buckets docs/listing.md listing_usage.py
Storage stats Account totals: buckets, objects, unique objects, bytes get_stats docs/stats.md stats_usage.py
Object rename Move an object to a new key without rewriting its data rename_object docs/rename.md rename_usage.py
Soft delete Deleted objects and buckets stay recoverable for 7–90 days: enable, list, restore, purge create_soft_delete_bucket, set_bucket_soft_delete, restore_deleted_object, restore_bucket docs/soft-delete.md soft_delete_usage.py
Force delete Delete a bucket that still contains objects force_delete_bucket docs/force-delete.md force_delete_usage.py
Bundle API Thousands of objects in one request, as a streaming tar archive bundle_objects docs/bundle.md bundle_usage.py

Usage patterns

Create bucket, snapshots, forks, rename, soft delete and the migration list source each come in three shapes. They do the same thing; pick by how much code the Tigris behaviour should cover. Bucket info, force delete and the Bundle API are single calls and come as helpers only.

Helper functions

One call, one request. The header is registered on the client for the duration of that call and removed before it returns, so sequential code never sees it; concurrent code on the same client can, see Thread safety. The default choice.

from tigris_boto3_ext import rename_object

rename_object(s3, "my-bucket", "old-name.txt", "new-name.txt")

Context managers

Several plain boto3 calls under one Tigris setting. Reach for this when you have a batch to do and the helpers would mean repeating yourself.

from tigris_boto3_ext import TigrisSnapshot

with TigrisSnapshot(s3, "my-bucket", snapshot_version=version):
    config = s3.get_object(Bucket="my-bucket", Key="config.json")
    listing = s3.list_objects_v2(Bucket="my-bucket", Prefix="data/")

Decorators

Wrap an existing function so its boto3 calls run under the setting, without changing its body. The wrapped function must take the client as its first argument.

from tigris_boto3_ext import forked_from

@forked_from("production-data")
def create_dev_environment(s3_client, name):
    return s3_client.create_bucket(Bucket=name)

create_dev_environment(s3, "dev-environment")

Decorators without options (@snapshot_enabled, @with_rename, @with_soft_delete_view) are applied bare. The others are called: @with_snapshot("bucket") and @forked_from("source-bucket") need their bucket, and @soft_delete_enabled(retention_days=30) takes an optional window, so @soft_delete_enabled() with empty parentheses is also valid.

How it works

boto3 lets you hook into a request just before it is signed. This library registers handlers on the client's before-sign.s3.<Operation> events and adds the X-Tigris-* header the feature needs, so the header is covered by the SigV4 signature and the request is otherwise a normal S3 call. When the helper returns, or the context manager or decorated function exits, the handler is removed. Each feature page lists its headers.

Contexts nest. When two active contexts set the same header on the same operation, the inner one wins.

A few features talk to Tigris endpoints that are not S3 operations — the Bundle API (/{bucket}?bundle), bucket metadata (/{bucket}?metadata), bucket settings and soft delete (PATCH /{bucket}), the bucket listing with Tigris details and account stats (GET /?Include…), fork listing (X-Tigris-Fork) and deleted-bucket listing and restore (/?OnlyDeleted=true, /{bucket}?restore). For those the library signs and sends the request itself with the client's credentials, region and endpoint, and a gateway error raises TigrisAPIError (status_code, code, message, request_id).

Thread safety

Header injection is registered on the boto3 client, not on a single request. While a context manager, decorator or helper from this library is active, every matching operation on that client carries the injected headers, including operations issued from other threads. Use a separate client per thread when combining these features with concurrent work.

Helpers whose header changes what a destructive request does go one step further: they raise RuntimeError instead of running while another header injector is active for the same operation on the same client, rather than risk the wrong header on the wrong request. delete_snapshot and force_delete_bucket both send DeleteBucket, so they exclude each other; restore_deleted_object guards RestoreObject. Unrelated operations are not blocked.

Development

Setup

git clone https://github.com/tigrisdata/tigris-boto3-ext.git
cd tigris-boto3-ext

# Install with dev dependencies using uv
uv sync --all-extras

# Or with pip
pip install -e ".[dev]"

Running tests

# Unit tests: mocked clients, no network
uv run pytest tests/ --ignore=tests/integration -v

# Integration tests run against Tigris and are skipped when these are not set
export AWS_ENDPOINT_URL_S3="https://t3.storage.dev"
export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"
uv run pytest tests/integration/ -v

See tests/integration/README.md for the integration test setup in detail.

Code quality

# Type checking
uv run mypy tigris_boto3_ext

# Linting
uv run ruff check tigris_boto3_ext

# Auto-fix linting issues
uv run ruff check --fix tigris_boto3_ext

# Code formatting
uv run ruff format tigris_boto3_ext

# Check formatting without making changes
uv run ruff format --check tigris_boto3_ext

License

Apache-2.0

Contributing

Contributions welcome! Please open an issue or PR on GitHub.

A feature ships as a set: its module under tigris_boto3_ext/buckets/ or tigris_boto3_ext/objects/, a unit test, an integration test, a page under docs/, an example under examples/, and a row in the table above. CLAUDE.md describes the module layout.

Support

For issues and questions:

Metadata

Release files for tigris-boto3-ext 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tigris-boto3-ext 0.8.0
File Size Uploaded Provenance Actions
tigris_boto3_ext-0.8.0.tar.gz 64.3 kB With provenance Details for tigris_boto3_ext-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tigris-boto3-ext 0.8.0
File Interpreter ABI Platform Actions
tigris_boto3_ext-0.8.0-py3-none-any.whl Python 3 none any Details for tigris_boto3_ext-0.8.0-py3-none-any.whl

Total release size: 119.9 kB

Release files / tigris_boto3_ext-0.8.0.tar.gz

Download URL tigris_boto3_ext-0.8.0.tar.gz
Size 64.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e8d527c7cc260d59d88d5bdd2f0b268b95a9dba79b19d8b63f56b0afcac88b76
BLAKE2b-256 checksum
How to use checksums
53dd1bc59bd60c4b4d1211b96b0be5a063f2b6dff1c5c35a073ca202512b2965
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / tigris_boto3_ext-0.8.0-py3-none-any.whl

Download URL tigris_boto3_ext-0.8.0-py3-none-any.whl
Size 55.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e79dd4ad9179867c40e7aa033b6ab36fb66ab61c0d6165fc156d483b10ab7bfc
BLAKE2b-256 checksum
How to use checksums
17bb91c20836e7145d4ca31d8faa21f9897c4c7a3c49667ba73f145ef9e5de9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for tigris-boto3-ext 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tigris_boto3_ext-0.8.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page