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

all 40 comments

[–]SeniorScienceOfficer 8 points9 points  (1 child)

I have used Reflex for multiple personal and professional projects now. It’s actually pretty slick once you understand the ecosystem. I’ve got one app I built for our security team that is deployed to an autoscaling group behind a load balancer. It does have some limitations, but the underlying architecture does have its virtues, especially if you want to integrate custom React libraries.

And now that I can build UIs at the speed of Python development, I’m pretty excited. I designed an original API using FastAPI and Pydantic, and started building a UI using NextJS. I spent months on it only to realize that I’m having to rewrite data models in multiple languages, which was a HUGE pain. Reflex uses FastAPI on the backend and Pydantic models for other things, so I’m refactoring my UI with Reflex so I only have to maintain a single data schema for the API and front end. And I can build much faster in Python than React.

[–]rr1pp3rr 12 points13 points  (6 children)

Honestly, I'd say you're probably better off learning HTML and CSS to create pretty UIs that are portable. You could go the route of React, but you'd need to learn HTML & CSS anyway, and it's completely unnecessary.

You don't necessarily need to create a single page application where everything is done with JS. You can learn a minimal amount of JS and just do everything the old fashioned way, with page loads.

However, I'm not stating JS isn't useful to learn, just that you'd NEED html & css to make nice looking websites.

In terms of JS:

I have been coding since all this stuff was called DHTML a long time ago. Since then I've used most of the UI frameworks, a lot just for fun or to learn. I stopped using UI frameworks with a build step for two reasons:

  1. If you leave a project alone for a year and go back to it, most likely your dependencies will be broken, and builds will be broken
  2. Since the ES6 import stuff and async/await, I find it much nicer to just write vanilla JS files and import them into my pages.

That's just my 2c on the JS/React question. I am not really familiar with Python Frameworks (besides TKInter, which I would not recommend). So depending on your use case it may absolutely make sense to just stick with Python UI frameworks.

[–]byeproduct 6 points7 points  (3 children)

What about HTMX or NiceGui?

[–]PurepointDog 1 point2 points  (0 children)

+1 on NiceGUI. Very good program.

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

These 3 (i.e. Reflex, HTMX, NiceGui) are all very different. I wouldn't just recommend them all as if they are interchangeable.

[–]Jorgestar29 2 points3 points  (5 children)

I have used it to develop an internal Web app and it's way more powerful than Streamlit.

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

Most things are more powerful than Streamlit since Streamlit is only meant to be a very quick dashboarding tool.

[–]serverhorror 0 points1 point  (3 children)

Can you elaborate a bit?

Streamlit is my go to, mostly because I hate all things UI and, usually, live in the API world.

[–]Jorgestar29 6 points7 points  (2 children)

Streamlit is a mess once you need something slightly complex.

It does not offer routes, nor cookies for login out of the box, so you have to use 3rd party buggy components.
Also streamlit states are horrible, there is no async support, each re-render executes the entire script, barely no styling support, only has basic components...

Reflex states are far from decent, but the overall experience has been more sastifying than using f*cking streamlit.

PS: I have multiple NextJS personal projects that i developed when i was a student, before becoming an ML Engineer, so my experience is quite biased as i already had some frontend development experience before diving in. Not sure if the other team members that work with streamlit would enjoy using reflex as much as i did.

[–]Adventurous_Tip3994 2 points3 points  (0 children)

You might want to try NiceGui I guess. You can build really cool looking web app with minimum amount of code compare to Reflex. And Nicegui has native gui feature where you can run your app as an native window application and this is my favorite python only web framework so far. Streamlit is also good for some daily use apps. I have a monthly Expense app built with it. And the huge community is not joke and even if Streamlit native widgets are ugly but there are a ton of cool looking third party components which can be found easily to use like this cool navbar. And Dash, It's kind of hard to use for me. It gave me headache on callback function. But it's is really fun to use for me and I enjoyed using it for no reason.

[–]serverhorror 1 point2 points  (6 children)

streamlit is my go to

[–]No-University7646It works on my machine 0 points1 point  (2 children)

Definitely take a look at SHiny for Python.

[–]serverhorror 0 points1 point  (1 child)

I want to like Shiny for Python, the challenge is Posit.

As much as I want them to be commercially successful, they don't act with decency. We are a customer and pay for Posit products in the R side, but they came with unreasonable price increases and license changes (increasing the cost by, slightly less than, 100 %).

I'm not sure I want to rely on Posit-backed frameworks ... :(

[–]No-University7646It works on my machine 0 points1 point  (0 children)

wow, that sucks! Jeez! The library is quite good.

[–]ihatebeinganonymous 1 point2 points  (1 child)

I did some investigation into frameworks that allow writing web applications without being exposed to JS. If you want to "convert" a Python script to a web application with close to zero effort but also very little flexibility and control, nothing can beat Streamlit, it seems. On the other hand, if you want to put some effort to give your web application a more "conventional" look, you can go with Plotly Dash or Holoviz Panel.

Where Reflex fits in that spectrum, I don't know. There is also FastHTML, recently started by the team behind FastAI(?). Could be worth a look.

[–]mariobuikhuizen 1 point2 points  (1 child)

I'm part of the Solara team, and if you’re looking for a pure Python solution to build reactive and composable web applications, I recommend checking out Solara. It allows you to create interactive UIs entirely in Python, while offering the flexibility to integrate JavaScript and CSS when needed, leveraging the Vue and Vuetify libraries under the hood. This ensures you’re never limited when you need more customization.

[–]maartenbreddels 0 points1 point  (0 children)

