Skip to main content

A lightweight S3-compatible object storage server for local development and learning.

Project description

tiny-object-storage logo

🪣 tiny-object-storage

A lightweight, S3-compatible object storage server for local development, testing, and learning.

Python FastAPI Ruff Mypy Strict Security: Bandit Pre-commit Coverage: 91% License: MIT


📖 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 .env files.

🚀 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):

  1. Command-line arguments
  2. Environment variables
  3. .env file

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 the endpoint_url to http://127.0.0.1:9000 with 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


Download files

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

Source Distribution

tiny_object_storage-0.1.1.tar.gz (27.7 kB view details)

Uploaded Source

Built Distribution

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

tiny_object_storage-0.1.1-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

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

Hashes for tiny_object_storage-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bffdba94485b842526e1c49ccf7b22e3d364e238b9c392dfe3bf6f4afea3ab87
MD5 f1cdd8e6c7aa40811ce17aa30b72cf50
BLAKE2b-256 92058194bad77c5f38cdbafc62e048e9e7a69509b155b339336661915ce6de3f

See more details on using hashes here.

File details

Details for the file tiny_object_storage-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tiny_object_storage-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1e6098473139cd7eff4d846b5c125708db820e55d32f2d16e7e0e398892ffca1
MD5 a4192deb3b4a68327618d2278d4d51cd
BLAKE2b-256 80f0803d5599b5cd0f7f4a2cc97e5c1cb88cec6e7943d511f6cdf67ca87fe776

See more details on using hashes here.

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