3.6. Updating your instrument plugin for PyMoDAQ 4

3.6.1. What’s new in PyMoDAQ 4

The main modification in PyMoDAQ 4 concerning the instrument plugins is related to the hierarchy of the modules in the source code, see What’s new in PyMoDAQ 4.

3.6.2. What should be modified

3.6.2.1. Imports

Mostly the only things to be modified are imports that should reflect the new package layout. This includes import in obvious files, for instance imports in the DAQ_Move_template plugin, see Fig. 3.87.

../_images/import_new.png

Fig. 3.87 New imports

Some imports are a bit more insidious. Indeed, often there is no specific code in the __init__.py files we see everywhere in our modules. But in the plugins, there is a bit of initialization code, see for instance Fig. 3.88 so make sure you changed the imports in all these __init__.py.

../_images/hidden_import_new.png

Fig. 3.88 New imports hidden in the __init__.py files

And that’s it, they should be working now!

Note

If your instrument plugin has been written from a recent version of the template (say early 2023) then the only __init__.py file to be modified is the one in figure Fig. 3.88 but otherwise you’ll need to modify most of them…sorry :-(

3.6.2.2. Data emission

But to make things very neat, your detector instrument plugins should emit no more lists of DataFromPlugins objects but a DataToExport emitted using new signals, see Emission of data.

3.6.2.3. Requirements

And for the final bit, make sure to add a dependency to pymodaq >= 4.0.0 in the package requirements, see Fig. 3.89. With this, the Plugin Manager will know your plugin is compatible and will propose it to installation.

../_images/require.png

Fig. 3.89 Requirements necessary so that the Plugin Manager know your plugin is compatible with PyMoDAQ 4.