Live data from Hacker News

Designing a Pure Python Web Framework

reflex.dev

51–59 of 59 posts

Re: Designing a Pure Python Web Framework

#51
post #38
post #4

Anvil [1] is another "pure Python web framework", where you write both the client and the server code using Python. (The client code gets converted to JavaScript so that it can run in the browser.) Anvil has been around since 2016 [2]. [1] https://anvil.works/docs/app-architecture [2] https://anvil.works/blog/page/15.html

oh wow oh wow! i didnt know about this, this goes even further with a UI editor (that is a killer app) I'm going to have to pause reflex (im still loving it so far) and take a look at anvil here because it seems to be more mature and baked product than reflex as it stands one thing i appreciate about Reflex is it feels programmatic and familiar with background in python backend...so maybe its suitable for more limite…

As a general rule, an online server should never be left "open" so that anyone can run arbitrary code there. Such servers quickly get turned into bots for botnets (which do things like denial-of-service attacks for their commanders).

I suspect Anvil has that credit card requirement to prevent botnet recruiters from abusing Anvil's free trial. (Anvil lets signed-up users run arbitrary Python code on their servers.) By asking for a credit card, Anvil has the information they need to go after anyone who violates their terms of service.

Reflex doesn't have to ask for a credit card because you can try it out locally. With Anvil, there is no local dev, you do all the dev in your web browser, in the Anvil Editor app. It's not just a web framework; it's a Rapid Application Development suite.

Re: Designing a Pure Python Web Framework

#52
What would make it easier for me to bet on this is if a few pages made with this could be embedded in an existing Django app, in particular using Django auth. I assume many other people are in that position, with existing Django assets.

I get that it's not straightforward because it's based on FastAPI and has its own ORM based on SqlAlchemy, both of which have different async behavior than Django, but is it possible to maybe host a Django app and Reflex app in the same process, routing between the two at the WSGI/ASGI etc. level, and only interact with the Django auth middleware?

Re: Designing a Pure Python Web Framework

#53
post #51
post #38

Earlier quoted context omitted.

oh wow oh wow! i didnt know about this, this goes even further with a UI editor (that is a killer app) I'm going to have to pause reflex (im still loving it so far) and take a look at anvil here because it seems to be more mature and baked product than reflex as it stands one thing i appreciate about Reflex is it feels programmatic and familiar with background in python backend...so maybe its suitable for more limite…

As a general rule, an online server should never be left "open" so that anyone can run arbitrary code there. Such servers quickly get turned into bots for botnets (which do things like denial-of-service attacks for their commanders). I suspect Anvil has that credit card requirement to prevent botnet recruiters from abusing Anvil's free trial. (Anvil lets signed-up users run arbitrary Python code on their servers.) By…

you think botnet operators are going to use anvil? i think you are being tad ridiculous here. this is a bad experience period. ive moved on and sticking to reflex

Re: Designing a Pure Python Web Framework

#54

I have used this to build an internal tool, and that was quite a nice experience. My main complaint right now is that it's quite a bit of work to build authentication. I think there are some examples somewhere that show you how to do it. But given, how common it would be for people to use authentication, it should be built in as a first-class object.

Cofounder @ Dropbase (dropbase.io) here. If you just need to build internal tools with Python or want to build internal tools on top of your existing Python codebase, give us a try. We have granular permission built-in so you can share internal tools with others easily, down to who can use or edit each internal tool you build. For context, we're a more niche cousin to Reflex that's specifically designed to build inte…

Dropbase looks neat. Couple questions based on my read of the site/github/docs:

- is the architecture exclusively hybrid SaaS? Looks like I host a worker node but a cloud connection is still required.

- how can I monitor the data flow between the local worker and hosted orchestrator? I assume it’s straightforward to turn on verbose logs on the worker’s requests out.

- is the IDE hosted locally or remotely?

- authentication to local services appears to be done primarily through credentials hardcoded in the ENV file. How can I use SSO and pass user authentication to the upstream data sources?

Re: Designing a Pure Python Web Framework

#55
post #5

