Problem
Creating StateManager() at module level, the natural place for it, fails when the backend is set in the app's lifespan (the documented place):
BackendNotFoundError: No instance set for proxy BackendProxy
The message does not say what to do (call BackendProxy.set(...) first, or create the manager after the backend is set).
Proposal
- Resolve the backend lazily on first use rather than in
__init__, so module-level construction works.
- Make the
BackendNotFoundError message actionable: name BackendProxy.set(...) and point to the setup docs.
Problem
Creating
StateManager()at module level, the natural place for it, fails when the backend is set in the app's lifespan (the documented place):The message does not say what to do (call
BackendProxy.set(...)first, or create the manager after the backend is set).Proposal
__init__, so module-level construction works.BackendNotFoundErrormessage actionable: nameBackendProxy.set(...)and point to the setup docs.