jupyterlab / lumino

Lumino is a library for building interactive web applications
https://lumino.readthedocs.io/
Other
598 stars 127 forks source link

Reuse the plugin system without depending on the Lumino Widgets #586

Closed jtpio closed 1 month ago

jtpio commented 1 year ago

Problem

The Lumino plugin system is simple and powerful. It could also be used for other purposes that don't necessarily provide UI elements to the interface.

However the Lumino Application currently requires a T extends Widget = Widget as the generic type for a shell:

https://github.com/jupyterlab/lumino/blob/613dc9df19652316a8e32c704d4937fcd43983cc/packages/application/src/index.ts#L138

Proposed Solution

Make it possible to use the plugin and dependency injection system without a shell.

Additional context

This was discussed with @echarles during JupyterCon 2023.

For reference JupyterLite uses a Lumino application without a shell by providing never as the generic type: https://github.com/jupyterlite/jupyterlite/blob/f98c5c0f90f25466aea6beeb4f2bd2ce8549aa68/packages/server/src/app.ts#L17

export class JupyterLiteServer extends Application<never>
jtpio commented 1 year ago

@echarles if you have more examples or use cases feel free to add them here, thanks!

echarles commented 1 year ago

Thx @jtpio for logging this. I can share for now https://github.com/datalayer-examples/jupyterlab-extensions-example/blob/main/test/lumino-inject.spec.ts which aims to showcase generic dependency injection based on Lumino. I will feed more there and document what could be done if we would abstract away from Widget.

fcollonval commented 1 year ago

We could provide an raw ABCApplication than encapsulated only the plugin logic without command registry, context menu and shell. Or simply template without restrictions the context menu and the shell.