Add hanzo-s3 package — S3-compatible storage client wrapper

Wraps minio Python client with Hanzo-branded aliases:
- hanzo_s3.Client / S3Client (→ minio.Minio)
- hanzo_s3.S3Error / S3Exception
- hanzo_s3.S3Admin / Admin (→ minio.MinioAdmin)
This commit is contained in:
2026-02-22 14:39:07 -08:00
parent 8dcfe497b3
commit 7f998bd17c
6 changed files with 213 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
# hanzo-s3
Hanzo S3 -- Python client for S3-compatible object storage.
Thin wrapper around the [minio](https://pypi.org/project/minio/) package that
re-exports its public API under the `hanzo_s3` namespace with Hanzo-flavoured
aliases.
## Install
```bash
pip install hanzo-s3
# or
uv add hanzo-s3
```
## Quick start
```python
from hanzo_s3 import S3Client
client = S3Client(
"s3.hanzo.space",
access_key="YOUR-ACCESS-KEY",
secret_key="YOUR-SECRET-KEY",
)
# List buckets
for bucket in client.list_buckets():
print(bucket.name, bucket.creation_date)
# Upload a file
client.fput_object("my-bucket", "remote/path.txt", "/local/path.txt")
# Download a file
client.fget_object("my-bucket", "remote/path.txt", "/local/download.txt")
```
## Admin operations
```python
from hanzo_s3.admin import S3Admin
admin = S3Admin("s3.hanzo.space", credentials=provider)
info = admin.info()
```
## API
| hanzo_s3 | minio |
|----------|-------|
| `S3Client` / `Client` | `Minio` |
| `S3Admin` / `Admin` | `MinioAdmin` |
| `S3Error` / `Error` | `S3Error` |
| `S3Exception` | `MinioException` |
| `S3AdminException` | `MinioAdminException` |
All original `minio` names are also re-exported for backward compatibility.
## Links
- Documentation: https://docs.hanzo.ai/s3
- Hanzo Space: https://hanzo.space
- Source (upstream): https://github.com/hanzos3/py-sdk
- Source (SDK): https://github.com/hanzoai/python-sdk
+60
View File
@@ -0,0 +1,60 @@
"""Hanzo S3 -- Python client for S3-compatible object storage.
Thin wrapper around the ``minio`` package that re-exports its public API
under the ``hanzo_s3`` namespace with Hanzo-flavoured aliases.
Usage::
from hanzo_s3 import S3Client
client = S3Client(
"s3.hanzo.space",
access_key="YOUR-ACCESS-KEY",
secret_key="YOUR-SECRET-KEY",
)
for bucket in client.list_buckets():
print(bucket.name, bucket.creation_date)
"""
from minio import Minio as S3Client
from minio import Minio # backward compat
from minio.error import (
InvalidResponseError,
S3Error,
ServerError,
)
from minio.datatypes import Object
from minio.helpers import ObjectWriteResult
# Convenience aliases
Client = S3Client
Error = S3Error
S3Exception = S3Error
ObjectWriteResponse = ObjectWriteResult
# Re-export useful sub-modules
from minio import credentials # noqa: F401
from minio import sse # noqa: F401
__version__ = "1.0.0"
__all__ = [
# Clients
"S3Client",
"Client",
"Minio",
# Errors
"S3Error",
"Error",
"S3Exception",
"InvalidResponseError",
"ServerError",
# Data types
"Object",
"ObjectWriteResult",
"ObjectWriteResponse",
# Sub-modules
"credentials",
"sse",
]
+27
View File
@@ -0,0 +1,27 @@
"""Hanzo S3 Admin -- re-export of MinioAdmin for administrative operations.
Usage::
from hanzo_s3.admin import S3Admin
admin = S3Admin(
"s3.hanzo.space",
credentials=provider,
)
info = admin.info()
"""
from minio.minioadmin import MinioAdmin as S3Admin
from minio.minioadmin import MinioAdmin # backward compat
from minio.error import MinioAdminException as S3AdminException
# Convenience alias
Admin = S3Admin
__all__ = [
"S3Admin",
"Admin",
"MinioAdmin",
"S3AdminException",
]
View File
+59
View File
@@ -0,0 +1,59 @@
[project]
name = "hanzo-s3"
version = "1.0.0"
description = "Hanzo S3 — Python client for S3-compatible object storage"
readme = "README.md"
license = { text = "Apache-2.0" }
requires-python = ">=3.9"
authors = [{ name = "Hanzo AI", email = "[email protected]" }]
keywords = ["s3", "minio", "hanzo", "object-storage", "cloud-storage"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Internet",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]
dependencies = [
"minio>=7.2.0",
]
[project.optional-dependencies]
dev = [
"pytest>=8.0.0",
"ruff>=0.5.0",
"mypy>=1.10.0",
]
[project.urls]
Homepage = "https://hanzo.space"
Documentation = "https://docs.hanzo.ai/s3"
Repository = "https://github.com/hanzos3/py-sdk"
Source = "https://github.com/hanzoai/python-sdk"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["hanzo_s3"]
[tool.ruff]
target-version = "py39"
line-length = 100
[tool.ruff.lint]
select = ["E", "W", "F", "I", "B", "C4", "UP"]
ignore = ["E501"]
[tool.mypy]
python_version = "3.9"
strict = true
+2
View File
@@ -71,6 +71,7 @@ members = [
"pkg/hanzo-memory",
"pkg/hanzo-network",
"pkg/hanzo-repl",
"pkg/hanzo-s3",
"pkg/hanzoai",
]
@@ -467,6 +468,7 @@ exclude = [
[tool.uv.workspace]
members = [
"pkg/hanzo-memory",
"pkg/hanzo-s3",
]
[tool.uv.sources]