Special / Generated Code Parts¶
This page explains
- what parts of the component code are generated by hetida designer
- which of them can / should be edited
main func / COMPONENT_INFO¶
The part between
and which includes theCOMPONENT_INFO and main function signature is generated by hetida designer and should not be touched. It will be recreated for example if the input / output config changes.
Exception: async def main
There is one exception: you can change the def main to async def main. This is recommended for component adapter components that are io bound and use an async library to fetch / send data. See async main functions.
Module docstring <— documentation¶
When pressing the broom button in the toolbar, and no module docstring is present, the current component documentation (viewable and editable via documentation button in toolbar) will be set as module docstring. If a docstring is already present it will not be changed.
Therefore you might want to delete current module docstring before pressing this button in order to update the docstring from the documentation.
Note, that when uploading/importing a component from its code into a hetida designer installation, the documentation is loaded from the module docstring.
TEST_WIRING_FROM_PY_FILE_IMPORT and RELEASE_WIRING¶
When pressing the broom button it will add or update two global variables at the end of the component module:
- TEST_WIRING_FROM_PY_FILE_IMPORT will be set to the current test wiring. When uploading/importing a component from its code, the test wiring will be read from this.
- RELEASE_WIRING will be added. This is the test wiring at time of release. When uploading/importing a component from its code, the release wiring will be read from this.
Faithful Code Representation¶
With up-to-date module docstring containing the documentation at the beginning, COMPONENT_INFO and main function and both wiring global variables, the component module is a faithful representation of the component. I.e. everything is contained in the code and can be extracted from it. This is important when importing/uploading a component into a hetida designer installation from its code file.