You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the function block library is located within the resources folder, where the dinasore function blocks must be manually copied or cloned into. This makes the dinasore source code and the function block library heavily intertwined and it is harder to develop them independently from each other.
if you want to add your own library you have to mess around with the search path
However the hardest issues are naming conflics:
Consider the following custom function block library located within resources/custom_lib:
In this case the core folder contains algorithms and helper functions used in FB1.py and FB2.py. The functionblocks import elements of the core library as follows:
from core.analysis.my_module import something
When the function blocks are tested from the tests folder everything works nicely using pytest. However, importing the functionblocks from dinasore fails because it tries to import the modules of the custom library from its core folder.
Workarounds I tried:
add my custom library to the search path -> now the modules of dinasore are not found because it searches in my library for them
renaming the library folder core to someting else -> works but is very ugly in my opinion
A possible solution:
Why not install function block libraries like regular python libraries. The standard library and custom function block libraries are then installed. A configuration file or command line arguments specify which function block libraries are loaded when starting dinasore. When a function block is instantiated the xml function block definition and classes are read from the installed package folder.
Benefits
function block library can be developed independent from dinasore installation
a simple uv add git+https://github.com/function_block_lib --branch main installs the function block library
simpler version control because the requirements of dinasore and the functionblock libraries are separated
Final words
This requires considerable rework of dinasores function block import mechanism. So before I invest a lot of time into this:
What do you think of my suggestion? Do you know of other user (uses dinasore with default library) and library developer (works on new functionblocks) friendly ways to tackle this problem?
BR,
David
The text was updated successfully, but these errors were encountered:
Hello,
First of all thanks for your great work!
Whats the problem?
Currently the function block library is located within the resources folder, where the dinasore function blocks must be manually copied or cloned into. This makes the dinasore source code and the function block library heavily intertwined and it is harder to develop them independently from each other.
if you want to add your own library you have to mess around with the search path
However the hardest issues are naming conflics:
Consider the following custom function block library located within
resources/custom_lib
:In this case the core folder contains algorithms and helper functions used in
FB1.py
andFB2.py
. The functionblocks import elements of the core library as follows:When the function blocks are tested from the
tests
folder everything works nicely using pytest. However, importing the functionblocks from dinasore fails because it tries to import the modules of the custom library from its core folder.Workarounds I tried:
core
to someting else -> works but is very ugly in my opinionA possible solution:
Why not install function block libraries like regular python libraries. The standard library and custom function block libraries are then installed. A configuration file or command line arguments specify which function block libraries are loaded when starting dinasore. When a function block is instantiated the xml function block definition and classes are read from the installed package folder.
Benefits
uv add git+https://github.com/function_block_lib --branch main
installs the function block libraryFinal words
This requires considerable rework of dinasores function block import mechanism. So before I invest a lot of time into this:
What do you think of my suggestion? Do you know of other user (uses dinasore with default library) and library developer (works on new functionblocks) friendly ways to tackle this problem?
BR,
David
The text was updated successfully, but these errors were encountered: