Skip to main content

mic-datastore

Briques de persistance & messaging du framework MIC. Dépend de mic-core (DAG platform → data → core — jamais l'inverse).

Modules

Module Rôle
mic.datastorage Backends de données : SqlDataStorage, DocumentDataStorage (MongoDB), GraphDataStorage (Neo4j), variantes in-memory
mic.cache Cache (in-memory / Redis) + RevokeBlacklist (révocation JWT)
mic.shard Sélection de shard / session factory
mic.locking Verrous distribués (in-memory / Redis)
mic.outbox Pattern transactional outbox + dispatcher
mic.eventbus Pub/sub synchrone (in-memory / Redis Streams)
mic.queue Event bus async durable (NATS JetStream / Kafka)
mic.idempotency Store d'idempotence
mic.response_cache Middleware de cache de réponses HTTP
mic.read_models Read-models (compteurs, leaderboards, timelines, HLL)
mic.realtime WebSocket realtime (backend Redis Streams)

Namespace PEP 420 (pas de mic/__init__.py).

mic.realtime — WebSocket depuis un navigateur

Un navigateur ne peut pas poser d'en-tête Authorization sur l'upgrade WebSocket, et un jeton en query string finit dans les journaux d'accès : le client passe son jeton en sous-protocole et propose en plus un sous-protocole applicatif, que le serveur doit renvoyer dans l'accept (sinon le navigateur ferme la connexion).

new WebSocket(url, ["app.v1", `bearer.${jwt}`]);
from mic.realtime import (
    AsyncWebSocketAuthenticator, WebSocketAuthError, extract_bearer_token,
    make_websocket_endpoint,
)

class OidcAuthenticator(AsyncWebSocketAuthenticator):  # vérif. async (JWKS)
    async def authenticate(self, scope):
        token = extract_bearer_token(scope)
        if token is None or not await verify_with_jwks(token):
            raise WebSocketAuthError("unauthorized")  # → close 4401

endpoint = make_websocket_endpoint(
    room=room,
    authenticator=OidcAuthenticator(),  # ou ServiceAuthWebSocketAuthenticator (sync)
    subprotocol="app.v1",  # renvoyé seulement si proposé ; jamais `bearer.<jwt>`
)

RedisStreamsBackend(client=redis, maxlen=1_000) plafonne chaque stream de room via XADD MAXLEN ~ (défaut DEFAULT_MAXLEN = 1000, trim approximatif ; maxlen=None = pas de plafond).

Installation

pip install "mic-datastore[postgres,redis]"

Extras

Extra Tire
sql sqlmodel + alembic
postgres / mysql / oracle sql + driver (psycopg / PyMySQL / oracledb)
mongo (alias document) pymongo
neo4j (alias graph) neo4j
redis redis
nats / kafka nats-py / aiokafka
messaging nats + kafka
ws redis + mic-core[auth]

Versionnage

Brique volatile — reste en 0.x plus longtemps que mic-core. Contraindre avec >=0.1,<1. Release : make release-pkg PKG=data VERSION=x.y.z → tag data-vX.Y.Z (cf. ../../RELEASING.md).

Metadata

Release files for mic-datastore 0.1.23

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mic-datastore 0.1.23
File Size Uploaded Provenance
mic_datastore-0.1.23.tar.gz 103.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mic-datastore 0.1.23
File Interpreter ABI Platform
mic_datastore-0.1.23-py3-none-any.whl Python 3 none any Details

Total release size: 250.3 kB

Release files / mic_datastore-0.1.23.tar.gz

Download URL mic_datastore-0.1.23.tar.gz
Size 103.9 kB
Tags Source
SHA-256 checksum
How to use checksums
45d7fbe8ea421098d819fd3bfafe79332aee8929111e81832c1b921b5ff99dda
BLAKE2b-256 checksum
How to use checksums
f645f5962a7ad200c0b2dd4ca167e1eed066daefa31abc3b46b42a4de5483476
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / mic_datastore-0.1.23-py3-none-any.whl

Download URL mic_datastore-0.1.23-py3-none-any.whl
Size 146.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0c9fb34fb3b83c85d251e5e8bf8f98097959cabfaaa086f3d63a833631a66ff9
BLAKE2b-256 checksum
How to use checksums
a03bd4831b7532443c944e99ec1f2ec0ea1e71002819653959ffccada7690c91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for mic-datastore 0.1.23

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page