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

implement a draft JSON API with FastAPI #36

Merged
merged 7 commits into from
Jul 12, 2024
Merged

implement a draft JSON API with FastAPI #36

merged 7 commits into from
Jul 12, 2024

Conversation

rouk1
Copy link
Contributor

@rouk1 rouk1 commented Jul 10, 2024

A new webapp is now available in the src/mandr/dashboard package.

In src/mandr/dashboard__init__.py a helper function is available to launch a dashboard from the notebook.
It will start an async task that serves HTTP requests in the background.

from mandr.dashboard import launch_dashboard

launch_dashboard()

You may also run the webapp in it's dedicated interpreter by running: python -m uvicorn mandr.dashboard.webapp:app --reload --host 0.0.0.0 --timeout-graceful-shutdown 0

Two JSON endpoints have been implemented:

This first step opens the possibility to write a static JS webapp that consumes this API.

It also raises some questions ❓ :

  • Is the naive implementation of a JSONInfoManderEncoder powerful enough ?
  • I add to customize the root path for test purpose. How do we let the user change is root path for the dashboard and the python API ? (environment variables ? bootstrap function ? CLI ?)

@rouk1 rouk1 linked an issue Jul 10, 2024 that may be closed by this pull request
@rouk1 rouk1 changed the title impelment a draft JSON API with FastAPI implement a draft JSON API with FastAPI Jul 11, 2024
@rouk1 rouk1 marked this pull request as ready for review July 11, 2024 10:05
Copy link
Member

@tuscland tuscland left a comment

Choose a reason for hiding this comment

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

Good minimalistic starting point.

src/mandr/infomander.py Outdated Show resolved Hide resolved
@tuscland tuscland merged commit 1011751 into main Jul 12, 2024
1 check passed
@tuscland tuscland deleted the 21-fastapi branch July 12, 2024 11:45
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.

Flask vs ...
4 participants