Skip to content

start migrating the helics webserver into pyHELICS - #172

Open
phlptp wants to merge 1 commit into
mainfrom
webserver
Open

start migrating the helics webserver into pyHELICS#172
phlptp wants to merge 1 commit into
mainfrom
webserver

Conversation

@phlptp

@phlptp phlptp commented Aug 11, 2026

Copy link
Copy Markdown
Member

add a webserver into pyHELICS.

The plan will be to get the base in here and some capabilities.
The next stages will add more capabilities and then migrate the existing web ui into the same structure. Probably over the course of 3 or more PR's. This will remove the flask UI and simplify the interface.

This will also add pydantic types for all (most) queries to make query operations cleaner in python.

@phlptp
phlptp requested a review from josephmckinsey August 11, 2026 15:21

@josephmckinsey josephmckinsey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we plan on having some sort of UI like helics-cli-extras currently has? If we do, then maybe we should replace the helics-cli-extras code instead, especially since I believe it now unreachable.

server implementation.
"""

from __future__ import annotations

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be needed given that we are now using a newer version of Python.

Comment thread helics/webserver/app.py
async def get_broker_state(name: str) -> QueryResponse:
"""Return the broker's current HELICS state using the standard query."""
try:
value = await run_in_threadpool(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why bother with the run_in_threadpool? I believe we can just make these sync functions:

https://fastapi.tiangolo.com/async/#in-a-hurry

If you are using a third party library that communicates with something (a database, an API, the file system, etc.) and doesn't have support for using await, (this is currently the case for most database libraries), then declare your path operation functions as normally, with just def, like:

And:

When you declare a path operation function with normal def instead of async def, it is run in an external threadpool that is then awaited, instead of being called directly (as it would block the server).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants