[HN Gopher] BeeWare - write Python, run everywhere using native UIs ___________________________________________________________________ BeeWare - write Python, run everywhere using native UIs Author : ivanche Score : 228 points Date : 2022-02-03 10:13 UTC (3 days ago) (HTM) web link (beeware.org) (TXT) w3m dump (beeware.org) | miketery wrote: | I wish I saw this before I started on the road with React Native. | Lot's of similarities but seems easier and thinner (i.e. npm is | too bloated). | nicmccool wrote: | I'd gone down the rabbithole the last few days of whether to use | kivy or beeware for a personal powerlifting app I'm building as | side project / learning experience. I'd gone as far as settling | on Kivy and installing the dependencies (which took an extra few | hours until I learned only python <= 3.8 is used), and now this | pops up here and I'm reconsidering everything... again. On paper | Beeware sounds perfect for my needs, but the limited community | support has me timid to try. | JasonFruit wrote: | I wrote a few small Android apps using Kivy, and I ran into | some problems with performance with scrolling lists of buttons. | Doing it the most obvious, natural way led to obvious poor | performance -- a list of more than a dozen or so buttons simply | could not be scrolled without accidentally clicking on one. | There was a recommended workaround, which I found and used, and | its performance was slightly less obviously bad -- it showed up | with dozens of bad reviews from users of slightly outdated | devices. The last I looked, Kivy had not progressed on that | issue. I didn't continue to use it, and don't know if it has | other similar problems, but it was a discouraging experience | for me. | guitarcase wrote: | Did you by any chance use recycleview for the listviews? | Seems to be the recommended way but the documentation is not | very clear on how to use them. | clued wrote: | I made a Kivy/KivyMD mobile app as a part of my diploma project | like a year ago, and I surely wanted it to be a cool little | learning experience, too. It was a disaster! | | I mean, the KV language is pretty neat, but the insane amount | of tooling involved (that always, always fails) to actually | open your app on your phone is disgusting. Disgusting as in | using three different versions of Python, setting up | mismatching Android tooling, cross-compiling wheels on your | virtual machine only for it to fail with some cryptic GCC error | disgusting. It's also pretty outdated (e.g. camera doesn't work | properly with the last ~5 Android APIs), and of course very | slow, even if you pre-optimize your code with pagination and | stuff. | | Kinda regret using Kivy at all, despite its community being | amazing. So, can't recommend. Perhaps, you could consider | learning Flutter instead? It will take just about the same time | investment, but the whole experience is incomparable. Even | better, make a test app in Kivy, and then make one in Flutter. | (This is only partly a joke, though. It's really that fun.) | jedberg wrote: | Does anyone know of any apps that were developed with this? They | didn't have any examples on their site that I could find. | The_rationalist wrote: | einpoklum wrote: | serial_dev wrote: | 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 | udbhavs wrote: | Does Kotlin Multiplatform mobile handle the UI layer for both | iOS and Android? I thought you could only share business logic | jillesvangurp wrote: | 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. | serial_dev wrote: | 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). | udbhavs wrote: | 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. | bb88 wrote: | 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. | virtualwhys wrote: | > 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... | serial_dev wrote: | 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. | berkes wrote: | > on web | | Does it stranspile to JavaScript, or compile to asm, or | something else entirely? | _delirium wrote: | 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... | serial_dev wrote: | > 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. | devxpy wrote: | Transpile to Javascript | https://dart.dev/overview#platform | password4321 wrote: | Add Fyne to the list, using Go. | | https://hn.algolia.com/?query=Fyne%20-fine%20comments%3E0 | explaingarlic wrote: | Looks well and cool, but the enterprise "pricing" seems a | little... optimistic. | | > $5000/month | | > An annual meeting with core team | | I understand that these are technically "donations" but the | incentives offered are very much just a lightweight support | agreement for 2-10x the price. | | I have no reason to believe that a python based UI solution that | _finally_ captures some market share could be a big success, and | are that point the pseudo donation model would go out the window. | Best of luck to these guys, would be cool to not be forced to use | TKinter in school assignments. | samwillis wrote: | The BeeWare system is incredible and so close to really taking | off. What I feel it needs if a proper corporate sponsor, an | organisation that will embrace it itself for its own products and | invest back into the project. It's the best chance of Python on | mobile we have. | bastardoperator wrote: | "Write once. Deploy everywhere."... I've heard this too many | times to take it seriously anymore. | mrtksn wrote: | It never works well because the platforms are not simply the | same thing by different companies but they all have their | concurrent ideas, conventions and differences. | | The toolset for "Write once. Deploy everywhere." that works is | HTML + JS + CSS and nothing else. This is because browsers work | about the same everywhere. | | IMHO if an app is not going to leverage the platform but will | simply show some UI to display or collect data, the way to do | it is HTML + JS + CSS in the browser. | | When you try to support platform specific features, you end up | doing much more work but instead of working on the primary App, | you spend you time on integration and replication of platform | behaviour or functions. | nu11ptr wrote: | I'm still a fan of this concept, but I think you have to keep | your expectations realistic. You are likely going to have to | make some platform specific considerations, just a lot less | than without an abstraction technology. Generally, I've found | this manageable, but it can be hard to pull off well for sure. | Some have succeeded rather well I think (Java comes to mind). | | Native GUI frameworks can be more of a challenge. Still, if you | want a native L&F your alternative is to code each platform | individually, then something like this (or wxWidgets/SWT/etc.) | is likely to be a lot less work (but likely to look a bit less | native). Trade offs. Good to have choices I think. | y4mi wrote: | "write once, deploy everywhere [you've got the same kind of | hardware or machine available so that the code will work | without recompilation and won't look too out of place]" just | doesn't have the same ring to it... | zerkten wrote: | It's not worth taking seriously for app development where you | gain advantages from the native experience. This rules it out | as a primary app development platform for the majority of | developers. | | It's very strong for the many "good enough" scenarios that | range from complete products in domains like pharma where users | will tolerate user experience glitches as long as they can be | using the same Pandas code behind the scenes on multiple OSes, | or utility-level apps that need to run on multiple platforms. | These are often tucked away in places that HN readers are | averse to exploring from a career perspective. | streamofdigits wrote: | Both BeeWare and Kivy are great projects adressing a space that | could surely produce some very interesting applications. Offering | seamless integration of the versatile python stack on mobile | devices would be a game changer as far as I am concerned, turning | the mobile more into a computing device as opposed to merely | facilitating the fastest click to the cloud. | | They seem under-resourced, though, especially BeeWare. Targeting | platforms that do not support python natively feels like a task | that would challenge even much larger teams | [deleted] | jollybean wrote: | Can people comment here on how powerful they believe Python is | vs. something like Javascript/Typescript. The later have their | flaws but do really well for UI development. Is there truly an | inherent advantage in Python? Are some people inherently keen on | the language? | rich_sasha wrote: | Python is a great language. Really nice to work with, if you | don't mind the premise (no static safety etc). It's not really | focused on UI though; packages exist but are kind of niche, I'd | say. Not exotic: you have wrappers for Tkinter, Qt, WxWidgets | etc. But most people writing serious native GUI apps avoid | Python. I've always found Python GUIs slow and clunky. | | Web is different for many reasons and there Python does well. | musingsole wrote: | The language specifics are mostly a subjective judgement, but | if you can get Python into the same niches as Typescript, then | the ecosystem can payoff tenfold. | | The number of convoluted JavaScript "data" apps that I've | replaced with python and just a dash of Pandas is too high. | IshKebab wrote: | I just don't understand why you'd choose something as slow as | Python for this. Not sure how it could compete with React Native | which seems like the closest equivalent, but in a much faster and | better language. | coldtea wrote: | Because you get to use Python. | | And why would Python level "slow" matter at all for most kinds | of apps? You're not writing games or bitmap editors with | this... | bogwog wrote: | > better language | | Sarcasm? | nvllsvm wrote: | The language is the main reason to choose this. It's for people | who like Python and want to write a GUI in it. | alexklark wrote: | Can they go and do it somewhere else? I don't need another | ugly and power draining app in my iphone that I might forced | to use. I wish apple forbid to use in store all these | inferior interpreted languages with huge over-bloat like | csharp, python, java, ruby. They are fine a tool for heating | the earth and get corp to purchase even more servers for | CRUD, but not to use in a battery powered device. | progval wrote: | > interpreted languages with huge over-bloat like csharp, | python, java, ruby | | csharp and java, famously interpreted languages, unlike | javascript. | [deleted] | silisili wrote: | Python is one of, if not the, easiest languages to learn and | use. I feel that's why it took off in science related fields - | non CS people can jump in and be productive quickly. | | Seeing as this is for GUIs and not say, computing digits of Pi, | I think Python is a fantastic choice for this. | | I honestly wish Python had taken off as the web language | instead of JS, but that's a conversation for another time. | | FWIW, I'm not a Python fanatic or anything, I haven't used it | in years - but it's hard to argue it's not a great language for | beginners. | zerkten wrote: | If you want to make a quick shift from writing command line | apps to writing GUI apps then you are the target for this. If | you need to be writing high value mobile or desktop apps then | this is a less of a compelling option as you note. | | There are a lot of very high quality libraries like Pandas and | SciPy that are not available in the React Native ecosystem. | Tools like those provided by BeeWare let you add a GUI quickly. | The folks interested in interacting with something running on | these data science libraries tolerate imperfect user | experiences more than the average consumer. | | If we looked at React Native we could level your argument at it | as well. Why use RN when you could build real native apps? | Surely, that's the most optimal experience over a third-party | platform, no matter how good RN is in practice. | udbhavs wrote: | I would love a cross platform native toolkit like this for a | typed language like Kotlin or Rust | coldtea wrote: | Well, there is one for Kotlin: | | https://www.jetbrains.com/lp/compose-mpp/ | udbhavs wrote: | Kotlin multiplattorm doesn't do iOS UI, only some business | logic sharing using kotlin compiled to native. The UI layer | still needs to be in Swift | amelius wrote: | There are so many different languages, that we stopped | making any progress! | nu11ptr wrote: | I agree with this, and yet, I love these new languages | (esp. Rust) so I'd hate to halt progress. | | Instead, what I think we need is a solid cross platform | native UI library targeting C (libui would be a candidate | - before it lost momentum). It would then be a reasonable | amount of work to create multi-language bindings. Instead | we have things like wxWidgets/Qt that are a pain to | create bindings for since it is written in C++. As proof | this would accelerate things, notice how many languages | have GTK bindings (C based). | frou_dh wrote: | libui would still only be suitable for toy applications, | even if it was properly maintained. | | As a user, I don't want to use toy applications. So hats | off to those who do things properly and use the real | platform frameworks. | jasfi wrote: | Check out https://nexusdev.tools/ | | Kotlin/Rust could be supported if there's enough interest. | nu11ptr wrote: | SixtyFPS (https://sixtyfps.io/) is in progress for Rust, but | it is still early days. It also does not technically use a | native toolkit (it uses Qt), but I believe that might be on | roadmap. For traditional GUI apps, I think the lack of a | table or tree widget is the most limiting for the time being. | They have stated they intend to remedy that. | | I should also add that it is GPL - with all that implies. | They also have commercial licenses. | dang wrote: | Past related threads: | | _Beeware - Android and iOS Apps in Python_ - | https://news.ycombinator.com/item?id=24487867 - Sept 2020 (25 | comments) | | _BeeWare project: A request for your help_ - | https://news.ycombinator.com/item?id=14034353 - April 2017 (1 | comment) | | _Build and ship native GUI apps on Python with Beeware [audio]_ | - https://news.ycombinator.com/item?id=12719433 - Oct 2016 (6 | comments) | | _BeeWare: The IDEs of Python_ - | https://news.ycombinator.com/item?id=12374952 - Aug 2016 (1 | comment) | | _BeeWare - The IDEs of Python_ - | https://news.ycombinator.com/item?id=9616641 - May 2015 (28 | comments) | [deleted] | arjvik wrote: | I've tried using Briefcase before, and I completely gave up. The | goal was to get a cross-platform Qt app compiled down to a single | executable, but I couldn't even get it to run on the machine it | was compiled on, much less a windows machine without Python | installed. | | Am I an outlier, or is it this difficult to get working at first? | I imagine that once you get a working build, it must work quite | smoothly! | franga2000 wrote: | I haven't used this framework, but this has been my experience | with pretty much all UI frameworks and especially with Python | ones. Even the demo projects are often a pain to package and | starting from scratch means hours of reading docs and changing | parameters almost at random to see what happens. | | Windows is the absolute worst for packaging Python (unless you | give up and package everything in a self-extracting exe, but | then antivirus is even more likely to eat it) and Android | barely runs native Qt (seriously, the demo project from their | website straight up doesn't build), so I can imagine that | running something with 4 layers of stuff in between would have | even worse odds of working. | Retr0id wrote: | https://beeware.org/project/projects/libraries/toga/ | | For a UI framework, there is a distinct lack of screenshots. | | > > So, why is it called "Toga"? | | > When in Rome, do as the Romans do. And what does a Roman wear? | A Toga! | | Ha, that's a clever choice. | JasonFruit wrote: | If you follow the Documentation link, there are a few. | upwardbound wrote: | > For a UI framework, there is a distinct lack of screenshots. | | Yeah. I was able to find some here; looks clean and reasonable | at least on Mac: | | https://twitter.com/PyBeeWare/status/1366274894967709702/pho... | | https://maestral.app/assets/images/screenshot.png | | (I'm including the Maestral link because one of @pybeeware's | tweets says that Maestral is a BeeWare app) | udbhavs wrote: | Here's how it looks on Android and iOS - | | https://docs.beeware.org/en/latest/_images/tutorial-5-launch. | .. https://docs.beeware.org/en/latest/_images/tutorial-5.png | eesmith wrote: | Though with an inauspicious context. Quoting | https://en.wikipedia.org/wiki/Toga : | | > From its probable beginnings as a simple, practical work- | garment, the toga became more voluminous, complex, and costly, | increasingly unsuited to anything but formal and ceremonial | use. It was and is considered ancient Rome's "national | costume"; as such, it had great symbolic value; however even | among Romans, it was hard to put on, uncomfortable and | challenging to wear correctly, and never truly popular. When | circumstances allowed, those otherwise entitled or obliged to | wear it opted for more comfortable, casual garments. | | > ... the toga's bulk and complex drapery made it entirely | impractical for manual work or physically active leisure. The | toga was heavy, "unwieldy, excessively hot, easily stained, and | hard to launder".[39] It was best suited to stately | processions, public debate and oratory, sitting in the theatre | or circus, and displaying oneself before one's peers and | inferiors while "ostentatiously doing nothing".[ | kissiel wrote: | "native" as in "native user interfaces" | 95014_refugee wrote: | And "everywhere" as in "user-facing systems". | bogwog wrote: | Is there such a thing as a non-user facing system with a user | interface? | capableweb wrote: | Server hardware is generally not user facing (well, | everything is "user" facing considering who the "user" is, | maybe better to say "end-user facing") and has interfaces, | both hardware and software usually, on one or another | level. | berkes wrote: | None of those interfaces are user-interfaces, though. | iqanq wrote: | And not even that. Unless they are pretending that GTK+ or Qt | or whatever they've chosen looks native on desktops. | YellowStuDregg wrote: | They do use native widgets: | | https://toga.readthedocs.io/en/latest/background/philosophy.. | .. | dang wrote: | Ok, we've put that in the title above. | | (Submitted title was 'BeeWare - write Python, run as native | everywhere') | stavros wrote: | BeeWare looks great, as always, but my impression is that the | documentation/ecosystem isn't very extensive, so I've always been | loath to try it. In such an extensive toolkit, I think | ecosystem/community is important, as otherwise you'll be hitting | walls frequently that will be hard to get past. | onphonenow wrote: | Targeting windows is really interesting actually - Microsoft has | made such as a hash of the development story on Windows I'm | surprised more folks haven't made a run at that market. In my | case, I like rich local app -> remote data store. | | Does anyone know how well this performs on windows. | pininja wrote: | Does this have support for installing and linking to useful | native utilities, like GraphicsMagick? Python is such a good | glue. Sometimes I want to make a small GUI that combines great | python libraries with great CLI applications. | udbhavs wrote: | Looks like it might be possible but difficult on mobile: | https://docs.beeware.org/en/latest/tutorial/tutorial-6.html | | "On desktop platforms (macOS, Windows, Linux), any pip- | installable can be added to your requirements. On mobile | platforms, your options are a little more limited - you can | only use pure Python packages i.e., packages that do not | contain a binary module. | | This means that libraries like numpy, scikit-learn, or | cryptography can be used in a desktop app, but not a mobile | app. This is primarily because mobile apps require binary | modules that are compiled for multiple platforms, which is | difficult to set up. | | It's possible to build a mobile Python app that uses binary | modules, but it's not easy to set up - well outside the scope | of an introductory tutorial like this one." | pzo wrote: | This was actually a dealbreaker and blocker for me when I | last time tried BeeWare. I was hoping I will be able to do | some rapid prototyping with numpy + opencv-python directly on | my android or iphone. I wish there was at least some tutorial | how to make non-pure python modules. | | I had the same issue when investigating Kivy and PyQt. It | definitely seems possible since you can download Pydroid [1] | for android (that supports e.g. pyqt, opencv, tensorflow) or | Pyto [2] for iOS (that seems actually is based on BeeWare and | support many non-pure modules including opencv) | | [1] https://play.google.com/store/apps/details?id=ru.iiec.pyd | roi... | | [2] https://github.com/ColdGrub1384/Pyto ___________________________________________________________________ (page generated 2022-02-06 23:00 UTC)