Back to Projects
flask-silo - Session-Isolated State for Flask APIs
a small python library for flask apis that gives every client its own isolated state, so one user’s data never bleeds into someone else’s when the api is juggling a bunch of people at once. it came out of real data pipelines at work where multiple people upload files, run background jobs and pull reports at the same time.
each client gets its own state through an x-session-id header, stored in memory or in redis if you run multiple workers. idle sessions get cleaned up automatically, expired ones get a proper 410 instead of a silent empty session, and there’s a background task runner with progress and logs.
live on pypi, pip install flask-silo.
Architecture
Client AX-Session-ID
Client BX-Session-ID
Client CX-Session-ID
Flask app · Silo extension
before_requestread the SID, load or create state
after_requestsave state, set X-Session-ID
SessionStorenamespaces per session
FileStoreper-session files
BackgroundTaskprogress-tracked jobs
Cleanup daemonevery 60s, expired sessions get a 410, running tasks kept
In-memorydefault
Redismultiple workers
Customimplement SiloStorage