Earlier quoted context omitted.

We need to compile down to React/HTML in the end as it's the only way to render a webpage. By "pure Python" we meant from the developer's perspective they won't have to touch React or Javascript. We only use React for the UI layer and to send events. Since all the state/logic is kept in Python you won't see Javascript errors during runtime, and debugging can mostly be done in Python land.

Wow, you literally got everything wrong in this comment. - There are a thousand ways to render HTML, you don't need React at all. Even for interactive pages (see recent alternatives like HTMX, or decade old solutions...) - If it is converted to JS/React it's obviously not "pure" Python. Sorry, but that's just silly to say that. - You will definitely see JavaScript errors during runtime, it's inevitable. Maybe not wit…

Would you consider it “pure Python” if it targeted a WASM runtime for the browser side component?

Re: Designing a Pure Python Web Framework

#56
post #53
post #51

Earlier quoted context omitted.

As a general rule, an online server should never be left "open" so that anyone can run arbitrary code there. Such servers quickly get turned into bots for botnets (which do things like denial-of-service attacks for their commanders). I suspect Anvil has that credit card requirement to prevent botnet recruiters from abusing Anvil's free trial. (Anvil lets signed-up users run arbitrary Python code on their servers.) By…

you think botnet operators are going to use anvil? i think you are being tad ridiculous here. this is a bad experience period. ive moved on and sticking to reflex

Google Cloud Functions is another online service where you can run arbitrary Python code "in the cloud" (on Google's servers). They have a free tier. And if you want to use it... you have to give them your credit card information. That's just how services like these work.

Reflex has nothing like that: you can't run your Python code on their servers, yet --- and once you can, you can be sure they're not going to let you try it for free without asking for your credit card.

Re: Designing a Pure Python Web Framework

#57

> writing a lot of boilerplate code to connect the frontend and backend. OpenAPI. django-ninja supports it out of the box.

What do you use for the frontend?

Usually, I go with openapi-generator and pick the typescript-fetch template. You can use that with whatever js-based frontend framework you want.

Re: Designing a Pure Python Web Framework

#58
post #38
post #4

Anvil [1] is another "pure Python web framework", where you write both the client and the server code using Python. (The client code gets converted to JavaScript so that it can run in the browser.) Anvil has been around since 2016 [2]. [1] https://anvil.works/docs/app-architecture [2] https://anvil.works/blog/page/15.html

oh wow oh wow! i didnt know about this, this goes even further with a UI editor (that is a killer app) I'm going to have to pause reflex (im still loving it so far) and take a look at anvil here because it seems to be more mature and baked product than reflex as it stands one thing i appreciate about Reflex is it feels programmatic and familiar with background in python backend...so maybe its suitable for more limite…

I'm so happy that you found out for the rest of us on this one. I agree completely with others on this and I also agree that Anvil isn't what you think it is when it comes to web. I'd rather work with something fresh like Reflex because it's what we've been waiting for in terms of compiling front-end, using modern frontend libs. While I'm sure Anvil can get the job done, I just don't see it handling components like Reflex.

Re: Designing a Pure Python Web Framework

#59
post #5

Earlier quoted context omitted.

We need to compile down to React/HTML in the end as it's the only way to render a webpage. By "pure Python" we meant from the developer's perspective they won't have to touch React or Javascript. We only use React for the UI layer and to send events. Since all the state/logic is kept in Python you won't see Javascript errors during runtime, and debugging can mostly be done in Python land.

Wow, you literally got everything wrong in this comment. - There are a thousand ways to render HTML, you don't need React at all. Even for interactive pages (see recent alternatives like HTMX, or decade old solutions...) - If it is converted to JS/React it's obviously not "pure" Python. Sorry, but that's just silly to say that. - You will definitely see JavaScript errors during runtime, it's inevitable. Maybe not wit…

Sounds RIGHT to me. You need a modern front-end framework like React.js if you want to avoid state / component hierarchy nightmares that you find by doing the same with vanilla JS. Also, the statement of working with pure Python resonates well from the dev perspective. Makes sense to me!
Post reply on HN