The current proposal behind library extensions (what I previously called plugins) is very minimal: register them as extra modules to search routines in.
E.g. to create a Qibocal library extension with a routine ciao(), just have a module
# my_extension.py
from qibocal import Routine
ciao = Routine(...)
and register in your calibration script
from qibocal import Executor
import my_extension
_ = Executor("my_exec", extensions=[my_extension])
from my_exec import ciao
out = ciao(...)
And, internally, the executor will just search the register libraries (including the built-in one) to find the name requested, during __getattribute__ look-up.
The following is superseded by #869 and the proposal above.
protocols/ are a fundamental part of Qibocal, but at the same time they are just separately developed components, that should adhere to a given specification.
For this reason, Qibocal could be simply extended even with protocols written outside of it and registered at runtime via a given API.
To treat them on the same ground, we could even distribute protocols together with Qibocal, but in a separate package (and automatically registering them, e.g. telling the CLI to import that package by default, unless an explicit option is given, or something like that).
The current proposal behind library extensions (what I previously called plugins) is very minimal: register them as extra modules to search routines in.
E.g. to create a Qibocal library extension with a routine
ciao()
, just have a moduleand register in your calibration script
And, internally, the executor will just search the register libraries (including the built-in one) to find the name requested, during
__getattribute__
look-up.The following is superseded by #869 and the proposal above.
Original proposal
Originally posted by @AleCandido in https://github.com/qiboteam/qibocal/pull/406#pullrequestreview-1608320306
protocols/
are a fundamental part of Qibocal, but at the same time they are just separately developed components, that should adhere to a given specification.For this reason, Qibocal could be simply extended even with protocols written outside of it and registered at runtime via a given API.
To treat them on the same ground, we could even distribute protocols together with Qibocal, but in a separate package (and automatically registering them, e.g. telling the CLI to import that package by default, unless an explicit option is given, or something like that).