TinySDK
Shared service clients for the TinyAI microservices platform — MongoDB, MinIO, Temporal workers, and structured logging with a consistent interface.
Installation
pip install tinysdk
Quick Start
from tinysdk import TinyDBService, TinyStorageService, TinyWorkerService, TinyWorkflowService, get_temporal_client, TinyLogger
# MongoDB
db = TinyDBService()
doc_id = db.create("users", {"name": "John", "email": "john@example.com"})
users = db.read("users", filter={"name": "John"})
count = db.update("users", {"name": "John"}, {"$set": {"active": True}})
count = db.delete("users", {"name": "John"})
exists = db.exists("users", {"email": "john@example.com"})
ids = db.create_multiple("users", [{"name": "Alice"}, {"name": "Bob"}])
db.close()
# MinIO / S3
storage = TinyStorageService()
storage.upload_file("my-bucket", "file.txt", buffer) # file_size auto-detected
storage.upload_file("my-bucket", "file.txt", buffer, 1024) # or pass explicitly
file_buffer, name = storage.download_file("my-bucket", "file.txt")
storage.upload_folder("my-bucket", "/local/folder")
storage.download_folder("my-bucket", "folder-name", "/local/dest")
storage.close()
# Temporal (activity/workflow worker for a task queue)
from temporalio import activity
@activity.defn
async def my_activity(payload: dict) -> None:
...
worker = TinyWorkerService() # logger optional; defaults to TinyLogger()
await worker.start(task_queue="my-queue", activities=[my_activity]) # or workflows=[...]
# Or just a connected client
client = await get_temporal_client()
# Temporal (read-only workflow queries) — async, call from an async function
workflow_svc = TinyWorkflowService()
status = await workflow_svc.get_status("order-123") # status, timings, task queue
history = await workflow_svc.get_history_summary("order-123") # condensed event history
summary = await workflow_svc.get_summary("order-123") # status + history in one call
# Logger
logger = TinyLogger()
logger.log("something happened", level="INFO", context={"key": "value"})
logger.start_heartbeat() # emits periodic HEARTBEAT events
logger.stop_heartbeat() # clean shutdown
doc_logger = logger.for_document("doc-id-123")
doc_logger.log("processing started")
Configuration
All clients read credentials from environment variables.
| Service | Variable | Example |
|---|---|---|
| MongoDB | DB_LINK |
mongodb://mongo:27017 |
| MongoDB | DB_NAME |
tinyDatabase |
| MinIO | MINIO_ENDPOINT |
minio:9000 |
| MinIO | MINIO_ACCESSKEY |
minioadmin |
| MinIO | MINIO_SECRETKEY |
minioadmin |
| Temporal | TEMPORAL_ADDRESS |
temporal-server:7233 |
| Temporal | TEMPORAL_NAMESPACE |
default |
| Logger | SERVICE_NAME |
my-service |
| Logger | CLUSTER |
prod |
| Logger | NAMESPACE |
default |
| Logger | LOG_LEVEL |
INFO |
| Logger | HEARTBEAT_INTERVAL |
30 |
Credentials can also be passed directly as constructor arguments.
License
MIT
Metadata
Release files for tinysdk 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tinysdk-0.8.0.tar.gz | 68.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tinysdk-0.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 117.9 kB
Release files / tinysdk-0.8.0.tar.gz
| Download URL | tinysdk-0.8.0.tar.gz |
|---|---|
| Size | 68.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f334d17981fe3fbf8491b0c7645f779515048e6c51728700268015360673f82
|
|
BLAKE2b-256 checksum How to use checksums |
b8d3c122536b826de859c9c547d712d60a86a1ac60ab0b503418e084c877a77c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.
Transparency logRelease files / tinysdk-0.8.0-py3-none-any.whl
| Download URL | tinysdk-0.8.0-py3-none-any.whl |
|---|---|
| Size | 49.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4d64dce5caf4c6022ccb45ee6958cae147e7989a91f652517ef8706c4b28fe1b
|
|
BLAKE2b-256 checksum How to use checksums |
d8fa75fbe324819bb3937ed2d25988235972d8e733d446141aef6417edab9d8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.
Transparency log