Skip to main content

Lightweight library to presign URLs compatible with boto3

Project description

SignURLarity

Fast, lightweight S3 client focused on presigned URL generation. SignURLarity provides a boto3-compatible API with significantly better performance by avoiding the boto3 dependency overhead.

Features

  • Fast presigned URL generation (faster than boto3)
  • Async support with AsyncClient
  • Connection pooling for better performance
  • S3-compatible services (AWS S3, MinIO, etc.)

Performance

When creating a Pull Request, performance tests with respects to boto are ran and added as comment. Obviously, due to the nature of github Actions, the numbers may vary (a lot). Just as an example, here are the numbers of one of the later PR (the bigger the better). See below to run it yourself

Test 3.11 3.12 3.13 3.14
create_bucket_aio 0.888 0.953 0.979 1.071
create_bucket_aio_cm 0.939 0.935 0.946 0.976
create_bucket_sync 1.145 1.194 1.142 1.198
create_bucket_sync_cm 1.141 1.144 1.171 1.173
generate_presigned_post_aio 8.516 8.722 8.606 8.804
generate_presigned_post_aio_cm 8.504 8.742 8.465 8.890
generate_presigned_post_sync 6.845 6.468 6.875 6.995
generate_presigned_post_sync_cm 6.713 6.465 6.638 6.768
generate_presigned_url_aio 15.597 15.490 15.075 17.026
generate_presigned_url_aio_cm 15.599 15.137 14.784 17.059
generate_presigned_url_sync 15.361 14.835 13.976 16.008
generate_presigned_url_sync_cm 14.739 14.806 14.014 16.203
head_bucket_aio 0.996 1.080 1.001 1.009
head_bucket_aio_cm 0.996 1.265 0.997 1.071
head_bucket_sync 1.468 1.522 1.456 1.522
head_bucket_sync_cm 1.211 1.147 1.505 1.507
head_object_aio 0.877 0.916 0.834 0.913
head_object_aio_cm 0.966 0.895 0.885 0.900
head_object_sync 1.516 1.443 0.898 1.584
head_object_sync_cm 1.493 1.547 1.511 1.470

Installation

pip install signurlarity

Quick Start

Synchronous Client

from signurlarity import Client

with Client(
    endpoint_url="https://s3.us-west-2.amazonaws.com",
    aws_access_key_id="your-access-key",
    aws_secret_access_key="your-secret-key",
) as client:
    url = client.generate_presigned_url(
        "get_object",
        Params={"Bucket": "mybucket", "Key": "myfile.txt"},
        ExpiresIn=3600,
    )

Async Client

from signurlarity.aio import AsyncClient

async with AsyncClient(
    endpoint_url="https://s3.us-west-2.amazonaws.com",
    aws_access_key_id="your-access-key",
    aws_secret_access_key="your-secret-key",
) as client:
    url = await client.generate_presigned_url(
        "get_object",
        Params={"Bucket": "mybucket", "Key": "myfile.txt"},
        ExpiresIn=3600,
    )

Documentation

For detailed documentation including:

  • Complete API reference
  • Advanced usage examples
  • Error handling
  • Additional methods (presigned POST, head operations, etc.)

Please refer to the docstrings in the source code:

Development

Run tests

installation pixi

This will run functionnal tests. It will spawn docker container to test against rustfs, minio and moto

pixi run unit-test # add any pytest option you want

Any pytest argument can be added

pre-commit

SignURLarity uses pre-commit to format code and check for issues. The easiest way to use pre-commit is to run the following after cloning:

pixi run pre-commit install

This will result in pre-commit being ran automatically each time you run git commit. If you want to explicitly run pre-commit you can use:

pixi run pre-commit # (1)!
pixi run pre-commit --all-files # (2)!
  1. Runs pre-commit only for files which are uncommitted or which have been changed.
  2. Runs pre-commit for all files even if you haven't changed them.

Benchmark

For a full performance comparison, run

pixi run full-benchmark /whatever/outputdir

This will compare the results of boto and signurlarity against rustfs for python version 3.11, 3.12, 3.13 and 3.14, and generate json files in the output directoty

If you want to run it for a specific version only:

pixi run -e py314 benchmark --test-results-dir=/whatever/you/want

you can then display it with

pixi run -e py314 display-benchmark-comparison --test-results-dir=/whatever/you/want

Profiling tests

A few profiling tests are available

pixi run -e py314 profile-test -s --test-results-dir=/whatever/you/want

This will generate prof files

You can convert it in svg and open it in your web browser like so

pixi shell -e py314
flameprof --format=log profile_generate_presigned_post/presigned_post.prof | flamegraph > profile_generate_presigned_post/presigned_post.svg

:

Example results

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

signurlarity-0.1.0.tar.gz (53.8 kB view details)

Uploaded Source

Built Distribution

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

signurlarity-0.1.0-py3-none-any.whl (33.9 kB view details)

Uploaded Python 3

File details

Details for the file signurlarity-0.1.0.tar.gz.

File metadata

  • Download URL: signurlarity-0.1.0.tar.gz
  • Upload date:
  • Size: 53.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for signurlarity-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fe0d9b35ed89b118aa863511709b0858764b4a0296f695f417caea540e2a6ce2
MD5 1e1e6b0c0481c47e5d4592c0e2ffb333
BLAKE2b-256 b279dadc6bad83b87309a2149722dd82e1fba260815a5fb650dd4bb6fd2dc9a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for signurlarity-0.1.0.tar.gz:

Publisher: deployment.yml on DIRACGrid/signurlarity

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

File details

Details for the file signurlarity-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: signurlarity-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for signurlarity-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 434b821e253780961f9391b7b30f3ea98d0de28ebc9655699cd54a2b04b2a64c
MD5 7de2b749cde90c931e0781c64e24a867
BLAKE2b-256 04b6ad7f50ff3b4a7dd4ec5f6b39dd4550996f4bec91d06d0b6507ab833de1ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for signurlarity-0.1.0-py3-none-any.whl:

Publisher: deployment.yml on DIRACGrid/signurlarity

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