Closed nelimee closed 1 month ago
Just as a reminder:
We already had a Flask server in place, which was initially set up by @smburdick, and the front end has some unused functionality.
The file server root is in /web/main.py
, also deployed to gcloud.
I don't have any strong preference between flask
and fastapi
, and most of the concepts are very similar.
CORS
As an alternative, there is also GraphQL
which can be used to query data in a different way, I don't think it's useful for our purposes though.
I have no personal preference on that. As I already said multiple times, I am not competent for web-related development task (and I try to stay as far away as possible from anything related to web-technologies).
My choice of pydantic
+ fastapi
was based on the easy of use of pydantic
and the ultra-fast integration of fastapi
once you have pydantic
models in place. There is really no smart thinking that happened on my side, an I will adopt whatever is judged to be the best solution by others.
Let's consider this PR as a playground to start exploring the integration between the frontend and backend, and see what is required from both sides. At any time (if possible, early), if the choice of pydantic
+ fastapi
seems worse than another library, please tell me, or change the framework directly.
I'm very much in favor of FastAPI because I have worked with it before. I think pydantic
also works with flask
and django
.
Could you move this to a repo branch instead of the fork? This would make it easier for others to check out / work on it.
I will resolve all the conflicts and push to a repository branch in the afternoon.
Replaced by #240
This is a draft PR trying to implement a REST server on the backend side.
This is the initial implementation that will allow a link between the frontend and the backend.
Currently, the idea is the following: all the QEC-related state is stored in the backend and the frontend is making requests through the provided REST API to 1. query the current QEC state or 2. change it. Here, "QEC-related state" means that:
Because we want to avoid a communication at each user inputs, the frontend may store partial state.
Note that everything I wrote above and the code from this PR is a proposal, I am very much open to any other idea if it turns out to be easier to use.
To use the code from that PR and experiment with the REST server, follow the instructions:
tqec
package to get the new dependenciesor install the added dependencies directly
Related issues:
170: if the decision to pursue in the direction explained above is taken, the backend will be responsible for that, and already implement the feature.
169: the backend would become responsible for the generation of the file, the frontend will still need to provide a way to save the file to the user.
61: nicely handled by using
pydantic
and implementing methods to convert from/to the definedpydantic.BaseModel
.38: the main related issue, this PR try to fix #38.
18: this PR introduces the possibility to export to Stim files, and so should fix that issue.