Hello everyone,
this email is for those of you who have already used the Calamares Python API
and wish to shape its future.
The Calamares Python API was first developed about two years ago, way before
many other essential features of Calamares had fallen into place. Over these
two years Calamares has transitioned from a very rough proof of concept to the
fairly complete system installer framework we have today, but the Python API
has seen very few changes.
Based on the past two years of use, including bug reports and conversations
with some developers and system integrators among you, I've identified a
number of issues.
* Python modules don't support translations. This is bad, because they cannot
output user-visible strings. This in turn blocks many improvements in progress
reporting and other things.
* The Calamares module format is somewhat unpythonic and arbitrary. Currently
the module developer has to implement a run() function, and this function
isn't enforced by an interface or any other Python-understandable mechanism.
On a related note, there is no way to pass instance arguments from the
Calamares side to the module (besides the libcalamares.job.configuration
mechanism).
* Since the entry point of the module is just an arbitrary global scope
function, Calamares injects a number of objects into the Python module's
environment before calling run(). These objects are then known to module
developers as libcalamares.job, libcalamares.utils and
libcalamares.globalstorage. While it makes sense for
libcalamares.globalstorage to live in the global scope, libcalamares.job is
something that would be much more meaningful as "self" in the Python module.
* Testing is harder than it should be. This is a consequence of the previous
two points. On a related note, does anyone use testmodule.py? Does it work? I
know that it doesn't work for some more complex modules, but have you found it
useful at least for simpler ones?
* Limited scope. The Calamares Python API technically only allows the module
developer to write a Python Job. Should this be extended to allow multi-job
modules? GUI modules? Control flow scripting (i.e. replacing the "sequence"
item from settings.conf)? You tell me.
* Lack of documentation. I don't have a good excuse for this.
I have a number of ideas on how to address these issues, but everything is up
for discussion at this point. This is a mid-long-term effort. Ideally, in the
Calamares Python API v2, creating a module shouldn't mean writing a run()
function and relying on globals, but inheriting from an abstract base class
Job or Module.
Please help me expand this list. Have you encountered design elements in the
Calamares Python API that bother you or simply wish to see improved?
PS. whenever I mention Python GUI modules, people say "PyQt". This is not what
PyQt is for. We need to use Python to script a C++/Qt5 application, i.e. an
embedding solution, not a solution to develop a Python application with a Qt5
GUI. While allegedly a dirty trick might exist to achieve the former, normally
PyQt deals with the latter.
Cheers,
--
Teo Mrnjavac
http://teom.org |
t...@kde.org