News for hackers. Stuff that matters.
Re:BeeWare – write Python, run everywhere using native UIs by serial_dev on Sunday February 06, 2022 @03:35PM (#30236712)
I work now with Flutter full time and love it, but on my way from web Vue.js to mobile development with Flutter, I was researching different app frameworks, and I watched some videos with the main author of BeeWare/Toga, Russell Keith-Magee. The presentations are very engaging and the solution that this project came up is really something.

This is my favorite video by Russel [0], it really is a fascinating project, and he is a great speaker.

With that said, I don't really see it becoming a widely used framework. No matter how creative the solution is, it's hard to compete against real native, Kotlin Multiplatform Mobile, Flutter, React Native, Electron, and more. The most complicated example I saw with BeeWare is a todo list app [1]

[0] https://www.youtube.com/watch?v=qaPzlIJ57dk [1] https://www.youtube.com/watch?v=RisCgSIWwLA

Re:BeeWare – write Python, run everywhere using native UIs by bb88 on Sunday February 06, 2022 @05:29PM (#30237677)
There's been quite a few "python" in the browser/android/native kinds of things:

  * pyjs / pyjamas
  * brython
  * kivy
  * chaquopy
  * pyqt
  * pygtk
  * ...
But the first big problem has always been delivering an experience that looks and feels right on the target platform. Do you use the native UI or do you use something else? The swing Java UI's of the 00's were so kludgy, and looked unprofessional because they implemented their own UI components.

The other big problem is that how does the code run? Is it transpiled to javascript or does it have to download a python interpreter that can run in the browser/android? It's not a big issue for like a native app for mac/windows, but for the browser it is. https://brython.org takes ~6 seconds to run a simple clock because it's downloading the interpreter. Wasm doesn't necessarily help here, since either you compile the code to directly run on wasm, or you need to bring along the wasm compiled interpreter.

An example of this is Jython. It needed to start the JVM, then run the python code in the python interpreter in the JVM. Very inception like, though I did enjoy writing unit tests this way. Mostly because unit tests didn't need to be compiled against a jar. And broken unit tests didn't need a full recompile.

Re:BeeWare – write Python, run everywhere using native UIs by udbhavs on Sunday February 06, 2022 @03:52PM (#30236880)
Does Kotlin Multiplatform mobile handle the UI layer for both iOS and Android? I thought you could only share business logic
Re:BeeWare – write Python, run everywhere using native UIs by jillesvangurp on Sunday February 06, 2022 @05:21PM (#30237611)
Not currently. Jetbrains has extended Google's Compose framework with a desktop and and web variant recently. However, IOS is notably not covered by these. Though you might reasonably expect them to be going there as well.

Compose desktop currently target the JVM, which of course is not going to work on IOS. They do use Skia for the UI; which is also what Google is using with Flutter, I think.

Targeting the Kotlin native compiler would be a logical next step. It's currently quite usable for porting libraries between different platforms. However, I'm guessing they would need to do a bit of work on improving the multi platform library ecosystem to be able to have enough of a base platform for developing full applications with it. Targeting IOS would be a logical next goal once they are able to do that.

Re:BeeWare – write Python, run everywhere using native UIs by serial_dev on Sunday February 06, 2022 @03:54PM (#30236910)
You are correct. The technical details of the solutions I listed can be different, but in the end they are often competing for the same users (I need an app, which solution should I use).
Re:BeeWare – write Python, run everywhere using native UIs by udbhavs on Sunday February 06, 2022 @04:05PM (#30236994)
I haven't looked too deeply into how BeeWare works, but why is it so uncommon to see similar solutions in other languages like Kotlin, Go, Rust etc? Basically the React Native approach but without JS. I would love to write multiplatform native UIs in any of these languages.

I have nothing against Javascript but there are still a lot of weird limitations in RN despite being several years old. Writing smooth animations that support user interaction is difficult because it is still single threaded and you are limited to a declarative animation api where the underlying native runtime does the interpolation.

React-reanimated v2 tries to solve this by spawning JS worklets that can run animation code in another thread but that comes with its own caveats. This would be so much easier to do in a language with built in threading, not to mention all these languages are very ergonomic and loved by developers so I'm curious why something similar hasn't been tried for them yet.

Re:BeeWare – write Python, run everywhere using native UIs by c0balt on Sunday February 06, 2022 @07:25PM (#30238607)
For the languages it boils down to availability of relevant ecosystem and developers in my experience.

Why react-native, well, because it means you have access to one of the largest ecosystems and an awesome tooling catalogue. The same applies for JS as the language of choice for App (UIs). Kotlin was also a great candidate since it could leverage the already mature Java ecosystem for android.

Flutters success is an outlier here that I would guess is due to Google backing. The resources and docs are good and you could rely on financial and developer backing. The decision to go with Dart was most likely to make themselves not dependent on another party for a core utility and to have a steering position on the overall projects course.

If, for example, Microsoft would back a good C# cross-platform framework I would bet on it at least seeing moderate adoption.

Edit: As another commenter pointed out, GO has a cross-platform GUI Framework option - Fyne [https://github.com/fyne-io/fyne]

Re:BeeWare – write Python, run everywhere using native UIs by cutler on Sunday February 06, 2022 @08:30PM (#30239033)
A C# cross-platform framework already exists - .NET Multi-platform App UI (MAUI).
Re:BeeWare – write Python, run everywhere using native UIs by udbhavs on Monday February 07, 2022 @04:41AM (#30242432)
Edit: It looks like there are some efforts to bring it to iOS https://github.com/cl3m/multiplatform-compose
Re:BeeWare – write Python, run everywhere using native UIs by password4321 on Sunday February 06, 2022 @05:30PM (#30237691)
Re:BeeWare – write Python, run everywhere using native UIs by kumarvvr on Sunday February 06, 2022 @08:36PM (#30239066)
Do you work with Flutter for mobile apps only? Or do you target other platforms?

I want to try out Flutter, but my main target is Web and Desktop apps (Recent update from Flutter for Windows Desktop Apps made me want to learn it)

I have heard several criticisms regarding flutter for Web, that bundle sizes are high and load times are slow.

What is your opinion? How was the experience, and most importantly, is designing apps with flutter easier on the cognitive side?

Re:BeeWare – write Python, run everywhere using native UIs by serial_dev on Monday February 07, 2022 @03:29AM (#30241873)
IMO, Flutter for web only makes sense if you already have a mobile or desktop app done, and you are looking for a quick win: if your app is architected properly, adding web support for a mobile app project is really a matter of hours (or even minutes) which is amazing if you can live with the less-than-perfect UX.

Flutter on the web looks like Flash, everything feels very off, scrolling, keyboard support, text selection, etc everything just feels strange or doesn't work and it provides a poor end user experience.

Apart from the good mobile experience, I'm also excited about Flutter on desktop. It might not be "there" yet (I don't know, I am not using it in production), but it's promising and could be a good alternative to native desktop development and Electron.

Re:BeeWare – write Python, run everywhere using native UIs by PascalW on Monday February 07, 2022 @01:30PM (#30248962)
Flutter for web is quite rapidly improving in all the areas you mentioned. For right now I think it's already very suitable for highly complex browser applications such as a Figma, Google sheets etc. Load times aren't the best due to a quite hefty WASM download, but for _applications_ that you typically open only a couple of times per day and where you work in for several hours, that initial loading delay really doesn't matter.

Just don't expect to use it for an E-Commerce site or something like that.

Re:BeeWare – write Python, run everywhere using native UIs by fyzix on Sunday February 06, 2022 @09:14PM (#30239361)
Flutter web is not fit for consumer facing products imo, it renders in a canvas so the performance will never match up to html+css+js. I've used it to make desktop apps but there's still some rough edges but it's getting better. Definitely better than electron though.
Re:BeeWare – write Python, run everywhere using native UIs by virtualwhys on Sunday February 06, 2022 @03:55PM (#30236915)
> work now with Flutter full time and love it.

Do you love Dart though? Flutter's stateful hot code reload is amazing but, man, for me Dart is just completely hideous. Maybe I've gotten spoiled by Typescript and Scala...

Re:BeeWare – write Python, run everywhere using native UIs by serial_dev on Sunday February 06, 2022 @04:11PM (#30237038)
Oh, Dart is my favorite part of Flutter. It's a language that is very easy to learn and use, no surprises, it's performant (performant enough), and you can use it on web, server and as command line apps, too. The language has gotten significantly better and the Dart team focuses on the right issues to solve next.
Re:BeeWare – write Python, run everywhere using native UIs by berkes on Sunday February 06, 2022 @04:22PM (#30237133)
> on web

Does it stranspile to JavaScript, or compile to asm, or something else entirely?

Re:BeeWare – write Python, run everywhere using native UIs by serial_dev on Sunday February 06, 2022 @04:35PM (#30237247)
> Dart supports the web as one of its core platforms. Dart-to-JavaScript compilers are available both for development and for production.

You can learn more about the status quo here https://dart.dev/web

Compiling to WASM is on the roadmap https://github.com/flutter/flutter/wiki/Roadmap#dart

> Dart (...) We also plan to expand Dart's compilation toolchain to support compiling to Wasm, contingent on the timely standardisation of WasmGC.

Re:BeeWare – write Python, run everywhere using native UIs by _delirium on Sunday February 06, 2022 @04:27PM (#30237188)
It compiles to JS: https://dart.dev/tools/dart2js

The Dart team is investigating a dart-to-wasm compiler, but is waiting on the Wasm GC proposal to be standardized: https://medium.com/dartlang/experimenting-with-dart-and-wasm...

Re:BeeWare – write Python, run everywhere using native UIs by devxpy on Sunday February 06, 2022 @04:26PM (#30237178)
Transpile to Javascript https://dart.dev/overview#platform
Re:BeeWare – write Python, run everywhere using native UIs by travisgriggs on Sunday February 06, 2022 @07:41PM (#30238710)
I’m with you. Dart felt like a step back in time for me.

I was a big fan of some of the early Dart leaders (Lars Bak and Gilda Bracha). I remember when I asked why Dart seemed like a watered down variant of some Lars and Gilads earlier work; I was tiled by a former colleague that had joined the project that “Lars was playing it safer, playing to win” these days.

I don’t know how much either of these people are associated with Dart anymore. Somewhere in Dart’s search of a killer problem to be the solution for, we got fully typed Dart (as opposed to the original annotations are optional mindset).

I did one of the free web courses for it, built like 10 teeny pointless apps. Three things stood out:

- the experience was kind of painful on iOS, the look had an “uncanny” effect

- the tutor tried to explain classes as a “way of organizing code” which undersells what classes are really about (binding behavior to data)

- the language felt like an alter Java (type declarations in the left side still??)