mdvtools.server_extension#

Classes#

MDVProjectServerExtension

A protocol for server extensions that can be used with MDV projects.

MDVServerOptions

Configuration options for the MDV server.

Module Contents#

class mdvtools.server_extension.MDVProjectServerExtension[source]#

Bases: Protocol

A protocol for server extensions that can be used with MDV projects.

We might use this for blocks of other functionality that aren’t totally core mdv functionality, integrating other services/libraries/functionality. We might also re-arrange so that some things like the add_anndata routes are moved into an extension.

Maybe rather than pass a Flask app to server.py, we pass something representing MDV app configuration, including a Flask app, these extensions, auth provider etc… Flask becomes an implementation detail that we abstract away somewhat.

register_routes(project: mdvtools.mdvproject.MDVProject, project_bp: mdvtools.project_router.ProjectBlueprintProtocol)[source]#

Assign any extra /project/<project_id>/<path> routes to the blueprint for this project instance.

mutate_state_json(state_json: dict, project: mdvtools.mdvproject.MDVProject, app: flask.Flask)[source]#

Mutate the state.json before returning it as a request response, e.g. to add information about the extension.

Don’t really want to pass flask app here, doing so for now to allow access to config.

class mdvtools.server_extension.MDVServerOptions[source]#

Configuration options for the MDV server.

open_browser: bool = True[source]#
port: int = 5050[source]#
websocket: bool = True[source]#
use_reloader: bool = False[source]#
app: flask.Flask | None = None[source]#
backend_db: bool = False[source]#
extensions: List[MDVProjectServerExtension] = [][source]#