FastAPI deployment
I am trying to replace some apps at my company with some marimo apps. I am looking for some solid comprehensive examples of how to launch marimo with fast api that is a little more in depth than the ~20 lines of code in the docs. Does anyone know if I can find this somewhere?
15 Replies
Not sure if we have a complete example yet. But @Myles Scolnick should be able to help!
hey @nellyg what exactly is missing that you want more in depth on?
There are docs here: https://docs.marimo.io/guides/deploying/programmatically.html#fastapi-example
There is a working example here: https://github.com/marimo-team/marimo/blob/ms/export-markdown/marimo/_smoke_tests/custom_server/my_server.py#L9
I'm hesitant to add more in-depth fastapi knowledge when their docs are really good and in-depth.
assuming you are looking for authN, authZ, sessions, etc, I would reference fastapi's docs: https://fastapi.tiangolo.com/
Oh this working example is exactly what I was looking for. THanks!
@Myles Scolnick any suggestions on a good way to give a multi page marimo application a sidebar to navigate between the different pages?
how custom is your sidebar? if you could, would you want to build it in marimo or do you want to write your own frontend for that? (e.g. login/logout, special styling, etc)
I would prefer to build it in Marimo. Really all I want is it to be a list of the pages in my app you can navigate to. Something just like:
Button for Homepage
Button for Dashboard 1
Button for Dashboard 2
All I am looking for is a really simple way to navigate from any app page to any other app page.
gotcha - we plan to make this much easier in the future with some page layouts and routing components.
but you could do this today with some cell composition. you can create a notebook called
common.py
which is just an mo.hstack
and mo.md
inside with links (we plan to build navigation-items as a component)
then in each app, you can import:
i would maybe use vstack
and have your navigation at the top just since we don't have good sidebar layouting, but eventually we will have mo.page
or something like that
to import a cell from another notebook, you need to name your cell, which can be found in the cell action menuOkay awesome I will start here and see what I come up with. Thanks for a push in the right direction!
Any idea how long some of these built in components might be? If they are coming pretty fast I may hold off.
I think really the routing components would be the most helpful. I can get by with creating my own ad hoc top navigation widget.
Maybe a week? Also if there are any particular non-obvious requirements like query params or nested paths, let me know
Oh just a week? Ill just sit tight then. That is fantastic. You guys are so awesome and fast
@nellyg - just released
mo.nav_menu
in the 0.5.1
- its barebones but should unblock youAmazing. I will take a look at this tomorrow!
Couldn't wait till tomorrow. I got back on to mess with it a bit tonight. This is exactly what I needed to unblock me.
awesome to hear
@Myles Scolnick follow up on this. I just rebuilt a whole panel application into marimo in about 24 hours and it is so much better now and easier to use. Marimo is now my go to notebook and data application framework. I love it
That’s amazing
You’re gonna hate me though… I’m just adding mo.sidebar
Although should actually be a good addition and will fit in nicely
Nothing at all to hate about that! Im sure I’ll add it to my application within 30 minutes of the release!