G
YouTube TikTok Games
Skip to content

Create single-file plugins with datalab-plugin create #413

Closed

Description

@PierreRaybaut

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>.py is 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 the processing capability, 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions