A plugin is an installed Python package that offers
components to sessions, so a session file can name a component by the plugin
it comes from, without any Python code:
plugin_name and plugin_id say which class to make, and every other key is
an argument to its constructor. Step through an entry becoming a presenter:
From a session file entry to a component
A session file names a component by its plugin and its id.
# session.yamlpresenters:motor_ctrl:plugin_name:mylabplugin_id:motorstep:2.0# session.yamlpresenters:motor_ctrl:plugin_name:mylabplugin_id:motorstep:2.0plugin_namethe manifest it namesplugin_id
plugin_name is the name of an entry point in the redsun.plugins group, which names the manifest inside the installed package.
# session.yamlpresenters:motor_ctrl:plugin_name:mylabplugin_id:motorstep:2.0# session.yamlpresenters:motor_ctrl:plugin_name:mylabplugin_id:motorstep:2.0# pyproject.toml of the mylab package[project.entry-points."redsun.plugins"]mylab="redsun.yaml"# pyproject.toml of the mylab package[project.entry-points."redsun.plugins"]mylab="redsun.yaml"plugin_namethe manifest it namesplugin_id
# session.yamlpresenters:motor_ctrl:plugin_name:mylabplugin_id:motorstep:2.0# session.yamlpresenters:motor_ctrl:plugin_name:mylabplugin_id:motorstep:2.0# pyproject.toml of the mylab package[project.entry-points."redsun.plugins"]mylab="redsun.yaml"# pyproject.toml of the mylab package[project.entry-points."redsun.plugins"]mylab="redsun.yaml"plugin_namethe manifest it namesplugin_id
The manifest maps each id to a class, written as module:ClassName.
# session.yamlpresenters:motor_ctrl:plugin_name:mylabplugin_id:motorstep:2.0# session.yamlpresenters:motor_ctrl:plugin_name:mylabplugin_id:motorstep:2.0# pyproject.toml of the mylab package[project.entry-points."redsun.plugins"]mylab="redsun.yaml"# pyproject.toml of the mylab package[project.entry-points."redsun.plugins"]mylab="redsun.yaml"# redsun.yaml inside the mylab packagepresenters:motor:mylab.presenters:MotorPresenter# redsun.yaml inside the mylab packagepresenters:motor:mylab.presenters:MotorPresenterplugin_namethe manifest it namesplugin_id
# session.yamlpresenters:motor_ctrl:plugin_name:mylabplugin_id:motorstep:2.0# session.yamlpresenters:motor_ctrl:plugin_name:mylabplugin_id:motorstep:2.0# pyproject.toml of the mylab package[project.entry-points."redsun.plugins"]mylab="redsun.yaml"# pyproject.toml of the mylab package[project.entry-points."redsun.plugins"]mylab="redsun.yaml"# redsun.yaml inside the mylab packagepresenters:motor:mylab.presenters:MotorPresenter# redsun.yaml inside the mylab packagepresenters:motor:mylab.presenters:MotorPresenterplugin_namethe manifest it namesplugin_id
The session imports the class only now, because a session names it, and passes every other key of the entry to the constructor.
# session.yamlpresenters:motor_ctrl:plugin_name:mylabplugin_id:motorstep:2.0# session.yamlpresenters:motor_ctrl:plugin_name:mylabplugin_id:motorstep:2.0# pyproject.toml of the mylab package[project.entry-points."redsun.plugins"]mylab="redsun.yaml"# pyproject.toml of the mylab package[project.entry-points."redsun.plugins"]mylab="redsun.yaml"# redsun.yaml inside the mylab packagepresenters:motor:mylab.presenters:MotorPresenter# redsun.yaml inside the mylab packagepresenters:motor:mylab.presenters:MotorPresenterfrommylab.presentersimport MotorPresenter
motor_ctrl = MotorPresenter(name="motor_ctrl", step=2.0)frommylab.presentersimportMotorPresentermotor_ctrl=MotorPresenter(name="motor_ctrl",step=2.0)plugin_namethe manifest it namesplugin_id
# session.yamlpresenters:motor_ctrl:plugin_name:mylabplugin_id:motorstep:2.0# session.yamlpresenters:motor_ctrl:plugin_name:mylabplugin_id:motorstep:2.0# pyproject.toml of the mylab package[project.entry-points."redsun.plugins"]mylab="redsun.yaml"# pyproject.toml of the mylab package[project.entry-points."redsun.plugins"]mylab="redsun.yaml"# redsun.yaml inside the mylab packagepresenters:motor:mylab.presenters:MotorPresenter# redsun.yaml inside the mylab packagepresenters:motor:mylab.presenters:MotorPresenterfrommylab.presentersimport MotorPresenter
motor_ctrl = MotorPresenter(name="motor_ctrl", step=2.0)frommylab.presentersimportMotorPresentermotor_ctrl=MotorPresenter(name="motor_ctrl",step=2.0)plugin_namethe manifest it namesplugin_id
A plugin lists what it offers in a manifest, a YAML
file in the package registered in the entry point group redsun.plugins
under the plugin_name a session file uses. Point at one of its five groups
to read what it holds:
The groups of a manifest
devicesid -> module:ClassNamepresentersid -> module:ClassNameviewsid -> module:ClassNameprovidersid -> module:ClassNameClasses that share values with every component without being components themselves. Each method a provider marks with provides shares a value. A provider's constructor is filled by type only, never from the keys of a session file.servicesid -> how to launch itEach entry gives the module to run as python -m, its arguments, the line it prints once it serves, and how long each stop step waits. A session file may override any of it.Classes that share values with every component without being components themselves. Each method a provider marks with provides shares a value. A provider's constructor is filled by type only, never from the keys of a session file.Each entry gives the module to run as python -m, its arguments, the line it prints once it serves, and how long each stop step waits. A session file may override any of it.
devicesid -> module:ClassNamepresentersid -> module:ClassNameviewsid -> module:ClassNameprovidersid -> module:ClassNameClasses that share values with every component without being components themselves. Each method a provider marks with provides shares a value. A provider's constructor is filled by type only, never from the keys of a session file.servicesid -> how to launch itEach entry gives the module to run as python -m, its arguments, the line it prints once it serves, and how long each stop step waits. A session file may override any of it.Classes that share values with every component without being components themselves. Each method a provider marks with provides shares a value. A provider's constructor is filled by type only, never from the keys of a session file.Each entry gives the module to run as python -m, its arguments, the line it prints once it serves, and how long each stop step waits. A session file may override any of it.
A class is imported only when a session names it, so a plugin's Qt views cost
nothing to a session that doesn't use them. A manifest that fails its schema
is left out whole; a session-file entry that can't be resolved is left out on
its own (ADR 14).
How to package components as a plugin writes
one, and Plugin manifest lists every key.
When a file entry has the same name as a declaration, it configures that
declaration and needs no plugin_name. An entry the class doesn't declare
names its plugin with both plugin_name and plugin_id, or it is left out.