A lightweight S3-compatible object storage server for local development and learning.
Project description
🪣 tiny-object-storage
A lightweight, S3-compatible object storage server for local development, testing, and learning.
📖 Overview
tiny-object-storage is a fast, minimalistic object storage server written in Python using FastAPI. It acts as a local emulator that mimics the core functionality of Amazon S3, allowing developers to test S3-integrated applications locally without relying on external cloud services or heavy containers like MinIO.
✨ Features
- S3 Compatibility: Supports core S3 XML responses and basic HTTP methods (
GET,PUT,HEAD,DELETE). - Bucket Management: Create, list, and delete buckets.
- Object Operations: Upload, download, metadata lookup, listing (
list-type=2), and deletion. - Persistent Storage: Filesystem-based persistence with dedicated metadata and data separation.
- Developer Experience: Interactive Swagger UI and OpenAPI schema built-in.
- Enterprise Code Quality: Enforced static typing (Mypy strict), linting (Ruff), and security analysis (Bandit).
- Flexible Configuration: Configurable via CLI arguments, environment variables, or
.envfiles.
🚀 Quick Start
Installation
From PyPI (Recommended)
Install the package globally or in a virtual environment using pip:
pip install tiny-object-storage
From Source (Development) Clone the repository and install it in a virtual environment:
git clone https://github.com/EhsanBitaraf/tiny-object-storage.git
cd tiny-object-storage
python -m venv .venv
# On Linux/macOS:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activate
# Install the application and development dependencies
pip install -e ".[dev]"
Running the Server
Start the server using the built-in CLI:
tos-server
Or run it directly with uvicorn:
uvicorn tiny_object_storage.main:app --reload --host 0.0.0.0 --port 9000
⚙️ Configuration
The server reads configuration in the following priority (highest to lowest):
- Command-line arguments
- Environment variables
.envfile
CLI Usage Examples
# View all available options
tos-server --help
# Load from a specific .env file
tos-server --env-file .env.custom
# Override host and port
tos-server --host 127.0.0.1 --port 9001 --reload
# Customize storage directories and log level
tos-server --data-dir ./storage_data --log-dir ./logs --log-level debug
🔌 S3 Client Compatibility
tiny-object-storage acts as a local emulator and has been successfully verified against the following official SDKs and tools:
- MinIO Python SDK
- Boto3 (AWS SDK for Python)
- AWS CLI
Note: For official SDKs to interact locally, configure them with
secure=False(or--no-verify-ssl) and point theendpoint_urltohttp://127.0.0.1:9000with any dummy credentials.
Sample scripts for verifying SDK interactions are included in the repository root (e.g., test_boto3_sdk.py, test_minio_sdk.py).
🛠 Testing & Code Quality
The project includes an extensive test suite built with pytest achieving 100% test pass rate over 63 edge-case scenarios.
Running Tests
pytest
(Optionally, use pytest --cov=src to generate a coverage report).
Code Quality Tools
We use pre-commit to maintain our code quality. The suite includes:
- Ruff: For ultra-fast linting and code formatting.
- Mypy: For strict static type checking.
- Bandit: For security vulnerability scanning.
To run checks manually on all files:
pre-commit run --all-files
🌐 API Endpoints (Examples)
After starting the server, visit /docs for the interactive Swagger UI. Below are standard curl examples targeting common S3 actions:
Health check
curl http://127.0.0.1:9000/health
Create a bucket
curl -X PUT http://127.0.0.1:9000/photos
Upload an object
curl -X PUT --data-binary @"cat.jpg" http://127.0.0.1:9000/photos/cat.jpg
Download an object
curl http://127.0.0.1:9000/photos/cat.jpg --output cat.jpg
List objects (S3 Format)
curl "http://127.0.0.1:9000/photos?list-type=2"
Debug endpoints (JSON format)
curl http://127.0.0.1:9000/_debug/buckets
curl http://127.0.0.1:9000/_debug/photos
🤝 Contributing
Contributions are welcome and highly appreciated! Please review our Contributing Guidelines to get started. By participating in this project, you agree to abide by the Code of Conduct.
🔒 Security
For instructions on reporting security vulnerabilities, please refer to our Security Policy.
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
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 tiny_object_storage-0.1.1.tar.gz.
File metadata
- Download URL: tiny_object_storage-0.1.1.tar.gz
- Upload date:
- Size: 27.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bffdba94485b842526e1c49ccf7b22e3d364e238b9c392dfe3bf6f4afea3ab87
|
|
| MD5 |
f1cdd8e6c7aa40811ce17aa30b72cf50
|
|
| BLAKE2b-256 |
92058194bad77c5f38cdbafc62e048e9e7a69509b155b339336661915ce6de3f
|
File details
Details for the file tiny_object_storage-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tiny_object_storage-0.1.1-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e6098473139cd7eff4d846b5c125708db820e55d32f2d16e7e0e398892ffca1
|
|
| MD5 |
a4192deb3b4a68327618d2278d4d51cd
|
|
| BLAKE2b-256 |
80f0803d5599b5cd0f7f4a2cc97e5c1cb88cec6e7943d511f6cdf67ca87fe776
|