API Reference
Protocols
Section titled “Protocols”AdminContributorProtocol
Section titled “AdminContributorProtocol”Contract for packages that contribute admin dashboard surfaces.
Any lexigram extension package can implement this protocol and register
it via the lexigram.admin.contributors entry point. The admin
dashboard discovers contributors at boot and assembles their widgets,
pages, navigation, and actions into the unified admin UI.
Unique contributor identifier (e.g. ‘cache’, ‘events’, ‘ai’).
Human-readable contributor name for the admin UI.
Navigation group this contributor belongs to.
Lucide icon name for the contributor.
Contributor names that must boot before this contributor.
Ordering priority within its group (lower = first).
Semantic version of this contributor (e.g. ‘1.2.3’).
Python package name that provides this contributor (e.g. ‘lexigram-cache’).
Stable unique identifier used for lookup and RBAC keying (equals name).
Permissions a user must hold to execute any action on this contributor.
Return resource classes managed by this contributor.
Return widget definitions for the main dashboard.
Return navigation entries for the admin sidebar.
Return full management page definitions.
Return settings panel definitions.
Return health check definitions to surface in the dashboard.
Return framework-level actions.
Return route specifications for the admin router.
Called when the admin dashboard boots.
Called when the admin dashboard shuts down.
Render a named widget to a typed WidgetViewModel.
| Parameter | Type | Description |
|---|---|---|
| `widget_name` | str | Name of the widget to render. |
| `params` | WidgetParams | Typed, validated widget parameters. |
| `resolver` | ContainerResolverProtocol | None | Optional DI resolver for lazy dependency injection. |
| Type | Description |
|---|---|
| Result[WidgetViewModel, AdminError] | Ok(WidgetViewModel) with structured content in ``content`` on success. Err(WidgetNotFoundError) when the widget name is unknown. Err(AdminError) for other expected domain failures. Infrastructure exceptions propagate (not caught here). |
Run a health check and return a structured health-check payload.
| Parameter | Type | Description |
|---|---|---|
| `check_name` | str | Name of the health check to run (matches check ID from ``get_health_definitions``). |
| Type | Description |
|---|---|
| Result[HealthCheckPayload, AdminError] | ``Ok(HealthCheckPayload)`` describing the check result on success — the host renders it as HTML. ``Err(HealthCheckNotFoundError)`` if *check_name* is not served by this contributor. ``Err(AdminError)`` if the check fails for any other reason. |
AdminContributorRegistryProtocol
Section titled “AdminContributorRegistryProtocol”Registry that collects and manages admin contributors.
Register a contributor.
Get contributor by name.
Get all registered contributors, ordered by priority.
Get contributors in a specific group.
AdminDashboardProtocol
Section titled “AdminDashboardProtocol”Protocol for the assembled admin dashboard service.
Collect widgets from all contributors.
Collect navigation from all contributors.
Aggregate health from all contributors.
Execute a framework-level action from a contributor.
| Parameter | Type | Description |
|---|---|---|
| `contributor_id` | str | Identifier of the target contributor. |
| `action_name` | str | Name of the action to execute. |
| `params` | dict[str, object] | Parameters forwarded to the action handler. |
| `user_permissions` | frozenset[str] | Permissions held by the requesting user. |
| Type | Description |
|---|---|
| object | Whatever the action handler returns. |
Classes
Section titled “Classes”AdminModule
Section titled “AdminModule”Lexigram admin panel module.
Call configure to register the admin panel with its bundle provider and contributor system.
Usage
from lexigram.admin.config import AdminConfig
app.add_modules([ AdminModule.configure( config=AdminConfig(title="My Admin"), resources=[UserResource, ProductResource], ),])from lexigram.admin.config import AdminConfig
app.add_modules([ AdminModule.configure( config=AdminConfig(title="My Admin"), resources=[UserResource, ProductResource], ),])Create an AdminModule with explicit configuration.
| Parameter | Type | Description |
|---|---|---|
| `config` | Any | None | AdminConfig or None for defaults. |
| `auth_provider` | Any | None | Optional AuthProviderProtocol for auth integration. |
| `resources` | list[type] | None | List of Resource classes to register. |
| `controllers` | list[type] | None | List of controller classes to register. **kwargs: Forwarded to AdminProvider. |
| Type | Description |
|---|---|
| DynamicModule | A DynamicModule descriptor. |
Return a no-op AdminModule for testing.
| Type | Description |
|---|---|
| DynamicModule | A DynamicModule with default admin configuration. |
AdminPanelStartedHook
Section titled “AdminPanelStartedHook”Payload fired after the admin panel has finished its startup sequence.
AdminPanelStoppedHook
Section titled “AdminPanelStoppedHook”Payload fired after an orderly admin panel shutdown completes.
AdminProvider
Section titled “AdminProvider”Orchestrates admin sub-providers for the full admin panel.
Sub-providers are focused helper classes (not Provider subclasses). This follows the EventsProvider/AuthBundleProvider pattern.
Config is accepted only in init and never mutated after construction. Sub-providers are instantiated in register() — not in init — so that no DI work happens before the container is ready.
Return current admin config.
Create provider from typed config.
Register admin and all sub-providers.
Sub-providers are instantiated here (not in init) so that no DI resolution or heavyweight initialisation happens before the container lifecycle has started. No resolution is performed in this method — only bindings are registered.
Build and mount the admin panel onto a Starlette application.
Called by the web provider during route setup, after the Starlette app is created and all providers have booted.
| Parameter | Type | Description |
|---|---|---|
| `app` | Any | The Starlette application to mount the admin panel on. |
| `container` | ContainerResolverProtocol | The DI resolver for resolving controller dependencies. |
Boot all sub-providers in order.
Shut down sub-providers in reverse order.
Aggregate health from all sub-providers.
AdminResourceAccessedHook
Section titled “AdminResourceAccessedHook”Payload fired when an admin resource page is accessed.
Attributes:
resource_name: Registered name of the admin resource (e.g. "User").
action: CRUD action being performed (e.g. "list", "change").
user_id: Identifier of the admin user performing the action.
AdminStatus
Section titled “AdminStatus”Status of admin operations.
AdminUser
Section titled “AdminUser”Admin user representation.
BaseAdminContributor
Section titled “BaseAdminContributor”Convenience base class for admin contributors.
Provides no-op defaults for all AdminContributorProtocol methods.
Subclasses override only the methods they need.
Stable identifier for RBAC lookup — equals name.
Return an empty sequence by default.
Return an empty sequence by default.
Return an empty list by default.
Return an empty list by default.
Return an empty list by default.
Return an empty list by default.
Return an empty list by default.
Return an empty list by default.
No-op boot hook.
No-op shutdown hook.
Return a not-found error by default — override in subclasses.
Default: this contributor does not serve the requested health check.
| Parameter | Type | Description |
|---|---|---|
| `check_name` | str | Name of the health check requested. |
| Type | Description |
|---|---|
| Result[HealthCheckPayload, AdminError] | ``Err(HealthCheckNotFoundError)`` — contributor does not provide this check. |
ContributorRegistry
Section titled “ContributorRegistry”Registry that collects and manages admin contributors.
Follows the Registry pattern (AGENTS.md §6.3): empty __init__,
with_defaults() classmethod for pre-populated instances.
Create a registry (no built-in contributors by default).
Register a contributor, keyed by its name.
Get a contributor by name, or None.
Get all contributors sorted by priority (lower = first).
Get contributors in a specific group, sorted by priority.
CoreAdminContributor
Section titled “CoreAdminContributor”Built-in contributor providing core dashboard surfaces.
Provides the framework health overview widget, the main dashboard navigation entry, and the system-wide health check surface.
Return core dashboard widgets: health overview, recent activity, and metrics.
Return core navigation: Dashboard link.
Return core health definitions.
Render core widgets.
| Parameter | Type | Description |
|---|---|---|
| `widget_name` | str | Name of the widget to render. |
| `params` | WidgetParams | Widget parameters. |
| Type | Description |
|---|---|
| Result[WidgetViewModel, AdminError] | Result containing a WidgetViewModel with structured ``content``, or WidgetNotFoundError if the widget is not found. |
Render health check for admin core.
| Parameter | Type | Description |
|---|---|---|
| `check_name` | str | Name of the health check. |
| Type | Description |
|---|---|
| Result[HealthCheckPayload, AdminError] | Ok(HealthCheckPayload) with the core status, or Err(AdminError) when the check is unknown. |
ErrorCode
Section titled “ErrorCode”Machine-readable error codes for admin operations.
Exceptions
Section titled “Exceptions”AdminError
Section titled “AdminError”Base exception for all admin errors.
AdminValidationError
Section titled “AdminValidationError”Raised when validation fails.
ConflictError
Section titled “ConflictError”Raised when a resource conflict occurs.
DataError
Section titled “DataError”Raised when a data source or database error occurs in admin.
NotFoundError
Section titled “NotFoundError”Raised when a resource is not found.
NotificationError
Section titled “NotificationError”Raised when a notification fails to send.
PermissionDeniedError
Section titled “PermissionDeniedError”Raised when permission is denied.