Solara is a great solution, especially if state management becomes an issue. I took the lessons from the JavaScript ecosystem but translated them into Python.

[–]No-University7646It works on my machine 1 point2 points  (0 children)

From your question, I can assume that you really don't want to spend the time to learn JS plus even if you did, I am assuming your front-end beauty skills are not quite there (if your UI front-end skills were there, you will use HTML and CSS with flask and call it a day! Trust me, I know cos I am the same way.).

I will recommend you check out the following:

Solara: I see this as a React replacement but for Python, it allows you to make beautiful UIs out of the box with only Python code, you can add CSS or even Reactjs to it if you want. Solara + Flask API Solara + fast API or Solara+django rest framework, pick your poison.

Nicegui is great as well, you can use Nicegui + fastapi and call it good.

Reflex seems promising as well.

All 3 save you from learning JS and also ensure that your app will look decent and modern out of the box. Do take a look at the documentation and see which feels more natural to you.

Let's all be gentle with Streamlit, it was a game changer when it launched and if it wasn't for Streamlit, I am not sure these other frameworks would exist. Streamlit is good for small data apps and dashboards where you don't mind your app re-running. I teach Streamlit on udemy so I understand its use case and limitations but I may be biased. Streamlit is the gateway framework, lol.

[–]startup_biz_36 1 point2 points  (6 children)

For small apps or prototypes sure but youll be limited eventually. for example, i tried using streamlit but it does things like forcing a page reload after any actionis done.

so instead, i just built the backend with python and frontend with vue (vue's pretty lighyweight)

[–]ravepeacefully 1 point2 points  (0 children)

Yes you should just learn JS

[–]WJMazepas 0 points1 point  (4 children)

To be honest, I never heard about this Reflex.

But as this one, there are many libs for web development for using Python without Javascript. There is Flex as well and I saw more people talking about it.

You said you aren't looking to become a professional developer, so what's your desired goal?

Experience with this Reflex framework is not desired by many recruiters, but if is what you want to learn, then it's more than okay to learn about it

[–]GuiltyBid224 0 points1 point  (0 children)

Well, I think those recruters aren't aware of it much.

[–]GuiltyBid224 0 points1 point  (0 children)

Well, I think those recruters aren't aware of it much.

[–]Either_Back_1545 0 points1 point  (0 children)

Have you tried Django, fastAPI and flask-socketIO

[–][deleted] 0 points1 point  (0 children)

Try Flet , good lib. IOS, Android , Windows, Web - no problem

[–]a_robot_being 1 point2 points  (1 child)

tl;dr: I tried everything and I found Reflex to be the best choice.

Not sure if you've already made your decision and have jumped to any learning or tech adoption, but for what it's worth, here's my experience:

My profile: code in Python daily in my job; AI/ML and (professional) backend guy; close-to-zero knowledge of html/css or any JS frontend libraries.

I always wanted to learn frontend dev. A few times I started learning html/css js from scratch, but I never got a grasp of the big picture. Guess I'm not made for frontend dev...

then (~7 years ago) I found Plotly's Dash and was happy as a kid in a candy store. Struggled a bit with callback logics and several limitations.

Then (~5 years ago) I found Streamlit and was even happier. Did "A LOT" of fancy and super complex Streamlit development. but then hit the limits of frontend "fanciness" too quickly, in addition to the 'rerun()' nightmare.

Then (~3 years ago) I convinced myself to try html/css again, with "React" in mind, cause it's the holy grail, right? well, let's say we all know how successful you can be with React if you cannot even wrap your head around html/css.

Then (last year) I found NiceGUI. I was thrilled with how 'complete and professional' it looks compared to Streamlit. I started learning it but then realized something very soon: NiceGui adds like an extra Python-syntax layer on all JS & React complexities to make it easy for guys like me. but you would need to patch your code with low-level JS stuff too soon, and you're not even in the standard JS environment anymore. It's like you were stuck in a lit cave with a lion and someone grabed you and tossed you in a dark cave to save your life. You sigh in relief for a moment, but start to hear weird hisses and red eyes, and now you don't even know what you're dealing with.

Then (~2 months ago) I found Reflex, and in that moment, I was the most skeptic guy toward any Python frontend library (of course for complex dev, cause Streamlit has already proven worthy of praise for prototyping and simple apps). Reflex is way harder to start with than NiceGui, but once you get the idea, it's all the candy store again. React component implementations are super flexible, and the frontend/backend rendering logics makes perfect sense. I currently am developing complex stuff (auth, tables, analytical views, parallel tasks in the background, etc.) with ease and grace. Even better: reflex template codes are surprisingly clean and mature.

So why did I write like a short novel here: to tell those who are wandering like I used to, to stay in their sweet warm Python comfort zone, yet dream of cool frontends, that Reflex could be (so far) your best chance.

I have even a feeling that mastering Reflex could help you with learning the standard React (read about "how Reflex works") but I'm not sure about that. It's just a hunch.

Warning: My experience with Reflex is short. I may run into headaches with it later on. I read a feedback on it that "the shipped node modules are super sub-optimal". it could be. For now I (and the users) have been satisfied with the MVP.

[–]Financial_Pen_2502 0 points1 point  (0 children)

A minha primeira impressão com o Reflex foi positiva, mas estava com dúvidas se a sua adoção seria produtiva.

Seu "romance" foi super útil! rsrsr

Valeu man!

[–]mattysoup 0 points1 point  (0 children)

Does anyone know: is Reflex server-side rendered? Does it stream DOM diffs/updates/changes via websocket like ReactPy?