Repository navigation
Load plugin packages from their folder without installing them - #412
Merged
Merged
Conversation
…ng them (#411) A plugin package found in a plugin directory was only registered if its package root defined the plugin class. Layered packages, as created by `datalab-plugin create`, keep their root free of Qt and define the class in `adapters/desktop.py`, which only the entry point of an installed distribution named. A fresh clone added as plugin directory was silently ignored, while a checkout holding `.egg-info` from an earlier install was loaded. - After importing a `datalab_*` package, discovery also imports its `adapters.desktop` module when it exists. Errors in that module are reported with its name and file, without blocking other plugins. - A module is reloaded at most once per discovery pass, whether it is found by an entry point, by naming convention or both. - A configured plugin directory whose `src` subfolder holds `datalab_*` modules or packages is searched together with that subfolder, so that users may add the project folder itself. - Generated projects explain how to try the plugin in DataLab without installing it. Assisted-by: Claude Opus 5.5
Plugin projects without any distribution metadata, configured either as project folder or as `src` folder, are discovered with their stable ID. Single-file plugins and packages without `adapters/desktop.py` behave as before; a failing Desktop module is reported without blocking other plugins; hot reload executes the edited module once; a package also declared by an entry point is registered once with both sources; and only `src` folders holding `datalab_*` modules are searched. A project freshly created by `datalab-plugin create` is loaded from its folder without being installed. Assisted-by: Claude Opus 5.5
The plugin documentation now presents the two forms DataLab loads from a plugin directory, a single `datalab_*.py` file or a `datalab_*` folder, and explains that a plugin project folder may be added directly. Release notes 1.4 (Bug Fixes, "Plugins") with their French translation. Assisted-by: Claude Opus 5.5
PierreRaybaut
added a commit
to DataLab-Platform/datalab-camera-characterization
that referenced
this pull request
Oct 21, 2026
DataLab 1.4 loads a plugin package from its folder, without installing it (DataLab-Platform/DataLab#411, DataLab-Platform/DataLab#412): the contribution guide now explains how to try the plugin by adding the project folder to DataLab's plugin directories. Assisted-by: Claude Opus 5.5
PierreRaybaut
added a commit
to DataLab-Platform/datalab-pulse-characterization
that referenced
this pull request
Oct 21, 2026
DataLab 1.4 loads a plugin package from its folder, without installing it (DataLab-Platform/DataLab#411, DataLab-Platform/DataLab#412): the contribution guide now explains how to try the plugin by adding the project folder to DataLab's plugin directories. Assisted-by: Claude Opus 5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #411.
Problem
Plugins organized as a package (a
datalab_<name>/folder whose plugin class lives inadapters/desktop.py, as created bydatalab-plugin createand used by the Camera, Pulse, Synchrotron and TANGO plugins) were silently ignored when their folder was added to the plugin directories. Folder discovery only registered classes defined while importing the package root, which layered plugins keep free of Qt; the Desktop adapter was only reachable through the entry point of an installed distribution. A checkout holding.egg-infofrom an earlier installation was loaded, a fresh clone was not. Users also had to declare the project'ssrcsubfolder rather than the project folder.Fix
The existing naming convention is extended, without any new declaration:
datalab_*package, discovery also imports itsadapters.desktopmodule when it exists. Its import errors are reported with the module name and file, without blocking the other plugins.srcsubfolder holdsdatalab_*modules or packages is searched together with that subfolder. The search paths are computed once, fordiscover_plugins()anddiscover_v020_plugins(), and added tosys.pathas before, so compute and preview processes inherit them in the same way.datalab-plugin creategenerates README, contribution and architecture texts that first explain how to try the plugin by adding the project folder, installation being kept for tests and publishing.Behaviour change
datalab_*package on the search path now has itsadapters/desktop.pymodule imported at discovery, if it has one. Packages without it (e.g.datalab_kernel,datalab_capsule) are unaffected.datalab_x.adapters.desktop) and file, instead of the package name.sys.path.Tests
plugins_registry_unit_test.py, on temporary projects without any distribution metadata: discovery from the project folder or fromsrc(stable ID, source, file path); single-file plugins and packages withoutadapters/desktop.pyunchanged; failing Desktop module reported without blocking another plugin; hot reload executing the edited module once; a package also declared by an entry point registered once with both sources and a single reload per module; search paths including onlysrcfolders that holddatalab_*modules, includingDATALAB_PLUGINSdirectories.plugin_generator_unit_test.py: a project freshly created bydatalab-plugin createis loaded from its folder without being installed.src: none is discovered ondevelop; all four are discovered once with this branch, also after a reload.datalab/tests/backbone/pluginsanddatalab/tests/features/plugins(226 passed), run with aPYTHONPATHwithout plugin folders.developand against this branch, with identical results: Camera 158 passed; Pulse 113 passed; Synchrotron 94 passed and 1 failure on both (test_import_spec_scans); TANGO 33 passed and 2 failures on both, which rely on instrument window features not ondevelop.datalab/plugins/base.py).Documentation and translations
doc/features/advanced/plugins.rst: the two forms a plugin may take (single file or folder), the project folder accepted as plugin directory, and how to try a generated project without installing it.-W.Out of scope
datalab-plugin create, better suited to non-developers.adapters/desktop.py, which still requires a restart, as with entry points.Follow-up: the development instructions of the four plugin repositories will mention loading the plugin from its folder.