Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python support for Dashboard #199

Closed
mvladic opened this issue Aug 19, 2022 · 0 comments
Closed

Python support for Dashboard #199

mvladic opened this issue Aug 19, 2022 · 0 comments

Comments

@mvladic
Copy link
Contributor

mvladic commented Aug 19, 2022

Components

PythonRun

Run python script from file or inline code. This component will also propagate - to dashboard flow - messages received from python script stdout, i.e. print statement.

Properties

Name Description
Script source option "Inline script", "Inline script as expression" or "Script file"
Script source Source code as string literal or string expression or file path, depending on "Script source option" property
Python path The path where to locate the "python" executable. Default is empty string which means to use "python3" or "python" on Windows (must be in PATH).

Outputs

Name Description
handle An integer value used as "handle" for this python script. To be used in PythonSendMessage and PythonEnd components to communicate/control python script.
message Message emitted from the python script using stdout stream, i.e. using print statement. Note: as stdout is buffered, use sys.stdout.flush to flush data collected so far, which will result to imeddiate propagation through this output into the flow. Example:
import sys
print(message)
sys.stdout.flush()

Note: This component will propagate through @seqout only after execution of the script is done.

PyhonSendMessage

Properties

Name Description
handle Value propagated from the handle output of PythonRun component.
message The message to be sent to the python script, which will receive it through stdin. Example:
for message in sys.stdin:
    process_message(message)

PythonEnd

Close stdin, so Python script can end as script can detect that stdin is closed. For example, the loop:

for message in sys.stdin:
    ...

Will break after stdin is closed.

Properties

Name Description
handle Value propagated from the handle output of PythonRun component.

Example

Example of using matplotlib module to draw charts inside dashboard flow:

python_charts

Source of this dashboard project is located here: https://github.com/eez-open/studio/tree/master/docs/tutorial/python

@mvladic mvladic added this to the M11 milestone Aug 19, 2022
@mvladic mvladic self-assigned this Aug 19, 2022
mvladic added a commit that referenced this issue Aug 19, 2022
mvladic added a commit that referenced this issue Aug 20, 2022
mvladic added a commit that referenced this issue Aug 20, 2022
mvladic added a commit that referenced this issue Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants