SnoozeML Python SDK Documentation#
Welcome to the official Python SDK documentation for SnoozeML, the bare-metal, scale-to-zero deep learning and machine learning inference daemon written in Rust.
Note
Looking for server deployment, models.toml configuration, or Rust architecture guides?
Visit the ← SnoozeML Core Service Documentation.
Key Capabilities#
Dual-Transport Client (
SnoozeClient&AsyncSnoozeClient): Communicate with SnoozeML over HTTP REST (JSON) or high-throughput native gRPC (raw little-endianFP32byte buffers) with automatic NumPy and PyTorch tensor serialization, dataset batch chunking (infer_dataset()), and transient 503 retry resilience.Model Lifecycle & Scale-to-Zero Control (
ModelsManager): List registered models, inspect live states (idle,loading,ready,busy), preload weights (load), pin critical models in memory (pin/unpin), explicitly evict models (evict/unload), and block until ready (wait_for_ready()).One-Step Deployment & ML Converters (
snoozeml.converters): Deploy trained models directly from Python memory or export fittedscikit-learnestimators/pipelines (export_sklearn()), PyTorchnn.Modulenetworks (export_torch()), andXGBoostmodels (export_xgboost()) directly into SnoozeML-ready artifacts.Authentication, RBAC & JWT Minting (
snoozeml.auth): Mint and verify RFC 7519 HMAC JSON Web Tokens (HS256,HS384,HS512) matching SnoozeML’s 3-tier RBAC hierarchy (ReadOnly,Inference,Admin).Event Streaming & Real-Time Ingestion (
snoozeml.streams): Serialize streaming inference envelopes (StreamInferRequest,StreamInferResponse), test withMockStreamClient, and connect to live Redis Streams (RedisStreamClient).Programmatic Config & Local Test Runner (
snoozeml.config): Buildmodels.tomldeclaratively withSnoozeConfig, scaffold process-isolated custom Python workers (scaffold_worker()), and run an ephemeral daemon in Python withSnoozeDaemon.Telemetry & Prometheus Parsing (
snoozeml.metrics): Scrape and parse exposition counters fromGET /metricswithparse_prometheus_metrics()for monitoring success rates, latencies, and scale-to-zero memory events.Structured Logging & Credential Sanitization (
snoozeml.logging): Built-inRedactingFilterandStructuredFormatterguarantee that API keys and JWT Bearer tokens are never leaked in logs orrepr()strings.
User Guide
API Reference
- API Reference
snoozeml.client— Synchronous & Asynchronous Clientssnoozeml.models— Model Metadata & Lifecycle Managementsnoozeml.inference— Tensor Serialization & Responsessnoozeml.auth— Authentication, RBAC & JWT Mintingsnoozeml.streams— Event Streaming Envelopes & Clientssnoozeml.config— Configuration, Worker Scaffolding & Daemon Runnersnoozeml.metrics— Prometheus Metrics Parsing & Telemetrysnoozeml.converters— ONNX & XGBoost Model Exporterssnoozeml.exceptions— Exception Hierarchy & Error Mapperssnoozeml.logging— Structured Logging & Secret Redaction