Repository navigation
Description
Context
datalab-plugin create only creates a layered installable project: about 17 files, with pyproject.toml, a src layout, core/workflow/adapters layers, tests and a release workflow. This suits plugins published in the plugin catalog, but it is far too much for DataLab users who are not software developers and simply want to add a processing to DataLab, although DataLab loads a plugin that is a single datalab_<name>.py file.
Proposed feature
datalab-plugin create creates a single-file plugin by default:
- the file
datalab_<name>.pyis written to the user plugin directory, the one DataLab scans, so that Plugins > Reload plugins loads it; - in interactive mode, only the plugin name and description are asked; the module name, plugin ID and destination are derived, and remain overridable with the existing options;
- the file contains a short NumPy function to edit, registered as a processing of the plugin and listed in its submenu of the Plugins menu (signal or image with
--object-kind; without theprocessingcapability, a menu action showing a message); - the
datalab_prefix is enforced and an existing file is never overwritten; - the file passes Ruff and can be shared and installed with Plugins > Configure plugins... > Install plugins.
The layered installable project is unchanged and created with the new --project option.
The single-file plugin is generated through a Python API of datalab/plugins/generator.py (rendering, writing, default folder), usable without the command line.
Relation with #377
#377 plans a Plugins > New plugin... wizard generating single-file plugins, through a reusable Python API of the existing generator. This issue provides that common foundation and keeps the project output of datalab-plugin create available, with --project. The wizard, its composable templates (analysis, file format, parameter sets, dialogs), the author and version fields, configuration updates, immediate loading and external editor remain in the scope of #377.
Out of scope
- The graphical entry point (Add a "New plugin" wizard to generate a ready-to-use plugin skeleton #377). The standalone version of DataLab does not provide the
datalab-plugincommand. - Changes to the layered project template.
Activity
feat(plugins): create single-file plugins with datalab-plugin create (#…
test(plugins): cover single-file plugins created by the generator (#413)
docs(plugins): document single-file plugin creation (#413)
feat(plugins): create single-file plugins with datalab-plugin create (#…
test(plugins): cover single-file plugins created by the generator (#413)
docs(plugins): document single-file plugin creation (#413)
refactor(plugins): register the generated NumPy function as it is (#413)