4 ms·
What's with the obsession of writing web apps in Python? > Build custom UIs without writing Javascript/CSS/HTML Why? These three were built for the web and wo
by alabhyajindal 2y ago
What's with the obsession of writing web apps in Python?
> Build custom UIs without writing Javascript/CSS/HTML
Why? These three were built for the web and work flawlessly. I doubt that an abstraction built on top of these will result in faster development times.
The State Management guide[1] explains state and then explains the usage. If you know Python and want to build a UI with it you'll have to read the guides. The argument that having a familiar language simplies development doesn't stand here.
There are multiple projects now that allow you to build a UI in Python and it feels wrong to me. Who is it even intended for?
[1] https://google.github.io/mesop/guides/state_management/ https://google.github.io/mesop/guides/state_management/
- zinodaur 2y agoIt appeals to me. I don't write fronted code, but sometimes I want a frontend, even if it's really dinky. This seems way more approachable to me than learning JS/all the shit you have to deal with to write a non-toy ui
- alabhyajindal 2y agoLet's say you want a frontend for your server and have never written HTML before. Where so you start? If you have decided on using Python for the UI you have a handful of libraries each with their own documentation. To get started you need to choose one and then read the guides. If you decide to use HTML you have a whole lot more resources. I'd argue you'll be able to make a frontend faster using this approach. I understand the hesitation because of the complexity associated with JS. Maybe you're thinking about bundlers and minifiers when you think about writing a frontend with JS. But you don't need that. You can create amazing user experiences with a plain HTML, CSS and a JS file.
- simula67 2y agoWhile you may be able to create amazing experiences in JavaScript, JavaScript still has multiple problems: 1. It is inconsistent [1] 2. It does not have many features that programmers love and other languages have. 3. It has a community that holds different values from what other programmers value themselves. If people want to continue development in JavaScript, they can. But since JavaScript has a monopoly on the (fairly large) 'frontend development for the web' market, there will always be attempts to find an alternative. [1] https://www.destroyallsoftware.com/talks/wat https://www.destroyallsoftware.com/talks/wat
- alabhyajindal 2y ago1. I write both Python and JavaScript and find Python to be vastly more inconsistent. [1] 2. What are the missing JavaScript features that could be useful for web development? 3. I don't understand what you mean by this. Finding alternatives are great. My point is that JavaScript/HTML/CSS are great and it's worth learning them if you want to work on frontends. [1] https://stackoverflow.com/questions/66947264/why-do-python-standard-library-modules-not-follow-basic-pep8-rules https://stackoverflow.com/questions/66947264/why-do-python-s...
- zinodaur 2y agoI'm not trying to make an argument for "Python for the UI" in general. I just looked at their demo page, and thought "huh I could probably turn my debug script in to an okay looking UI in an hour with this". Maybe you are right that I could make something okay looking with plain HTML/CSS/JS in less time (including the time to figure out HTML/CSS/JS?)
- alabhyajindal 2y agoI agree on making a demo for an existing Python project. I have used Gradio and I think it's amazing! I disagree on the using something like this to start making a UI. When you know that your project requires a complex frontend, you're better of starting with HTML.
- anigbrowl 2y agoCounterpoint: you have made a fun and interesting thing in Python that works great in your command line/Jupyter notebook. You want to share it with your non-developer friends/anyone who might be interested, so you need some kind of interactive GUI, and the easiest one is a web page of some kind. But you don't want to learn a whole new stack because web development is really not Your Thing. So you use something like Dash, Streamlit, or this, which allows you to do everything in Python and put up something that looks reasonably professional but does not require a great deal of time or effort. Or get serious and do it in Flask or Django. From your other comment: But you don't need that. You can create amazing user experiences with a plain HTML, CSS and a JS file. What do you consider the best example material for that? The reason us Python programmers (many of whom are amateurs) are so leery of Javascript et al is because most commercial websites are so hideously complicated, and most of us are just not interested in front end stuff or we would have started out with Javascript in the first place. I've said it before, what most Python programmers want for UI is something like Visual Basic used to do - just a simple canvas with a palette of standard UI components that can be thrown together like Lego and doesn't look like a complete mess.
- alabhyajindal 2y agoThat's a great question. And I completely agree. It's become extremely common to obfuscate client code or throw together 5 NPM packages into a frontend framework to justify "rapid development". Here are a few websites that have great UX and readable source code. For each, you can view source and understand how the page is structured, styled and made interactive: - https://tour.gleam.run https://tour.gleam.run, interactive code tutorial - https://sivers.com https://sivers.com, ecommerce - https://www.geoffreylitt.com https://www.geoffreylitt.com, personal website I enjoy doing this and have recreated a few projects that I liked by reading their source: - https://sudoku-aj.netlify.app https://sudoku-aj.netlify.app inspired by https://sudoku.com https://sudoku.com - https://imgbar.pages.dev https://imgbar.pages.dev inspired by https://imgflip.com https://imgflip.com - https://logo-lang.pages.dev https://logo-lang.pages.dev inspired by https://www.transum.org/software/Logo https://www.transum.org/software/Logo Web technologies are amazing. It's one thing to say that it's hard because you're not familiar with it and another that they are objectively bad. I disagree with the second statement. If people want a drag and drop solution for building UIs that's great. I'm sure no-code solutions exist for that. Again, my disagreement is on the point that somehow building UIs with Python is better.
- dragonwriter 2y ago> > Build custom UIs without writing Javascript/CSS/HTML > Why? These three were built for the web and work flawlessly. Because you are throwing a Web UI on something written in Python for other reasons, and don't want to add 3 additional languages to the mix to do that.