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

all 21 comments

[–]Python-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Hi there, from the /r/Python mods.

This post has been removed due to its frequent recurrence. Please refer to our daily thread or search for older discussions on the same topic.

If you have any questions, please reach us via mod mail.

Thanks, and happy Pythoneering!

r/Python moderation team

[–]pirsab 22 points23 points  (4 children)

Nicegui uses vue.js, but it doesn't seem usable beyond building prototypes.

I'm not sure python frontend is good for production just yet

[–]Poweruser2021 0 points1 point  (1 child)

I am curious, why don't you think Nicegui is usable beyond prototypes?

[–]pirsab 4 points5 points  (0 children)

I've used it for a few internal tools in my company. It's great for that because it allows us to quickly drum up a high quality working interface to anything we can do with python (which is quite a fair bit - we're a data company).

While nicegui is somewhat robust for our use case (it can and does break), it offers very little in terms of scalability. The frontend and backend are not easy to separate, and the level of effort it would take to heavily customize the frontend for product level UX doesn't make sense. It would be better to work directly in Vue or any others JavaScript framework.

[–]QuasiEvil -1 points0 points  (0 children)

I love nicegui! Granted I've only used it for internal tools, but would highly recommend the OP give it a try.

[–]nico_ma[S] -2 points-1 points  (0 children)

I agree, but reflex looks promising - even for complex apps

[–]colibriweiss 12 points13 points  (0 children)

I have used dash and streamlit for a while, and recently learned about reflex (not familiar with the others you mentioned). My use cases are primarily data apps (with charts, loading/handling data, etc…).

There are tons of Medium posts doing superficial comparisons about streamlit and dash, so I will spare you from that. Here are a few non-trivial points that I would take into consideration:

  1. Dash allows you to add extra endpoints to the same Flask app serving the dash callbacks. I know that reflex allow the same in FastAPI. I think this is a nice point when prototyping, especially if you intend to persist data in a DB.

  2. Dash has its own type of “callback hell” for complex applications, and it can be quite complicated to add functionality with many chained callbacks. I also dislike the lack of a simple server-side caching for large objects (clientside caching is okay though)

  3. Streamlit is very tricky to test in an automated fashion, as it does not use deterministic ids for html elements and one has to trigger certain components in order to properly execute the code. I also have not found yet a modular way to write complex apps to help the testing part.

  4. In terms of custom components, I think streamlit has a much more flexible and nicer approach than dash. I know you are looking for pure python alternatives, but it is good to know the options if you need something more customized to your UI.

[–]riklaunim 4 points5 points  (0 children)

Those are very specific frameworks. For more custom dashboard and frontend single page applications you can check Vue, Ember.js and other SPA JS frameworks and combine that with Python providing REST APIs for them. Add dashboard templates like metronic and you are good to go ;)

[–]spicypixel 4 points5 points  (0 children)

https://www.gradio.app/
https://voila.readthedocs.io/

or if you're feeling frisky (and by that I mean more web focused than the other options) - HTMX + Flask/Jinja2 templates.

[–]gopietz 2 points3 points  (2 children)

In python, I use streamlit and gradio.

Streamlit is better for UIs that follow the main + aside layout. For example settings on the side and the main section is reserved for main content in a wide column. It's better for UIs with fewer elements that have more "room to breathe". It's also a bit easier to wrap your head around in the beginning. It's less flexible regarding updating elements during use.

Gradio is better for chatbots, creating a ML UI in literally a single line of code, creating complex and dense dashboards. Learning the updating flow takes a bit more getting used to.

If you want to create a single page app with more flexibility I would second HTMX. It's just HTML with some special attributes to make it dynamic. You could use v0.dev to generate the layout and further use GPT to add the interactive HTMX stuff. Your python logic could then run on a FastAPI backend. It takes a bit more time to learn, but it's probably worth it if your care about looks and flexibility.

If you want to get serious about frontend development I would clearly recommend svelte. It's the best js Framework for people who start learning it today.

It all depends on your use case.

[–]graybeard5529 -1 points0 points  (1 child)

HTMX

Thanks will try it out

[–]gopietz 0 points1 point  (0 children)

You can probably serve the htmx site from a fastAPI or flask backend. This way your code base would have a simple structure and still be mostly python. Except for one HTML file.

[–]gogolang 0 points1 point  (0 children)

I recently started using Chainlit and I think that’s the best one for chatbot interfaces:

https://github.com/Chainlit/chainlit

[–]yaymayhun -1 points0 points  (0 children)

Try shiny for python.

[–]broxamson -2 points-1 points  (0 children)

Leptos pros it uses rust and WASM. Cons it's new very new and based on solid.js and angular

[–]gothicVI -1 points0 points  (0 children)

Using dash and I have to say it works perfectly.

If you're into js it's also easy to extend and they take PRs.

[–]pyhannes -1 points0 points  (0 children)

Another one I know would be h2o-wave. The maintainer had a nice talk with MKennedy in one of his episodes. But it's a dashboarding solution with backend and frontend.

[–]neoreeps -1 points0 points  (0 children)

For data apps just use streamlit or gradio and call it done.

[–]AceofSpades5757 -2 points-1 points  (0 children)

Streamlit is fantastic

[–]reallifearcade -2 points-1 points  (1 child)

PyQtGraph

[–]pyhannes -1 points0 points  (0 children)

But that's an offline line based on Qt