Name | libpresign JSON |
Version |
1.2.0
JSON |
| download |
home_page | None |
Summary | High-performance library for generating AWS S3 presigned URLs |
upload_time | 2025-07-27 04:16:11 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT |
keywords |
aws
s3
presigned-url
performance
c++
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# libpresign
[](https://github.com/myk0la-b/libpresign/actions/workflows/ci.yml)
[](https://pypi.org/project/libpresign/)
[](https://pypi.org/project/libpresign/)
[](https://github.com/myk0la-b/libpresign/blob/main/LICENSE)
[](https://pepy.tech/project/libpresign)
High-performance library for generating AWS S3 presigned URLs. Generate presigned URLs up to 160x faster than boto3.
## Features
- ๐ **Lightning Fast**: 5-160x faster than boto3 for presigned URL generation
- ๐ **Secure**: Full AWS Signature Version 4 compliance
- ๐ **Compatible**: Works with S3 and S3-compatible services (MinIO, Wasabi, etc.)
- ๐ฆ **Lightweight**: Minimal dependencies, pure C++ implementation
- ๐ **Python Ready**: Simple Python bindings with type hints
- ๐งต **Thread Safe**: Generate URLs concurrently without locks
- ๐ฐ **Cost Effective**: Reduce compute costs with faster operations
## Installation
```bash
pip install libpresign
```
Pre-built wheels are available for:
- **Linux**: x86_64, aarch64 (Python 3.8-3.13)
- **macOS**: x86_64, arm64 (Python 3.8-3.13)
- **Windows**: AMD64 (Python 3.8-3.13)
## Quick Start
```python
import libpresign
# Generate a presigned URL
url = libpresign.get(
access_key_id="AKIAIOSFODNN7EXAMPLE",
secret_access_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
region="us-east-1",
bucket="my-bucket",
key="path/to/file.jpg",
expires=3600 # URL valid for 1 hour
)
print(url)
# https://my-bucket.s3.us-east-1.amazonaws.com/path/to/file.jpg?X-Amz-Algorithm=...
```
## Performance
### Benchmark Results
Generate 10,000 presigned URLs:
| Library | Time (ms) | URLs/sec | Speedup |
|---------|-----------|----------|---------|
| libpresign | **60** | **166,667** | **160x** |
| boto3 | 9,600 | 1,042 | 1x |
Single URL generation:
| Library | Time (ฮผs) | Memory |
|---------|-----------|---------|
| libpresign | **6** | 262 bytes |
| boto3 | 102 | 1.6 KB |
## Usage Examples
### Basic Usage
```python
import libpresign
# Simple URL generation
url = libpresign.get(
access_key_id="your-access-key",
secret_access_key="your-secret-key",
region="us-east-1",
bucket="my-bucket",
key="document.pdf"
)
```
### Custom Endpoint (MinIO/S3-Compatible)
```python
# Use with MinIO or other S3-compatible storage
url = libpresign.get(
access_key_id="minioadmin",
secret_access_key="minioadmin",
region="us-east-1",
bucket="my-bucket",
key="file.txt",
expires=3600,
endpoint="https://minio.example.com"
)
```
### Batch Generation
```python
# Generate multiple URLs efficiently
config = {
"access_key_id": "your-access-key",
"secret_access_key": "your-secret-key",
"region": "us-west-2",
"bucket": "my-bucket",
"expires": 3600
}
urls = []
for i in range(1000):
url = libpresign.get(**config, key=f"file_{i}.jpg")
urls.append(url)
```
### Integration with Web Frameworks
#### FastAPI
```python
from fastapi import FastAPI
import libpresign
app = FastAPI()
@app.get("/presigned-url")
async def get_presigned_url(file_key: str):
url = libpresign.get(
access_key_id="...",
secret_access_key="...",
region="us-east-1",
bucket="uploads",
key=file_key,
expires=3600
)
return {"url": url}
```
#### Django
```python
from django.http import JsonResponse
import libpresign
def download_file(request, file_id):
url = libpresign.get(
access_key_id=settings.AWS_ACCESS_KEY_ID,
secret_access_key=settings.AWS_SECRET_ACCESS_KEY,
region=settings.AWS_REGION,
bucket=settings.S3_BUCKET,
key=f"files/{file_id}",
expires=300 # 5 minutes
)
return JsonResponse({"download_url": url})
```
## API Reference
### `libpresign.get()`
Generate a presigned URL for S3 object access.
**Parameters:**
- `access_key_id` (str): AWS access key ID
- `secret_access_key` (str): AWS secret access key
- `region` (str | None): AWS region (defaults to "us-east-1")
- `bucket` (str): S3 bucket name
- `key` (str): S3 object key
- `expires` (int): URL expiration time in seconds (defaults to 3600)
- `endpoint` (str | None): Custom S3 endpoint URL
**Returns:**
- `str`: Presigned URL
**Raises:**
- `SystemError`: If required parameters are invalid
## Development
### Setup Development Environment
```bash
# Clone the repository
git clone https://github.com/myk0la-b/libpresign.git
cd libpresign
# Install uv package manager
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create virtual environment
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install in editable mode with dev dependencies
uv pip install -e ".[dev]"
```
### Running Tests
```bash
# Run all tests with coverage
uv run pytest
# Run specific test file
uv run pytest tests/test_basic.py
# Run benchmarks
uv run pytest tests/test_benchmark_boto3.py -v
```
### Code Quality
```bash
# Format code
uv run ruff format .
# Lint code
uv run ruff check .
# Type checking
uv run mypy libpresign
```
## Building from Source
### Prerequisites
- C++ compiler with C++11 support
- CMake 3.15+
- OpenSSL 3.x
- Python 3.8+
### Build Instructions
```bash
# Quick build
pip install .
# Development build
pip install -e .
# Build wheel
pip wheel . --no-deps
```
## Contributing
We welcome contributions! Please see our [Contributing Guide](https://github.com/myk0la-b/libpresign/blob/main/docs/contributing.md) for details.
### Reporting Issues
If you find a bug or have a feature request, please [open an issue](https://github.com/myk0la-b/libpresign/issues).
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Acknowledgments
- Built with [OpenSSL](https://www.openssl.org/) for cryptographic operations
- Inspired by the need for faster S3 presigned URL generation
- Thanks to all [contributors](https://github.com/myk0la-b/libpresign/graphs/contributors)
## Links
- [Documentation](https://myk0la-b.github.io/libpresign/)
- [PyPI Package](https://pypi.org/project/libpresign/)
- [GitHub Repository](https://github.com/myk0la-b/libpresign)
- [Issue Tracker](https://github.com/myk0la-b/libpresign/issues)
- [Changelog](https://github.com/myk0la-b/libpresign/blob/main/CHANGELOG.md)
Raw data
{
"_id": null,
"home_page": null,
"name": "libpresign",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "aws, s3, presigned-url, performance, c++",
"author": null,
"author_email": "Mykola Bashmakov <mykola@bashmakov.agency>",
"download_url": "https://files.pythonhosted.org/packages/8f/cc/45cf9ad3a64f5c080de2d5768594662cf685876dcb8f6913293ecd8a84e4/libpresign-1.2.0.tar.gz",
"platform": null,
"description": "# libpresign\n\n[](https://github.com/myk0la-b/libpresign/actions/workflows/ci.yml)\n[](https://pypi.org/project/libpresign/)\n[](https://pypi.org/project/libpresign/)\n[](https://github.com/myk0la-b/libpresign/blob/main/LICENSE)\n[](https://pepy.tech/project/libpresign)\n\nHigh-performance library for generating AWS S3 presigned URLs. Generate presigned URLs up to 160x faster than boto3.\n\n## Features\n\n- \ud83d\ude80 **Lightning Fast**: 5-160x faster than boto3 for presigned URL generation\n- \ud83d\udd10 **Secure**: Full AWS Signature Version 4 compliance\n- \ud83c\udf0d **Compatible**: Works with S3 and S3-compatible services (MinIO, Wasabi, etc.)\n- \ud83d\udce6 **Lightweight**: Minimal dependencies, pure C++ implementation\n- \ud83d\udc0d **Python Ready**: Simple Python bindings with type hints\n- \ud83e\uddf5 **Thread Safe**: Generate URLs concurrently without locks\n- \ud83d\udcb0 **Cost Effective**: Reduce compute costs with faster operations\n\n## Installation\n\n```bash\npip install libpresign\n```\n\nPre-built wheels are available for:\n- **Linux**: x86_64, aarch64 (Python 3.8-3.13)\n- **macOS**: x86_64, arm64 (Python 3.8-3.13)\n- **Windows**: AMD64 (Python 3.8-3.13)\n\n## Quick Start\n\n```python\nimport libpresign\n\n# Generate a presigned URL\nurl = libpresign.get(\n access_key_id=\"AKIAIOSFODNN7EXAMPLE\",\n secret_access_key=\"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\",\n region=\"us-east-1\",\n bucket=\"my-bucket\",\n key=\"path/to/file.jpg\",\n expires=3600 # URL valid for 1 hour\n)\n\nprint(url)\n# https://my-bucket.s3.us-east-1.amazonaws.com/path/to/file.jpg?X-Amz-Algorithm=...\n```\n\n## Performance\n\n### Benchmark Results\n\nGenerate 10,000 presigned URLs:\n\n| Library | Time (ms) | URLs/sec | Speedup |\n|---------|-----------|----------|---------|\n| libpresign | **60** | **166,667** | **160x** |\n| boto3 | 9,600 | 1,042 | 1x |\n\nSingle URL generation:\n\n| Library | Time (\u03bcs) | Memory |\n|---------|-----------|---------|\n| libpresign | **6** | 262 bytes |\n| boto3 | 102 | 1.6 KB |\n\n## Usage Examples\n\n### Basic Usage\n\n```python\nimport libpresign\n\n# Simple URL generation\nurl = libpresign.get(\n access_key_id=\"your-access-key\",\n secret_access_key=\"your-secret-key\",\n region=\"us-east-1\",\n bucket=\"my-bucket\",\n key=\"document.pdf\"\n)\n```\n\n### Custom Endpoint (MinIO/S3-Compatible)\n\n```python\n# Use with MinIO or other S3-compatible storage\nurl = libpresign.get(\n access_key_id=\"minioadmin\",\n secret_access_key=\"minioadmin\",\n region=\"us-east-1\",\n bucket=\"my-bucket\",\n key=\"file.txt\",\n expires=3600,\n endpoint=\"https://minio.example.com\"\n)\n```\n\n### Batch Generation\n\n```python\n# Generate multiple URLs efficiently\nconfig = {\n \"access_key_id\": \"your-access-key\",\n \"secret_access_key\": \"your-secret-key\",\n \"region\": \"us-west-2\",\n \"bucket\": \"my-bucket\",\n \"expires\": 3600\n}\n\nurls = []\nfor i in range(1000):\n url = libpresign.get(**config, key=f\"file_{i}.jpg\")\n urls.append(url)\n```\n\n### Integration with Web Frameworks\n\n#### FastAPI\n```python\nfrom fastapi import FastAPI\nimport libpresign\n\napp = FastAPI()\n\n@app.get(\"/presigned-url\")\nasync def get_presigned_url(file_key: str):\n url = libpresign.get(\n access_key_id=\"...\",\n secret_access_key=\"...\",\n region=\"us-east-1\",\n bucket=\"uploads\",\n key=file_key,\n expires=3600\n )\n return {\"url\": url}\n```\n\n#### Django\n```python\nfrom django.http import JsonResponse\nimport libpresign\n\ndef download_file(request, file_id):\n url = libpresign.get(\n access_key_id=settings.AWS_ACCESS_KEY_ID,\n secret_access_key=settings.AWS_SECRET_ACCESS_KEY,\n region=settings.AWS_REGION,\n bucket=settings.S3_BUCKET,\n key=f\"files/{file_id}\",\n expires=300 # 5 minutes\n )\n return JsonResponse({\"download_url\": url})\n```\n\n## API Reference\n\n### `libpresign.get()`\n\nGenerate a presigned URL for S3 object access.\n\n**Parameters:**\n- `access_key_id` (str): AWS access key ID\n- `secret_access_key` (str): AWS secret access key\n- `region` (str | None): AWS region (defaults to \"us-east-1\")\n- `bucket` (str): S3 bucket name\n- `key` (str): S3 object key\n- `expires` (int): URL expiration time in seconds (defaults to 3600)\n- `endpoint` (str | None): Custom S3 endpoint URL\n\n**Returns:**\n- `str`: Presigned URL\n\n**Raises:**\n- `SystemError`: If required parameters are invalid\n\n## Development\n\n### Setup Development Environment\n\n```bash\n# Clone the repository\ngit clone https://github.com/myk0la-b/libpresign.git\ncd libpresign\n\n# Install uv package manager\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n\n# Create virtual environment\nuv venv\nsource .venv/bin/activate # On Windows: .venv\\Scripts\\activate\n\n# Install in editable mode with dev dependencies\nuv pip install -e \".[dev]\"\n```\n\n### Running Tests\n\n```bash\n# Run all tests with coverage\nuv run pytest\n\n# Run specific test file\nuv run pytest tests/test_basic.py\n\n# Run benchmarks\nuv run pytest tests/test_benchmark_boto3.py -v\n```\n\n### Code Quality\n\n```bash\n# Format code\nuv run ruff format .\n\n# Lint code\nuv run ruff check .\n\n# Type checking\nuv run mypy libpresign\n```\n\n## Building from Source\n\n### Prerequisites\n\n- C++ compiler with C++11 support\n- CMake 3.15+\n- OpenSSL 3.x\n- Python 3.8+\n\n### Build Instructions\n\n```bash\n# Quick build\npip install .\n\n# Development build\npip install -e .\n\n# Build wheel\npip wheel . --no-deps\n```\n\n## Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](https://github.com/myk0la-b/libpresign/blob/main/docs/contributing.md) for details.\n\n### Reporting Issues\n\nIf you find a bug or have a feature request, please [open an issue](https://github.com/myk0la-b/libpresign/issues).\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Built with [OpenSSL](https://www.openssl.org/) for cryptographic operations\n- Inspired by the need for faster S3 presigned URL generation\n- Thanks to all [contributors](https://github.com/myk0la-b/libpresign/graphs/contributors)\n\n## Links\n\n- [Documentation](https://myk0la-b.github.io/libpresign/)\n- [PyPI Package](https://pypi.org/project/libpresign/)\n- [GitHub Repository](https://github.com/myk0la-b/libpresign)\n- [Issue Tracker](https://github.com/myk0la-b/libpresign/issues)\n- [Changelog](https://github.com/myk0la-b/libpresign/blob/main/CHANGELOG.md)",
"bugtrack_url": null,
"license": "MIT",
"summary": "High-performance library for generating AWS S3 presigned URLs",
"version": "1.2.0",
"project_urls": {
"Changelog": "https://github.com/myk0la-b/libpresign/blob/main/CHANGELOG.md",
"Documentation": "https://myk0la-b.github.io/libpresign/",
"Homepage": "https://github.com/myk0la-b/libpresign",
"Issues": "https://github.com/myk0la-b/libpresign/issues",
"Repository": "https://github.com/myk0la-b/libpresign.git"
},
"split_keywords": [
"aws",
" s3",
" presigned-url",
" performance",
" c++"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e2c371c26abf204a14aa539c2361f469c100540690e42e3fe0bf11457442394f",
"md5": "1329a211642370887766e456780ba304",
"sha256": "c7edacd9dfd6fbd52bc9f94a29a3f39b4d44a8d2c350ae7e021a763194f1f10a"
},
"downloads": -1,
"filename": "libpresign-1.2.0-cp38-abi3-macosx_14_0_arm64.whl",
"has_sig": false,
"md5_digest": "1329a211642370887766e456780ba304",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 2268110,
"upload_time": "2025-07-27T04:16:01",
"upload_time_iso_8601": "2025-07-27T04:16:01.659914Z",
"url": "https://files.pythonhosted.org/packages/e2/c3/71c26abf204a14aa539c2361f469c100540690e42e3fe0bf11457442394f/libpresign-1.2.0-cp38-abi3-macosx_14_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "66e1f1e340ea2574d1b5d16d4609627fc57e0936a11b7983ca654bc23022854f",
"md5": "4b5afc26d793ca5228cd2955f9bf0aa4",
"sha256": "b98a4e756700f6525a58d760981ae8dc700d7ce7b1226b05de1efac14aa676f9"
},
"downloads": -1,
"filename": "libpresign-1.2.0-cp38-abi3-macosx_14_0_x86_64.whl",
"has_sig": false,
"md5_digest": "4b5afc26d793ca5228cd2955f9bf0aa4",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 1991192,
"upload_time": "2025-07-27T04:16:03",
"upload_time_iso_8601": "2025-07-27T04:16:03.627133Z",
"url": "https://files.pythonhosted.org/packages/66/e1/f1e340ea2574d1b5d16d4609627fc57e0936a11b7983ca654bc23022854f/libpresign-1.2.0-cp38-abi3-macosx_14_0_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7caf1f84a73a69ecec6382bd0f4fc79848a18cdb2c4c3eb382260d53c5de6936",
"md5": "0ec845c3306cb70ac8ba50f9372fedc4",
"sha256": "cb6e40a472663ed354cd9037207bbad919b948b90fe878f049ef9fa23059d684"
},
"downloads": -1,
"filename": "libpresign-1.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "0ec845c3306cb70ac8ba50f9372fedc4",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 901587,
"upload_time": "2025-07-27T04:16:05",
"upload_time_iso_8601": "2025-07-27T04:16:05.876955Z",
"url": "https://files.pythonhosted.org/packages/7c/af/1f84a73a69ecec6382bd0f4fc79848a18cdb2c4c3eb382260d53c5de6936/libpresign-1.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "3dae670e1b1983a635e3f6271ad29e04826469c1291472e0915534f0f44f43a0",
"md5": "47d4a5fd45e41e24d32ecc54c5773a51",
"sha256": "bf11e7014e13f88a23307474ec178f305f93d0bc117b203de19acb9bb143e206"
},
"downloads": -1,
"filename": "libpresign-1.2.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl",
"has_sig": false,
"md5_digest": "47d4a5fd45e41e24d32ecc54c5773a51",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 890428,
"upload_time": "2025-07-27T04:16:07",
"upload_time_iso_8601": "2025-07-27T04:16:07.387370Z",
"url": "https://files.pythonhosted.org/packages/3d/ae/670e1b1983a635e3f6271ad29e04826469c1291472e0915534f0f44f43a0/libpresign-1.2.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "759de4d2e2c9d627f680d214b465f2500bd4104f0c1dec048703054079dc0184",
"md5": "9f5c2a78a3a94b347dc01370a61e7471",
"sha256": "a42bf6485b8719b7213ed1ba1b59489b512aca5cd4b378eb595816d620cd643f"
},
"downloads": -1,
"filename": "libpresign-1.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "9f5c2a78a3a94b347dc01370a61e7471",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 1136420,
"upload_time": "2025-07-27T04:16:08",
"upload_time_iso_8601": "2025-07-27T04:16:08.661034Z",
"url": "https://files.pythonhosted.org/packages/75/9d/e4d2e2c9d627f680d214b465f2500bd4104f0c1dec048703054079dc0184/libpresign-1.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "17939410f77dad164ccd0b1c3a6631321e0348a457a79dfaac48dd32c4b94f08",
"md5": "0651641de1f4c69f86330afe851bd1c9",
"sha256": "e75daa999490aff6301ad12bd09eba9755398175fee8cb6f016ae1b0d0337d4f"
},
"downloads": -1,
"filename": "libpresign-1.2.0-cp38-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "0651641de1f4c69f86330afe851bd1c9",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 1565735,
"upload_time": "2025-07-27T04:16:10",
"upload_time_iso_8601": "2025-07-27T04:16:10.217522Z",
"url": "https://files.pythonhosted.org/packages/17/93/9410f77dad164ccd0b1c3a6631321e0348a457a79dfaac48dd32c4b94f08/libpresign-1.2.0-cp38-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "8fcc45cf9ad3a64f5c080de2d5768594662cf685876dcb8f6913293ecd8a84e4",
"md5": "2a45d6c535af2b8fd8b99bbab261dff2",
"sha256": "1448eb8c9aea00b5b439b2b9c1ce48b88bded5abc216498cab0fb9a8edb2ca84"
},
"downloads": -1,
"filename": "libpresign-1.2.0.tar.gz",
"has_sig": false,
"md5_digest": "2a45d6c535af2b8fd8b99bbab261dff2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 61007,
"upload_time": "2025-07-27T04:16:11",
"upload_time_iso_8601": "2025-07-27T04:16:11.480281Z",
"url": "https://files.pythonhosted.org/packages/8f/cc/45cf9ad3a64f5c080de2d5768594662cf685876dcb8f6913293ecd8a84e4/libpresign-1.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-27 04:16:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "myk0la-b",
"github_project": "libpresign",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "libpresign"
}