The m console command has been upgraded with a specialized REPLContext (the m object) to streamline interactive development and debugging.
The m Context Object
When starting the console with the --with-container flag, the framework injects an m object into the global namespace. This provides ergonomic access to hydrated application services without manual dependency resolution:
- Database Sessions (
m.session): Provides an async session factory context manager.async with m.session as s: # Use session s for database operations - Repositories (
m.repo): Retrieve the repository for any registered DocType by name or class. - Metadata (
m.metadata): Access the active SQLAlchemyMetaDataobject containing all discovered tables. - Configuration (
m.config): Access the fully hydratedRootConfigand application settings. - Jobs (
m.jobs): Inspect the globalJobRegistryfor discovered background tasks.
Features & Tooling
The Studio Cockpit integrates IPython and Rich to provide:
- Top-level await support for all asynchronous framework calls.
- Formatted inspection of system routes, job registrations, and schema metadata.
- Container Access: The full DI
containeris also available for low-level service resolution.
uv run m console --with-container