View code on Github

v0.7.0: Professional plugins

Eggs, by Landon Martin

Version v0.7.0 of FlexMeasures (see changelog) puts emphasis on plugins that are ready for actual productive use. Professional packaging, testing & style! 

FlexMeasures plugins are a hugely important concept. Writing data integrations for,  and services on top of FlexMeasures ― that's done with plugins.  To support getting started with them in the right way, we now provide a CookieCutter template to get you started in 30 seconds. It also includes a few Blueprint examples and best practices like tests.

Python packages

Plugins can be complete Python packages now. Python code which can be installed on your system, e.g. with the pip package manager. You could even upload it to the Pypi index :)

So what is professional about packages? It is more straightforward with a package to add code hygiene, version management and dependencies. You can imagine how much better you'll manage when your plugin can depend on a specific FlexMeasures version and other plugins can depend on yours.

We envision that a top-level service plugin lists FlexMeasures, as well as one or two data integration plugins. You could install that plugin, and immediately run FlexMeasures and your service runs,

If you use the packaging option, FlexMeasures still wants you to define the Blueprints for UI, CLI or API functionality at the top-level of the plugin. (If your plugin is just a folder with files, it still should be in the __init__.py file).

To hit the ground running with the packaging approach,  try the CookieCutter template we mention above, where we give you a full package structure.

This work was done in Pull Request 182.

Test automation support

If the plugin is used for serious stuff, its code also should be tested in automated fashion.

Some tests test an integration of the behavior on top of an actual running app. That's of course a FlexMeasures app. So the plugin tests need to tell FlexMeasures to load the plugin. This is now possible easily.

This work was done in Pull Request 220.

Style your plugin

We believe that FlexMeasures shines as a backend, with a modern one-page JavaScript/HTML frontend for user-facing apps built on top of it.  That's why we provide a full API.

However, a real quick way to provide a UI is to use the Jinja2 templating capabilities of  Flask (which FlexMeasures is built on). We do that in pilots when no frontend dev is available.

Now we made it easier to impose your style on this UI. It's now possible to add your custom CSS spreadsheet and also show your own logo for the top left corner. It made our ESCo customer happy to see their colors, font and logo in our pilot service's UI when we met their client :)

This work was done in Pull Request 184 and Pull Request 185.