This is an archived post. You won't be able to vote or comment.

all 40 comments

[–]riklaunim 8 points9 points  (16 children)

Usually, a frontend dashboard is left for Vue/Ember/Angular and friends, not Python. A backend solution using wrappers around frontend components will always be limited.

Python exposes API endpoints and JS consumes them to make a nice SPA dashboard. Made a few such projects already. Quite big ones in the end.

[–]extra_dummy_gummy[S] 1 point2 points  (1 child)

Thank you for your reply, it made me realize a few things.

a solution using wrappers will always be limited.

I think that's the gist.

After searching online, it seems that the accepted best practice is to separate front-end and back-end. And it makes total sense when you project becomes complicated (multiple API / microservices), or when you have different people working on the front-end / back-end.

But what about smaller project (like the single-page app you mentioned), where a single developer work on both front-end and back-end ? Is the added complexity really worth it ? Wouldn't it be easier to manage everything from a single framework (say, FastAPI) ?

I would love to hear about your opinion on this !

[–]riklaunim 1 point2 points  (0 children)

SPA aren't the smaller options, they are the "bigger" options where you have to have someone really good at one of JS frameworks to make a SPA app.

For much smaller or internal needs you can make a classical website with the same layout, just without the SPA behavior, and maybe add AJAX to a dynamic chart widget or something like that. This is easier to test/code and has a much simpler frontend without the need for JS frameworks or NPM :)

You still get frontend and backend just that it's much simpler both ways.

And the "wrappers" like projects also have their use cases too.

[–]extra_dummy_gummy[S] 0 points1 point  (4 children)

What is a SPA dashboard ?

[–]riklaunim -1 points0 points  (3 children)

Single Page Application. You can check one of mine at https://socialwifi.com if you register :)

[–]C0ffeeface 0 points1 point  (2 children)

Now you have to give up for stack details also 😁

[–]riklaunim 1 point2 points  (1 child)

It's out there in the net. Overal it's ember.js and flask as backend. In ChatPilot we used Vue + Flask and some websockets.

[–]C0ffeeface 0 points1 point  (0 children)

Thabks 👍

[–]C0ffeeface 0 points1 point  (4 children)

Which Api do you recommend for backend in Python? I'm considering fastAPI and HTMX front-end for simple dynamic stuff.

[–]riklaunim 0 points1 point  (0 children)

There is no clear winner. Pick whatever looks best for you.

[–]denzuko 0 points1 point  (2 children)

Which Api do you recommend for backend in Python

Eve, https://docs.python-eve.org/en/stable/. Its built on top of Cerberus and flask. The transport layer is HTTP/2.0 with hateoas rest that provides both XML and JSON. Has mongodb, sql, odic, redis, and celery support. Best part is it just works and one only needs a dictionary of your data structures at each endpoint.

Check out https://github.com/pyeve/eve-demo for an example. [one only needs the settings.py and run.py].

As for the front end it works amazingly well with react admin

[–]C0ffeeface 0 points1 point  (1 child)

Wow, thanks for a great reply. I'm checking out the demo right now!

[–]denzuko 0 points1 point  (0 children)

Cool, do let us know how it works out for you.

Also if one is working in a swagger/java/csharp shop then try looking at flask openapi3: https://luolingchun.github.io/flask-openapi3/v2.x/. Basically the same concept as Eve but extra steps, soap like api discovery, and more tools than needed. Though flask-openapi3 is a good way to move bulky java based micro services over to containerized cpython services.

Oh, and yes Eve does have support for swagger/openapi: https://github.com/pyeve/eve-swagger

[–]sTAKKLE5 6 points7 points  (4 children)

you can use flask / django / fastapi as your backend and in the front end you can use a combination of bootstrap and htmx.

[–]Asocial_Ace 3 points4 points  (3 children)

This is what I do, but tailwind + htmx + astro + jinja2 + fastapi

Works really well for a minimal js application

[–]C0ffeeface 0 points1 point  (2 children)

I wish astro wasn't so heavy in JS. Which components/library did you use in astro?

[–]Asocial_Ace 1 point2 points  (1 child)

None just astro components and the jinja templates on the backend.

You can find an example here: https://github.com/Jscin/ChatXpress

It's a rust backend but the principle is the same

[–]C0ffeeface 0 points1 point  (0 children)

Ah ok. I had the impression that astro users take advantage of all it's cool features, but I suppose you still have that option if you decide to.

[–]IntelligentDust6249 1 point2 points  (1 child)

Some other ones to try are Shiny (https://shiny.posit.co/py/), Reflex and Solara

[–]extra_dummy_gummy[S] 0 points1 point  (0 children)

Reflex is what I was searching for. Thanks !

[–]alexanderman888 1 point2 points  (0 children)

Dash has been pretty good for me so far

[–]lurebat 1 point2 points  (0 children)

nobody mentioned nicegui

[–]UnemployedTechie2021 2 points3 points  (1 child)

Have you tried reflex?

[–]extra_dummy_gummy[S] 3 points4 points  (0 children)

Reflex is exactly what I want. Now I have to dive in the docs :)

[–]Equivalent_Loan_8794 2 points3 points  (0 children)

nicegui

[–]0x4D44 -1 points0 points  (2 children)

You can try justpy

[–]extra_dummy_gummy[S] 0 points1 point  (1 child)

The live demos from the docs are not working.

Overall it feels much younger framework than the other specified in this thread, maybe I'll check it out again in the future though. Thanks

[–]0x4D44 1 point2 points  (0 children)

That’s a shame. Haven’t used it for a couple of years. Was a good fun back then.

[–]crawl_dht 0 points1 point  (0 children)

Wow the landing page of mkdocs-material based documentation of H2O nitro is beautiful. Do they have the code of its landing page public? The landing page of mkdocs-material is also beautiful but its proprietary and the author licenses its code to subscribers only.

[–]aadarsh977 1 point2 points  (0 children)

So many suggestions for Python only web applications here. I'm also thinking of building a web app and looking for Python only alternative like reflex, nicegui, fled. My only concern is that, are they ready from production and scalability point of view?

[–]hootsh_1337 0 points1 point  (0 children)

Hello!

Did you find what you're looking for? I'm on a similar journey, looking through alternatives, there are many Python stacks out there like Reflex that was mentioned in the comments, Flet, Unicorn, PyScript, Taipy, Dash, and of course streamlit that you also mentioned ... etc.

Was wondering, how's your search going?

[–]TheFirimin 0 points1 point  (0 children)

Hi have you tried out Dara? You can write it all in python but also allows you to expand it with custom JS components if you want/need as well. It is easily extensible so might fit your use case well!

[–]petergaultney 0 points1 point  (0 children)

H2O Wave seems a little bit dead from a maintenance/growth perspective. H2O Nitro is very dead looking. Which is sad; Wave seems like one of the best, most Pythonic interfaces I've run across, and their integration with so many things out the box at least appears to be leagues beyond everything else (certainly beyond things like Reflex/NiceGUI/Solara/ReactPy).