Skip to main content

Mindtrace monorepo with modular packages

Project description

PyPI version License Downloads

Mindtrace

A modular Python framework for building ML infrastructure: microservices, artifact registries, job orchestration, hardware integrations, and more.

📖 Docs · 💡 Samples · 🤝 Contributing

📦 Installation

pip install mindtrace
# or
uv add mindtrace

Or install only what you need:

pip install mindtrace-services  # Microservices
pip install mindtrace-registry  # Artifact storage
pip install mindtrace-cluster   # Distributed workers

🚀 Getting Started

Config & Logging

from mindtrace.core import Mindtrace

class MyProcessor(Mindtrace):
    def run(self):
        # self.config and self.logger are provided automatically
        self.logger.error(f"Cache dir: {self.config.MINDTRACE_DIR_PATHS.ROOT}")

processor = MyProcessor()
processor.run()
# [2026-01-08 10:39:42] ERROR: MyProcessor: Cache dir: ~/.cache/mindtrace

Deploy a Microservice

from mindtrace.services.samples.echo_service import EchoService

# Launch service and get auto-generated client
client = EchoService.launch(port=8080)

result = client.echo(message="Hello, world!")
print(result.echoed)  # "Hello, world!"

client.shutdown()

Define your own service (must be in an importable module):

# mypackage/predictor.py
from pydantic import BaseModel
from mindtrace.services import Service
from mindtrace.core import TaskSchema

class PredictInput(BaseModel):
    text: str

class PredictOutput(BaseModel):
    label: str
    confidence: float

predict_schema = TaskSchema(
    name="predict",
    input_schema=PredictInput,
    output_schema=PredictOutput,
)

class PredictorService(Service):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.add_endpoint("predict", self.predict, schema=predict_schema)

    def predict(self, payload: PredictInput) -> PredictOutput:
        return PredictOutput(label="positive", confidence=0.95)

Save & Load Artifacts

from mindtrace.registry import Registry
import numpy as np

registry = Registry()

# Save anything: arrays, datasets, configs, dicts
embeddings = np.random.rand(100, 768).astype(np.float32)
registry.save("data:embeddings:v1", embeddings)

# Load it back (with automatic versioning)
loaded = registry.load("data:embeddings:v1")
print(f"Loaded: {loaded.shape}, {loaded.dtype}")
# Loaded: (100, 768), float32

Reactive State with Observables

from mindtrace.core import ObservableContext

@ObservableContext(vars=["status", "progress"])
class Pipeline:
    def __init__(self):
        self.status = "idle"
        self.progress = 0

def on_change(source, var, old, new):
    print(f"{var}: {old}{new}")

pipeline = Pipeline()
pipeline.subscribe(on_change, "context_updated")

pipeline.status = "running"   # prints: status: idle → running
pipeline.progress = 50        # prints: progress: 0 → 50

📚 Modules

Module Description
core Config, logging, observables, base classes
services Microservice framework with auto-generated clients
registry Versioned artifact storage (models, datasets, configs)
database Redis & MongoDB ODM with async support
cluster Distributed worker orchestration
jobs Job schemas and execution backends
hardware Camera, PLC, and sensor integrations
datalake Query and manage datasets, models, labels, and datums
models Model definitions, inference, and leaderboards
storage Cloud storage interfaces (GCS, S3)
automation Pipeline orchestration and Label Studio integration
ui UI components and visualization
apps End-user applications and demos

🏗️ Layered Architecture

Modules are organized into levels based on dependency direction. Each layer only depends on modules in lower levels.

Level Modules
1. Foundation core
2. Core Consumers jobs, registry, database, services, storage, ui
3. Infrastructure hardware, cluster, datalake, models
4. Automation automation
5. Applications apps

📖 Documentation

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

mindtrace-0.9.1.tar.gz (521.6 kB view details)

Uploaded Source

Built Distribution

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

mindtrace-0.9.1-py3-none-any.whl (667.6 kB view details)

Uploaded Python 3

File details

Details for the file mindtrace-0.9.1.tar.gz.

File metadata

  • Download URL: mindtrace-0.9.1.tar.gz
  • Upload date:
  • Size: 521.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mindtrace-0.9.1.tar.gz
Algorithm Hash digest
SHA256 4ad4d9f9e674ffc7bff109e3aeeb070280781dabc10d1c222cc861973ddf7012
MD5 71600c242a62f046a70b0d5b3b98e6de
BLAKE2b-256 a457cb922bbf2d50a89c0569e4a7474e297fa57b9dba6b2208c4774f34d51803

See more details on using hashes here.

File details

Details for the file mindtrace-0.9.1-py3-none-any.whl.

File metadata

  • Download URL: mindtrace-0.9.1-py3-none-any.whl
  • Upload date:
  • Size: 667.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mindtrace-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3ba5da9d35be61dd6b3bec9d211006123b3ee0a27269ca774d0992ee43080e3a
MD5 f0506d6dd0be9332709431611bb3ca1f
BLAKE2b-256 809457b3d556973eabdbbb7340bce0e6c17827594b6240b400d214e03da3d2a5

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