BeeWare and the State of Python on Mobile
Episode Deep Dive
Guest Introduction and Background
Russell Keith-Magee is the founder and maintainer of the BeeWare project, an effort to bring Python natively to multiple platforms including iOS and Android. He is also well-known for his long-time involvement as a core developer of the Django web framework. In recent years, Russell joined Anaconda's open source team to focus on enhancing BeeWare's tooling, especially around mobile and cross-platform support, thereby expanding Python's reach beyond desktop and server environments.
What to Know If You're New to Python
If you're newer to Python and want to follow the discussion about running Python on iOS, Android, and beyond, here are a few things that will help you get more out of this episode:
- Python packages: Familiarize yourself with how Python libraries (often found on PyPI) are usually distributed and installed.
- Virtual Environments: Understand that most Python projects use virtual environments or other isolated approaches for running Python code. This is important when packaging and distributing apps.
- Cross-platform frameworks: Know that you can use Python for more than just server or data work, it also powers mobile and even web (front-end) solutions through special toolkits and frameworks.
- Basic packaging concepts: Terms like "wheels" and "build tags" come up a lot in the world of distributing Python code. Having an idea about these will help you follow along.
Key Points and Takeaways
- BeeWare's Mission for Native Mobile Python BeeWare aims to allow developers to create truly native Python apps across platforms, iOS, Android, macOS, Windows, Linux, and even the web. Rather than using a single UI layer everywhere, BeeWare adopts each platform's native widgets for a more authentic and accessible experience.
- Links and Tools:
- BeeWare.org
- DjangoProject.com (Russell's earlier involvement)
- Links and Tools:
- Toga: The Cross-Platform GUI Toolkit Toga is BeeWare's GUI library that provides a unified API for making native apps. Buttons on iOS look like iOS buttons, while Windows buttons appear as Windows buttons. This design choice means stronger integration with platform-specific features (like accessibility).
- Links and Tools:
- Briefcase: Packaging Python Apps for Distribution Briefcase helps Python developers convert a standard Python project into standalone, distributable apps on multiple platforms. It automatically handles tricky details, such as code signing on macOS and building APK files for Android, allowing you to "just click and run."
- Links and Tools:
- Official CPython Support for iOS and Android Russell and colleague Malcolm Smith authored PEPs making iOS and Android officially recognized platforms in CPython (Tier 3 support). This ensures that changes to CPython won't inadvertently break iOS/Android builds and helps unify how wheels and packages are handled on these mobile systems.
- Links and Tools:
- PEP 692 (iOS) and 693 (Android) (General PEP index)
- Links and Tools:
- Challenges and Opportunities of Running Python on Mobile Mobile devices are ubiquitous, yet historically challenging for Python. BeeWare fills an important role by making cross-platform development more realistic. With the finalization of these PEPs, library authors can publish iOS and Android-compatible wheels to PyPI, opening up more opportunities for Python to become the "go-to" language on mobile as well.
- PyScript and Emscripten for Web-Based Python While BeeWare targets native compilation, another interesting approach for running Python is PyScript, which relies on Emscripten and WebAssembly. Although performance and native capabilities differ from BeeWare's direct approach, these technologies complement each other, enabling a full range of Python usage, even in the browser.
- Links and Tools:
- Comparison with Other GUI Frameworks Frameworks like Kivy or WX Python do allow cross-platform UIs, but typically in a "write once, run everywhere (and looks the same everywhere)" style. BeeWare's Toga specifically aims for native UI widgets on each system. This is beneficial for users who want a more platform-consistent look-and-feel or rely on accessibility tools baked into each OS.
- Code Signing and App Store Submission Creating a polished, installable app for iOS or macOS means dealing with tricky requirements like code signing, notarizing, and aligning with Apple's ecosystem rules. BeeWare's Briefcase automates a majority of this burden, but it highlights a key complexity when building commercial or consumer-facing mobile apps in Python.
- The Anaconda Open Source Team and Sponsorship Russell noted how drastically project velocity improved once BeeWare received corporate backing: Instead of "a weekend hack," BeeWare turned into a full-time effort. This underscores that sponsorship and full-time maintainers can significantly enhance open-source software quality, especially in large and foundational projects like CPython and cross-platform tools.
- Links and Tools:
- Future of Python on Mobile and the Web From improved packaging support (wheels for iOS/Android) to broader integration with PyScript, the future points to a more universal Python experience. Toga and Briefcase are well on their way to being the mainstay for shipping Python-based GUIs on everything from phones and tablets to desktops and browsers.
Interesting Quotes and Stories
"If they need to know what Python is, I have failed as a developer." , Russell
"It's amazing how much progress you can make when you have two people working full-time on an open source project." , Russell
Key Definitions and Terms
- Tier 3 Support (CPython): This is a recognized but more provisional level of official support for a platform in the Python interpreter. It ensures daily tests and prevents breakage, but there is a smaller maintainer pool than, say, Tier 1 or Tier 2.
- Wheels: A standard built-package format for Python. Once built for a target (e.g., macOS-arm64, iOS), they allow for seamless installation of precompiled components via
pip
. - Emscripten: A compiler toolchain that compiles C/C++ (and thus Python's C core) to WebAssembly so that Python can run in the browser.
- Notarizing: A process required by Apple so distributed software is cryptographically "sealed" and verified to be from a trusted developer.
Learning Resources
If you're getting started with Python and need a solid foundation:
To explore more about the Python ecosystem on the web side (potentially interesting if you like bridging front-end experiences):
Overall Takeaway
The BeeWare project is pivotal for anyone looking to bring Python to iOS and Android in a truly native way. Thanks to contributions from Russell Keith-Magee and the Anaconda open source team, Python developers are closer than ever to delivering polished, platform-compliant mobile applications without sacrificing their favorite language. As these tools mature, Python stands poised to become a compelling option for developers wanting to reach every major platform, from the browser and desktop to smartphones and beyond.
Links from the show
PEP 730 – Adding iOS: peps.python.org
PEP 738 – Adding Android: peps.python.org
Toga: beeware.org
Briefcase: beeware.org
emscripten: emscripten.org
Russell Keith-Magee - Keynote - PyCon 2019: youtube.com
Watch this episode on YouTube: youtube.com
Episode transcripts: talkpython.fm
--- Stay in touch with us ---
Subscribe to Talk Python on YouTube: youtube.com
Talk Python on Bluesky: @talkpython.fm at bsky.app
Talk Python on Mastodon: talkpython
Michael on Bluesky: @mkennedy.codes at bsky.app
Michael on Mastodon: mkennedy
Episode Transcript
Collapse transcript
00:00 This episode is all about Beware, the project that is working towards true native apps built on Python, especially for iOS and Android.
00:08 Russell's been at this for more than a decade, and the progress is now hitting critical mass.
00:13 We'll cover the Toga GUI toolkit, building and shipping your apps with Briefcase,
00:18 and the newly official support for iOS and Android in CPython, and much more.
00:24 I can't wait to explore how Beware opens up the entire mobile ecosystem for Python developers,
00:29 So let's jump right in.
00:31 This is Talk Python to Me, episode 499, recorded February 18th, 2025.
00:37 Are you ready for your host, please?
00:40 You're listening to Michael Kennedy on Talk Python to Me.
00:43 Live from Portland, Oregon, and this segment was made with Python.
00:49 Welcome to Talk Python to Me, a weekly podcast on Python.
00:53 This is your host, Michael Kennedy.
00:55 Follow me on Mastodon, where I'm @mkennedy, and follow the podcast using @talkpython, both accounts over at Fostadon.org,
01:03 and keep up with the show and listen to over nine years of episodes at talkpython.fm.
01:08 If you want to be part of our live episodes, you can find the live streams over on YouTube.
01:13 Subscribe to our YouTube channel over at talkpython.fm/youtube and get notified about upcoming shows.
01:19 This episode is sponsored by Posit and Posit Workbench.
01:23 Posit Workbench allows data scientists to code in Python within their preferred environment
01:28 without any additional strain on IT.
01:31 It gives data scientists access to all the development environments they love,
01:34 including Jupyter Notebooks, JupyterLab, Positron, and VS Code, and helps ensure reproducibility and consistency.
01:41 If you work on a data science team where consistency matters, check out Posit Workbench.
01:46 Visit talkpython.fm/workbench for details.
01:50 Russell, welcome to Talk Python to Me.
01:52 Great to have you back.
01:53 Hey, thank you for having me again.
01:55 Yeah, it's good to have you back.
01:56 You've been diligently working away on Beware, and I am very excited to see what you all are up to these days
02:04 because I have very high hopes for the project.
02:06 I'm multiple angles.
02:08 I'm a fan.
02:09 Thank you very much.
02:10 Yeah, I have been very busy, particularly busy over the last couple of years,
02:14 but, yeah, we've made some good progress, and, yeah, we started to see the fruits of what is now at this point almost a 10-year –
02:21 well, it is over a 10-year project.
02:23 So you've been at it for a long time and it's been quite a while since I had you on the show
02:26 and Talk Python has been around for almost 10 years. And so I know you've been at it for
02:30 quite a while. That's awesome. And it seems like you're starting to get some real traction,
02:35 which it couldn't come soon enough.
02:36 Yes. And the good, the sort of the reason why that has happened is basically about three years ago, I was hired by Anaconda to work on their open source
02:46 team um so i am employed full-time just to work on beware uh with another guy malcolm smith who
02:53 works with me based in based in london um and yeah just like the short version is it is amazing how
02:59 much progress you can make when you have two people working full-time on an open source project and
03:02 like just a lot of stuff all the yeah yeah i've always thought that about things it's like there's
03:08 the main product or the main project of the main library and then there's all these little
03:13 not fun, annoying details that somebody just has to grind through. And when it's two hours in on a
03:18 weekend where you're excited about it, it's not the final push over the finish line, grindy details
03:23 that people want to do. And so when it's, I wake up today and we're pushing it forward every day,
03:28 it's awesome. Yeah. And a lot of it is also just like CPython is an awesome project, but it's a
03:34 big project and getting anything to happen. Like it's a, you've got to move a big project in the
03:39 direction of something, that takes a lot of political effort. It takes a lot of time. It
03:43 takes a lot of hanging around our mailing lists. And at some point, if you're just trying to do it
03:46 on like two hours on a weekend, that just doesn't happen. But if you can actually
03:50 say, okay, every morning I'm going to spend an hour responding to all the email that I've received about this
03:55 project, well, then you can do it. And then you can actually have a meaningful progress.
03:59 And then there's also things like, I don't use, I have no disrespect whatsoever for anybody who
04:05 uses Windows. I don't use Windows on a day-to-day basis. It is, as a weekend project, very hard to
04:10 get me excited about working on Windows app signing as a personal side project. And I am going to see
04:17 no benefit out of that whatsoever. But when I've got time for it, a lot of other stuff
04:22 becomes more plausible and more palatable as a thing to look at.
04:26 Yeah. I want to let you do an introduction for yourself real quick before we dive into it. But I
04:31 want to tie this back to PyScript a little bit as well. I think there might be some times that
04:35 align there.
04:36 There absolutely are. Yeah, I can imagine. So for folks who haven't listened
04:41 over all of the years and have a really great memory, tell us, who are you? What are you up
04:46 to these days? Give us a bit of a hint already.
04:48 So hi, I'm Russell. I am in days of yore, I was possibly better known for my contributions to the Django project. I was a very early contributor
04:57 or a member of the Django core team.
04:59 I don't do anywhere, well, I basically don't do any Django work at this point.
05:03 My interests have moved away from web stuff generally.
05:06 For about the last 10 years, I have been working on the Beware project, which is a collection of tools and libraries
05:14 to support building graphical user interfaces, native graphical user interfaces
05:19 in Python and targeting that at desktop platforms, so Windows, Linux, macOS,
05:25 but also mobile platforms, iOS and Android, the web as a GUI user interface,
05:32 and more recently also TextUID, the console-based applications.
05:35 Working on the premise that every platform has a concept of a native interface.
05:41 Now, there is a concept of a button on all of those platforms.
05:45 How you access that button is different on every platform.
05:48 And Beware's goal is to, one, put a clean interface around the outside of that
05:54 so you can have a common API for, I just want a button on the screen so when I push the button, the light goes Bing.
06:00 One, provide a common cross-platform API for that.
06:02 And then two, provide the mechanisms to say, okay, I have written my machine
06:07 that goes Bing with a button.
06:08 I want to give it to someone and I want to give it to them using the platform's app infrastructure.
06:16 I just want to have it on this person's iPhone or give it to a Windows user
06:21 and have them just run it without having to go through, okay, well, first you've got to set up
06:26 a Python virtual environment, and then you've got to pip install it.
06:29 Are you familiar with the terminal?
06:32 Why don't you become familiar with the terminal?
06:33 We'll start there, yeah.
06:35 From my perspective, there are absolutely, as a developer, I need to know that.
06:40 As a Python user, I need to know how that stuff works.
06:43 If I have written a program and I want to give it to someone, if they need to know what Python is, I have failed as a developer
06:50 because as an end user, they don't care.
06:53 They just want to spool the app the same way as everything.
06:56 They want to double click on an icon and make the thing work.
06:59 And that's the other part of doing it.
07:01 That's awesome.
07:01 And I would say if it's not possible to have a little colorful, native-looking icon, either in your dock, in your taskbar,
07:10 in your app launcher on your phone that you touch, and the thing comes to life,
07:14 that's not a real app delivery platform.
07:16 Yeah, it is a very powerful language with which you can do all sorts of incredible things.
07:21 But at the end of the day, you've got to give that thing to someone to do it
07:24 without giving them a three-year degree in computer science before they can actually do the damn thing.
07:29 Sure.
07:29 And even if they can, they might not want to, right?
07:32 Yeah, exactly.
07:32 I don't want to do that.
07:33 It's a barrier.
07:34 Yeah, yeah.
07:35 I love my web browser.
07:36 I don't want to start it that way.
07:37 Yeah.
07:39 Yeah, so the extension of that then is that particularly for the web, for iOS and for Android,
07:47 there's kind of the foundational question then of, well, okay, but how do I run Python on that device at all? You
07:53 know, how do I get Python on my iPhone?
07:57 And I don't just want to have like a Python interpreter on my iPhone because
08:01 you don't like the, an iPhone, everything is inside an app.
08:04 So I need to have it inside my app. How do I get it inside the app?
08:06 And then when it's inside the app, how do I invoke the code that's there and so on and so on.
08:12 So a lot of the work that's kind of been leading up to this point is like
08:16 literally how to make cpython work on ios how do i make cpython work on android how do i make cpython
08:22 work in the browser um right so yeah that's awesome a very very interesting and powerful goal i think
08:29 let's not talk about it just yet but i think it's gonna it's it's really it leaves python open to
08:35 being not the default choice even though it's a really great programming default choice language
08:40 somebody says i want to i want to get started programming awesome you should check out python
08:44 yeah i want to build an app you shouldn't check out python right like you don't want that to be the
08:48 the answer right and this path that you're you're making you're hacking away
08:53 in the forest forest yeah exactly one of the one of the stimulus for me working on this there was a couple
09:00 but one of them is that my son who is now first year university but at the time when i was sort
09:04 of starting it was you know late primary school um was starting to look at how to program and the
09:11 device that he had at school was an iPad. And he says, okay, well, I'm learning to program. Great.
09:17 How do I build an iPad app? Well, you don't. Like, it's complicated. Like, maybe.
09:23 Have you heard the story for it? It's kind of complicated.
09:26 It's learning. Then you say, okay, well, but I'm learning Python because Python is a good
09:32 language for teaching people how to program. Okay, well, now I want to write that iPad app.
09:39 Yeah, but you can't.
09:40 So maybe you've got to learn a different language for that.
09:42 But I don't want to learn a different language.
09:44 I've only barely got my hands around Python.
09:45 Why do I have to learn another language just to be able to have an app there?
09:49 So there's a running sort of semi-joke that goes around that Python is the second best language for everything.
09:55 And part of it being the second best language for everything is that it needs to be able to do all these things,
10:01 maybe not as well as Swift on an iPhone or Coughlin on an Android machine or whatever,
10:08 but well enough that you can get something going.
10:11 Yeah, I would be well happy to say it takes an extra 5% of my battery compared to a regular app.
10:16 They use a Python app.
10:17 I don't care.
10:18 It's fine.
10:19 But it's not that.
10:20 It's possible, impossible.
10:22 Right?
10:23 That's not a great divide.
10:24 All right, before we dive into this though, you mentioned that you work on the open source team at Anaconda.
10:30 So I want to give you a moment to talk a little bit about what that is.
10:33 I had Peter Wang on the show not too long ago and he's always super fun to talk to.
10:38 And I know that they're putting a lot of support behind PyScript.
10:43 And it sounds like the timing of releasing PyScript and all that is a little bit aligned with when you joined.
10:49 Yeah, so maybe talk to us a bit about all this.
10:51 Yeah, so Anaconda took a round of funding a little over three, almost four years ago,
10:57 I think at this point.
10:58 And part of that was to sort of really start doubling down on the contribution of open source.
11:05 Anaconda is a company who is built upon tools that are open source, most notably Conda, but that's not the only piece of it.
11:15 Conda is an open source project.
11:17 Someone needs to maintain it.
11:19 Anaconda is able to make money selling this open source product, this whole Python ecosystem, into Fortune 500 companies who need all sorts of legal compliance and standards compliance and security reporting and all that kind of stuff.
11:33 that your student doing a high school computer programming degree doesn't care about, but
11:38 the big end of town does.
11:40 Anaconda is able to make money out of that, but recognizes that the only reason they're
11:45 able to make money doing that is that there is this open source foundation, that Python
11:49 is an open source ecosystem.
11:51 And unless people are maintaining that stuff, Anaconda is not going to have a company in
11:57 a couple of years because everyone's going to move away from Python or do other things
11:59 or find other ways of solving problems.
12:02 And, you know, that ultimately is bad news for Anaconda.
12:05 The other side of it, and sort of the reason why PyScript is interesting, why Anaconda
12:10 is supporting iOS and Android work, is that there is an opportunity here to just literally
12:15 make the pie bigger.
12:16 That if Anaconda, you know, if someone can come in and say, oh yeah, I want to write
12:20 my, you're at a Fortune 500 company, I want to write my app, I want to write it in Python.
12:24 Okay, well now I can do it at iOS and Android.
12:27 There's now more users for Anaconda's products as a result of this investment that's been
12:32 in iOS and Android to make it possible at all.
12:35 It is very much a long-term project.
12:37 But like this is iOS and Android stuff.
12:39 Conda as a project does not have particularly good support for iOS and Android.
12:43 Eventually, hopefully not that far off, it will.
12:47 But you don't get to Conda supporting it until Python supports it.
12:51 And you don't get Python supports it unless someone sits down and actually does the hard work
12:55 to make that happen, which is essentially what I was hired to, myself and Malcolm, who had to do.
13:00 And PyScript fits in a very similar boat.
13:02 The web is undeniably a platform that is everywhere that you can't run Python in, or you couldn't run Python,
13:08 or it was very hard to run Python in.
13:10 And PyScript as an effort is essentially saying, okay, let's make it as straightforward as possible
13:16 for me to just drop some Python into a browser and do web user interface stuff
13:22 where instead of having to learn JavaScript and learn a whole new ecosystem
13:25 and learn a whole bunch of new set of tools, I can just use Python and open up.
13:30 that whole other ecosystem of places where you can run Python code as another place where you
13:36 might want to do things.
13:37 Yeah. And to give people a sense of what's possible with PyScript, it's very, very interesting. On iOS and also on Android, I'm sure I just haven't tried it,
13:47 you can create progressive web apps and then say, save this to my home screen. And when it launches,
13:52 it looks like a native app, but you can't really tell that it's not a native app.
13:56 I put together a sample when PyScript first came out that had an offline or offline capable PyScript, all Python written app.
14:04 And it was talking to some APIs out on the Internet.
14:07 And even just those early stages, it was like, wow, this really makes things possible.
14:12 The challenge is, I mean, this is the big challenge, is people don't discover apps on their mobile devices through progressive web apps, right?
14:21 Hence your project, right?
14:23 They go to the app store and they click get or buy, and then it shows up on their device, right?
14:29 It's kind of like back to like, well, if you could create a virtual environment,
14:32 you could run this thing.
14:33 If you can create a progressive web app, I'm a huge fan of them, but my fandom doesn't change people's
14:39 behavior, right?
14:40 Sure.
14:41 But there is also like to defend my own project here, like I'm a big fan of PyScript.
14:46 I love what they're doing.
14:47 There are limits to what you can do in a progressive web app.
14:49 Those limits are getting extended further and further out, But there are things that
14:53 if you want to have access to the entire capabilities of your device directly at the hardware layer, you can't do that in a progressive web app.
15:02 You can only do it if you're actually writing to the native APIs and you've got direct hardware access.
15:09 The web browser sandbox does place some limits on what you can do.
15:15 Do those limits matter?
15:16 That's an open question.
15:17 there are a lot of things that probably should be progressive web apps that are, you know,
15:21 or that could be progressive web apps.
15:24 But that doesn't mean that there's no market for native apps or that PyScript is like,
15:29 PyScript is eventually going to make, you know, Beware or native apps completely irrelevant.
15:33 Because there is...
15:33 No, it absolutely won't.
15:34 Yeah.
15:35 And the other thing is that they actually do complement each other really well.
15:38 Like, Beware does have a PyScript web backend or PyScript-based web backend specifically
15:44 so you can say, okay, I want to build an app.
15:47 it has a button and when I press it, the dialog button, my dialog box pops up.
15:51 Nothing about what I just said dictated whether it was a web browser or an iOS app or a desktop app.
15:57 I can render that on all of them and then say, okay, well, it starts as a progressive web app because that's how I want to do it
16:02 and then I'm going to spend a little bit more effort and actually make it into a native app and get it into the iOS app store.
16:07 You can progress along that chain without cutting off any options.
16:13 Yeah.
16:13 Oh, I think your project, the native app side is critical.
16:17 I just think there's also a bunch of people out there that say, well, I'm going to build a front end, interactive front end and have a bunch of Django REST framework or something on the back end.
16:25 So I'll use React or I'll use Vue.
16:27 And why isn't the answer Python, right?
16:29 It really, really could be Python.
16:31 That's kind of, I think, where PyScript has a lot of possibilities.
16:35 This portion of Talk Python to Me is brought to you by the folks at Posit.
16:39 Posit has made a huge investment in the Python community lately.
16:42 known originally for RStudio, they've been building down a suite of tools and services
16:46 for Team Python. Have you ever thought of all the things that go into a Python data science project?
16:53 You need your notebook or IDE, sure. Also a server or cloud environment to run it,
16:58 a version of Python, packages, access to your databases, and internal APIs. That's a lot of
17:03 setup. And if you change any of these things, when you return to your projects a month down the road,
17:08 you might get different results. Wouldn't it be nice to have all of this set up for you in one
17:13 easy to access place whenever you want to get work done? That's the goal of Posit Workbench.
17:19 Posit Workbench allows data scientists to code in Python within their preferred environment
17:24 without an additional strain on IT. It gives data scientists access to all the development
17:29 environments they love, including Jupyter Notebooks, JupyterLab, Positron, and VS Code.
17:34 and yet it helps ensure reproducibility.
17:37 Here's how it works.
17:38 You or your IT team set up Posit Workbench on a powerful, dedicated server within your organization
17:44 or on the same cloud service that is hosting your most important data sources,
17:48 such as AWS, SageMaker, Azure, GCP, Kubernetes, or pretty much anywhere.
17:54 There, you create dedicated, pre-configured environments to run your code and notebooks.
17:59 And importantly, you also configure access to proprietary databases and internal APIs.
18:05 When it's time to onboard a new data scientist or start a new project, you just fire it up in Workbench and it's fully configured and ready to go, including on the infrastructure side of things.
18:14 All of this is securely administered by your organization.
18:18 If you work on a data science team where consistency matters, you owe it to you and your org to check out Posit Workbench.
18:24 Visit talkpython.fm/workbench today and get a three-month free trial to see if it's a good fit.
18:29 That's talkpython.fm/workbench. The link is in your podcast player's show notes.
18:34 Thank you to Posit for supporting Talk Python To Me.
18:38 I think that brings us a little bit to one of your keynotes from 2019, where you talked
18:42 about Black Swan events, right?
18:44 Yes.
18:46 It's a little bit of the same story, but maybe give people a sense of this and we can link
18:49 to this keynote if they want to explore that side of things more.
18:52 Sure.
18:52 Yeah.
18:53 So the idea behind a Black Swan event was Nicholas...
18:58 Nassim Talib, I believe it was.
19:00 Nassim Talib, that's the one.
19:01 Yep.
19:01 I forget his name.
19:02 but he identified this idea of what's called a black swan event.
19:07 The reason I use this is I'm from Perth and black swans come from Perth.
19:10 So it was an interesting little tie-in for an international keynote.
19:13 You guys actually have black swans all over?
19:15 We have them.
19:16 The state emblem of Western Australia is a black swan.
19:19 Like that is literally on our flag.
19:23 So the theory was that the Dutch bumped into Western Australia accidentally looking for the Spice Islands in the 1600s.
19:31 And at the time they did that, they knew with absolute certainty that all swans were white.
19:37 And then they bumped into Western Australia and they discovered that all the swans here are black.
19:42 The idea behind a black swan event is a thing you don't see coming that completely changes your view of the world.
19:50 And black swan events are the sorts of things that completely change markets.
19:53 We don't know what, if you're not looking, if you're not ready for a cataclysmic change in your ecosystem, then the change happens and you are left behind.
20:05 I would say COVID is a good example of what hit people.
20:10 Another one's AI.
20:11 Yeah, AI is still, how is that going to impact?
20:14 It's just a little bit less clear.
20:16 And COVID, we're kind of seeing the impacts of that, whether that's going to have long-term impacts.
20:21 like it's some of those things seem to be kind of fading away.
20:24 But the one that I, yeah, well, yeah, mostly.
20:28 I mean, people, I mean, people still get to say, but like the, the world has shut down and
20:33 will we, will economies just disappear?
20:36 Level of, Oh my gosh.
20:37 It's kind of, that's the history I was thinking of.
20:39 Yeah.
20:39 I, the one that I was highlighting for, for, for Python is that Python is a programming language,
20:46 but it's a programming language that has historically assumed, well, you're running on a laptop,
20:49 right?
20:50 Like that's where you run computer code.
20:51 you always run computer code in a laptop. And then iPhones turned up. And now we've got computing in
20:56 our pocket that is as powerful, if not more powerful than the laptops that we had on our desk
21:01 10 years ago. And Python can't run there, or at least at the time, couldn't really run there.
21:07 So what does that mean for Python? Why am I going to learn Python? If the computing ecosystem moves
21:13 to a world where everybody's using phones and tablets, and I can't run Python on a phone or a
21:18 tablet, why am I going to learn Python? Python as an ecosystem has an existential risk there
21:23 because of this black swan of a change in the way people do computing.
21:29 And at the time I gave that keynote, what I was essentially saying is, okay, as an ecosystem, we need to take a long, hard look
21:35 at ourselves. It's impossible to know what the black swan events are going to be, but we can look
21:40 at where the ecosystem is now. We can look at the trends of things that are happening and we can work
21:44 out institutionally what are our risks, like what would need to change to make Python a
21:52 dead ecosystem.
21:54 And the obvious one, the one that I was really pushing at that time, one of which is platforms
22:00 that we need to support.
22:00 And the second is how do we support this software going forward?
22:04 How do we actually guarantee that this community-driven project continues to be maintained?
22:10 Because if we don't have maintainers, then the code doesn't get written.
22:14 So, yeah.
22:15 Yeah, excellent.
22:15 I recommend people check it out.
22:17 It's on YouTube.
22:17 I will link to it.
22:19 It's scary the last five years ago.
22:21 I know.
22:22 I feel like that was pretty recent, but no.
22:25 No, that was the last one before COVID, by the way, bringing it full circle.
22:29 Tommy out there asked in the audience, is in the iOS Pythonistas app, I had some really good simple use cases in the past.
22:35 The GUI layer, a bit of a hassle, but like the library modules, also could not call some not yet exposed APIs.
22:42 I guess as we get into this, maybe think, just people probably know about the Pythonista app.
22:47 I don't know.
22:49 Yeah, it was around.
22:51 And it's not the same idea.
22:52 It's not what you guys are trying to do.
22:54 Yes and no, because I actually worked on Pythonista.
22:57 The reason that Pythonista supports Python 3, I was contracted to do the Python 3 port.
23:02 So the core of that library is essentially the thing that Beware was doing.
23:05 And the reason it was able to move to Python 3 was because of the work that I was doing.
23:10 It is, yeah, it is very much sort of the Pythonista as an idea is kind of what if idle, but on a phone?
23:18 Like here is a development environment where you can write Python code.
23:22 You have some access to some libraries and some GUI libraries.
23:27 So you can put a button up, but you're not writing, you're not using Pythonista to write an app.
23:33 You're using it to put an interface into a running Pythonista sheet, you know, working
23:40 environment.
23:41 It is absolutely a way to write Python.
23:44 It is a way to have Python running on your phone.
23:48 But it is not something that's going to push something to the iOS app store so that random
23:52 other person can buy your app.
23:55 You know, to me, it feels a little bit like shortcuts on iOS in that you could kind of
23:59 put together some behaviors, but you would never try to make an app.
24:02 yeah that's it's not that's not too far from it and it except that it's all inside the sound
24:07 yeah and you could do real python which is way better than shortcut but the kind of the type
24:12 of thing you accomplish it feels a little bit like i can go find this thing and run it and it'll do
24:16 something for me which is cool but yeah it's not going to be the new airbnb implementation no
24:22 exactly and like even like i guess beware as a project isn't it the intention is not that it would be
24:29 the next Airbnb as a final product.
24:33 It might, however, be the mock-up of the demo app that you take to your initial seed funding round
24:40 to prove, here is the idea we've got.
24:43 We've proved it out with some people, just like a small little sample trial, whatever.
24:47 Now give us the money to go and actually hire a team of iOS developers and a team of Android developers
24:51 to build an absolutely kick-ass, optimized native application of every platform.
24:57 Yeah, maybe a little bit like Playgrounds Well, perhaps in that regard.
25:02 Yeah, a little bit, I guess, like Playgrounds, yeah.
25:04 Yeah, also a different focus.
25:05 But another comment maybe as we dive into this, Joe out there asks us, hey, great project.
25:10 How would you sell this to us?
25:12 And that there's a few other frameworks like WXPython, Kivy.
25:15 WXPython also renders data of GUIs.
25:18 How would I sell it?
25:20 Okay, says he, pulling out the sales sheet.
25:23 Let me get my pitch deck.
25:24 Hold on.
25:25 So there's essentially two questions there.
25:27 One is WX Python and one is KIVI.
25:31 The KIVI is a sort of the two different reasons.
25:35 KIVI does work on iOS and Android and also on the desktop platforms.
25:39 KIVI is taking a very, very distinctly different approach to user interface design.
25:44 So KIVI can run on all those platforms, but the user interface that it puts up is a KIVI
25:49 user interface.
25:50 It always looks like KIVI.
25:51 And it's like if you build a macOS app, it will look the same on Windows.
25:56 It'll look the same on GDK, and it will look the same, you know, size of window notwithstanding.
26:00 It will look the same on iOS and Android.
26:02 That is a completely viable way to build apps.
26:06 It is not a native user interface.
26:10 And one of the major reasons that I dislike that as an approach, I'm not in any way saying that Kibbe is a bad project.
26:17 It is a different way to build user interfaces, and I prefer a different approach, which is to say an actual native button.
26:23 So on macOS, it looks like a macOS app.
26:26 On iOS, it looks like an iOS app.
26:28 On Windows, it looks like a Windows app.
26:32 The downside is that if you need to take screenshots, you've got to have an iOS screenshot
26:36 and a macOS screenshot and a Windows screenshot.
26:39 The benefit is consistency with the rest of the platform.
26:43 And that might seem like a totally cosmetic thing, but one, consistency between applications
26:50 is a mode of user interface discovery because if people know this is how a button works on MacOS,
26:56 they know how your platform does it as well, how your app does it as well,
26:59 rather than having to discover how you have decided to implement menus or buttons or anything else.
27:05 Yeah, one of the really things that stands out, I think, super stark a lot of times is the file open save dialogs.
27:10 Yes, yes.
27:11 It's like, whoa, this is clearly just alien versus...
27:15 Yeah, and a lot of cases, they are missing the one thing on my platform that makes file dialogues actually useful
27:22 because I can do this thing that I can't do in your dialogue because you've had to build it from scratch.
27:27 And speaking of building from scratch, the other big benefit of a native GUI
27:31 is that you get all of the platform's native affordances.
27:34 One of the most surprising things, it wasn't necessarily surprising because I understood why I was doing it,
27:39 but things that might be surprising to people who haven't followed along GUI development,
27:43 we have received an inordinate number of very, very enthusiastic comments
27:48 from blind people writing iOS apps.
27:52 Because an iOS app built with Beware fits in directly with screen readers
27:58 because it is using the platform's native accessibility.
28:02 Kivy has not built explicitly native screen reader support into their widgets.
28:06 To the best of my knowledge, or at least all the reports that I'm getting
28:09 are saying that it's not there because you have to build it from scratch
28:13 on every platform and they haven't done that.
28:16 It's a lot of work.
28:17 I'm not underselling how big of a project it is, but Beware got it for free because we are using native widgets,
28:24 and that's not an insignificant consideration.
28:28 That's Kivy.
28:28 Oh, sorry.
28:29 No, no, please go ahead.
28:30 No, I was going to say, that's the Kivy.
28:32 So that's the not native user interface but looks the same everywhere versus Beware's using native widgets everywhere.
28:38 The other argument is, okay, but why don't you use WX Windows?
28:41 The reason we don't use WX Windows is WX Windows doesn't run on iOS or Android and trying to make it run on iOS and Android.
28:47 Like I did look into it and it was a little bit crunchy.
28:50 Qt apparently works on iOS now.
28:53 It didn't when I started the project, but they very much don't want you to write Python.
28:58 And one of the things that Beware is trying to push and Toga as a GUI platform is trying to push
29:01 is you're writing Python code.
29:03 It looks like Python.
29:04 It tastes like Python.
29:06 If you don't want to write Python, that's fine.
29:08 There are plenty of GUI toolkits out there that don't require you to write Python.
29:11 But Toga is a Python first GUI toolkit.
29:14 And it looks like, tastes like Python, we support, we use, actively use in APIs, iterators and generators and asyncio syntax and context managers.
29:25 Things that WX Windows as a light wrapper around a C++ framework doesn't really expose because they are limited by what C++ looks like when you program it.
29:37 And you also get that to a certain extent in QT as well or PyQT.
29:42 Yeah, they're both wrappers.
29:43 Interesting.
29:44 So let's talk about some of the peps that make this possible, right?
29:48 Yeah.
29:49 There's the foundational, basically adding platforms as a intentionally supported platform
29:56 to the CPython whole process, right?
29:59 The core developers working on it from the builds and the deployments and all those kinds
30:03 of things.
30:03 And so you've got a couple of peps where you're the author of them, which is awesome.
30:08 I'm strictly the author of one.
30:10 Malcolm Smith was the author of the Android one.
30:11 Oh, okay.
30:12 Got it.
30:13 One Android with Malcolm and one iOS with you.
30:16 Okay.
30:16 I see which side fence you come down on.
30:18 I got it.
30:18 Yep.
30:19 No, no, no, no.
30:20 That's all good.
30:20 I'm with you.
30:21 I'm with you.
30:22 All right.
30:22 Tell us about these peps.
30:23 What role do they have?
30:25 And their status is final.
30:27 That's good.
30:29 So, yeah.
30:29 So, the PEP was essentially formalizing the things that Malcolm and I have been maintaining
30:36 independently, both of us, at the time for like about eight, nine years.
30:41 We had patches.
30:42 like I was maintaining a set of patches to make CPython run on iOS, and I was manually maintaining all those patches.
30:48 And every time a new Python release would come out, I'd have to go and sit down and spend, you know,
30:53 a couple of months trying to work out, okay, what have they changed this time?
30:56 And, you know, getting all of those, updating all of the PR, all of the code to make it work on a new version of Python.
31:04 In the 3.13 timeframe, so it's, what, September of 2023, I went along to the CPython core team summit in the US.
31:18 Sorry, it was in Bono.
31:22 And basically with the intention of, I want to upstream all these patches.
31:26 We've got these patches.
31:27 They're not huge.
31:27 They're big, but they're not huge.
31:29 I'd like to formalize that.
31:30 And so the outcome of that was what we need is a PEP.
31:32 We need a formal description of what it is you're going to do, why it's going to change,
31:37 what impact that has on the rest of the ecosystem for you to do that, and to formalize a couple of the little details
31:45 that need to be formally specified in order for the rest of the ecosystem
31:49 to play nice with this.
31:50 Little details like, what does sys.platform return on an iOS machine?
31:54 Like it's a really minor detail, but it's a question you've got to answer.
31:58 And it's like, it's an answer that even Apple Darwin is probably wrong.
32:01 Well, yeah, that's the thing. Like it's Darwin on macOS for some historical reasons, but like even
32:05 on iOS, should it be iOS? Should it be iOS capitalized? Should it be iPhone?
32:10 Should it be iPhone OS?
32:12 Should it be iPhone OS or iPhone simulator?
32:14 All of these are answers that Apple itself uses at various points in their API.
32:18 And what about iPad?
32:20 Well, an iPad is iPad iOS.
32:22 Is that a different answer?
32:23 And so on.
32:24 And then the one that really matters for that is nailing down what is the platform tag that will be used for packaging purposes?
32:32 So when a wheel, a binary wheel, eventually lands on PyPI, what's the tag?
32:38 Like what is it?
32:40 For macOS, it's a macOS X underscore 11 underscore ARM64.
32:44 Okay.
32:45 What is it for iPhone?
32:46 Yeah, maybe we could elaborate.
32:47 Maybe you could elaborate just a little bit on like what that even means, right?
32:50 Because before Wheels, things were different.
32:52 You would download it.
32:53 You would build it.
32:54 You'd have to have Fortran or some random thing.
32:56 Wheels solved that, but that then created a combinatorial explosion of binary assets,
33:00 right?
33:01 Why does that matter?
33:02 Why does that matter?
33:02 So the major change with wheels is that it moved from a world where installing a Python package required you to execute code at time of installation.
33:15 And that's not a good idea from a security perspective because you then need to audit all of the code that's going to execute when you install the package.
33:26 And you can't find anything out about the package without running that code or at least auditing the code that's going to run.
33:34 Wheels provides you to say, okay, this is a wheel is basically just a zip file with a bunch of known metadata that describes exactly what is in here.
33:44 But part of that specification is also a binary specification that says, what version of CPython is it compatible with?
33:50 What version of the operating system is it compatible with?
33:52 What CPU architecture is it compatible with?
33:55 So that if I look at a wheel that is labeled, for example, macOS 11.0 ARM64, I know that this will run on macOS 11 with an ARM64 CPU.
34:07 There are any number of these tags available.
34:09 And there's differences like the Universal 2, which will support both x86 and ARM.
34:15 And on Linux, there's a thing called a mini Linux wheel, which is a specification for specifically what API guarantees does this Linux platform guarantee in terms of what is available in the CPython, in terms of the C library, the GNU C library, et cetera, et cetera.
34:34 You have to be able to specify that so that I know when I get this wheel, I know where it will work and how it will work.
34:39 And for the point of view of PIP, pip knowing which version should I download?
34:44 I've got an app here that I'm running on my macOS machine.
34:47 Which wheel should I download?
34:49 Go and grab one and resolve it and find out and solve that question.
34:52 Yeah.
34:52 So without knowing that answer, you don't know how to install wheels, basically.
34:57 Correct.
34:57 Part of the wheel specification is which – if the wheel contains all the pre-compiled components, in order for it to have pre-compiled components, there's an API or an ABI specification there of exactly what symbols am I going to be able to link against?
35:12 What can I assume exists?
35:14 Will this run on my machine?
35:16 Yeah.
35:17 What's going to happen, right?
35:19 Is it even compiled from architecture?
35:21 And we have a similar thing with Python standalone builds that is now part of Astral, which is really great.
35:26 we can just grab the Python we need because we know the platform tags and all that kind of stuff.
35:30 Any difference about the Android one?
35:33 I mean, you obviously need one for each platform, I suppose.
35:36 We do, yeah, basically.
35:38 And there will be at some point in the hopefully not too distant future,
35:40 there will be one for Inscripten as well, just formalizing Inscripten support,
35:45 which is the Pyodide slash PyScript in the browser version.
35:50 Yeah, you need to have one for every platform.
35:53 I guess the one notable difference between iOS and Android as a PEP is that in theory,
36:00 CPython 12 could compile on Android.
36:04 There were some patches which had been applied without going through the formal PEP process
36:08 on the basis of, well, it doesn't cost us anything to add this code in.
36:13 We're not guaranteeing it's going to work, but it's not breaking anything.
36:16 So we might as well have it there.
36:17 And so there's one, like the process of formalizing it did change one notable thing,
36:25 which is that previously, if you were able to get Sys.platform to compile on Android,
36:29 and it was possible and realistically it needed some patches, but it could be done,
36:33 Sys.platform would return Linux.
36:37 Because technically it is, but not in a way that's even remotely helpful to anyone.
36:43 And so one of the things that the PEP specified, like, yes, it is a Linux kernel,
36:48 but Linux doesn't help you there because nothing about an Android machine
36:52 actually behaves like Linux once you're past like the kernel level.
36:57 The rest of the thing is what you actually care about.
36:59 And the rest of the libraries you can guarantee is what you care about.
37:02 And so one of the things that the PEP had to specify was, okay, we are changing what sys.platform means on Android
37:10 because you need to be able to differentiate I am on an Android machine, not just a desktop Linux box.
37:18 And so, yeah, so that was one notable change.
37:20 It was in that PEP that wasn't in the iOS one.
37:23 Interesting.
37:23 You mentioned mScripten.
37:25 What an interesting project.
37:27 Yeah, it almost looks like it's not AI because it's LLVM, but it has nothing to do with it.
37:33 Yeah, yes.
37:33 It's a different set of LLs altogether.
37:37 Yeah.
37:37 So inscription is kind of the tail end, the current manifestation of a long series of
37:47 developments that started like 15 years ago.
37:50 Someone worked out that modern web browsers have spent so much time optimizing the JavaScript
37:59 compilers that there are certain JavaScript constructs that map almost one-to-one to machine
38:06 code.
38:06 Like you can say, okay, add these two integers in JavaScript or to these two numbers in JavaScript that if you know the numbers are integers, will map through the JavaScript jits that are running.
38:21 It will map to a literal, you know, add instruction on your CPU.
38:25 Like two registers coming together.
38:27 Yeah, two registers coming together.
38:28 And so if you restrict yourself to handwriting just that subset of JavaScript, you can essentially write assembler in JavaScript.
38:40 Now, in practice, nobody can actually do that because it's just way too constraining to know that you actually have to put the brackets around the outside of here or else the jit won't optimize it in just the right way.
38:52 But that's what compilers are for.
38:53 Compilers are really good at taking a set of arbitrary input and following a set of arbitrary rules to produce a consistent set of output.
38:59 And so this thing called ASM.js was born, which is essentially an input format that could be compiled to a JIT-able version of JavaScript that would run as a native platform.
39:10 And then from that, you can then get to WASM, which is WebAssembly, which is a formal text specification of the sort of things that ASM.js was working on.
39:18 And then Inscripten is a compiler tool chain that plugs into LLVM.
39:23 So if you've used a compiler like Clang, it is essentially a wrapper around a set of compiler building tools that produces output.
39:34 So you are used to calling GCC or Clang on a C program.
39:39 Clang calls into your C program, compiles it into an LLVM format, and LLVM converts it into actual runnable executables.
39:49 And so it's an LLVM plugin that instead of spitting out macOS-compatible binary executable assembly, it spits out WASM.
39:59 It spits out JavaScript-optimized code that can run in the browser.
40:03 That's all very much high level.
40:05 There's a lot of very, very complicated details that go on in the internals.
40:08 But the end point is that Enscripten lets you take any arbitrary C code and compile it to
40:14 JavaScript that will run in a browser at nearish native speed.
40:19 Good news is that CPython is written in C.
40:22 And so you can compile CPython into a JavaScript version or into this JavaScript subset, and
40:27 it will run in the browser.
40:29 There's a bunch of other stuff you need to do as well.
40:31 And Enscripten is providing a bunch of other things like guaranteeing a bunch of Unix system
40:35 calls are available.
40:36 But broadly, that's the idea here.
40:38 So you can take any C code and have it run in the browser.
40:41 And at that point, Python is just C code.
40:44 So all of a sudden, yeah, but the best news is because the browser is everywhere, because
40:49 JavaScript interpreters are everywhere, you've now got cross-platform binaries.
40:53 You've got a format that you can compile to once, and it will run pretty much everywhere
40:59 because existentially, every platform that matters has a web browser now, which means
41:03 it's got the ability to run JavaScript.
41:05 And so JavaScript becomes this cross-platform format without ever actually being JavaScript the language.
41:12 It's just kind of exploiting some weird quirks of the way JavaScript works as a language.
41:16 It's like saying you never write assembly, but kind of still do machine instructions.
41:20 But you're always writing assembly.
41:21 Yeah, exactly.
41:22 There's a really, if you go back, oh gosh, 12, 13 years, Gary Bernhardt gave a talk at PyCon
41:29 called The Birth and Death of JavaScript.
41:32 So good.
41:33 It was so good.
41:34 It is hilarious.
41:36 At the time, it was just straight up, oh, this is a funny gag, except that he has accurately predicted the next 15 years
41:43 of software development in terms of the way everything has gone.
41:46 And I've never spoken to Gary about it, so I don't know how much of this was just for the giggles
41:53 and how much of it was accurately like this is where things are going.
41:57 But as it turns out It was both really, really entertaining and really technically well-presented
42:04 and predicted, like you said.
42:05 Yes.
42:06 It's something.
42:07 And for people who are not familiar with this stuff, like one of the examples he showed,
42:10 I don't know if he came up with it or he was just quoting and showing it off,
42:13 but somebody took Mozilla Firefox, I think, and compiled that into Scriptum,
42:18 was running inside of Chrome, but then inside the embedded, Firefox was running like Doom compiled,
42:23 Doom Scriptum or some crazy 3D.
42:26 I mean, it was wild.
42:27 Yeah.
42:27 The list of things you can do once you've got the ability to compile C is truly phenomenal,
42:35 purely because the C compiler toolchain for all of the flaws of C as a language, C is
42:43 lingua franca.
42:44 C is where everything is done.
42:46 And we're now kind of removing, like the whole thing with LRVM is essentially we're removing
42:50 C from the front end, letting you put any language you want on the front.
42:54 But now we can use the same toolchain to target any platform we want.
42:57 And so you divorce the specific language from the tool chain that is producing platform-specific binaries.
43:05 Nice.
43:05 All right, let's talk about some of the projects and get some updates on them.
43:08 I know it's been a while.
43:09 And, you know, you've got a lot of support from Anaconda, which, you know, thank you again.
43:15 Yes, absolutely.
43:16 That's awesome.
43:17 So we'll maybe touch on some of the high-level or most important ones.
43:20 Toga?
43:21 So Toga, the cross-platform GUI toolkit.
43:24 So this is the analog of a Kibbe or a QT or a WX Windows.
43:30 It's the API that lets you say, I want a window that has a button.
43:33 And when I press the button, the light goes off, whatever you want it to do.
43:37 Put this text in the label or whatever.
43:39 Exactly, exactly.
43:41 So it is cross-platform, pure Python, runs cross-platform.
43:47 And by cross-platform, I mean all the desktop platforms, so Windows, macOS, Linux with GTK.
43:53 It runs as a web.
43:55 There's a web backend and a textual backend.
43:56 Both of those are very early prototypes, but I can't, like there are demos I can do
44:00 that I demonstrate that it works.
44:02 And also iOS and Android.
44:04 So essentially anywhere that you might want plausibly to have a user interface,
44:08 I can give you a user interface purely written in Python.
44:11 We also cover a bunch of hardware services as well.
44:15 So for example, you can, using a pure Python interface, get a GPS read.
44:19 You can work out where you are at a GPS and we have a native WAP widget.
44:22 So you can say, get a GPS read and put it by center of the map of where I am currently standing.
44:26 And that works on iOS, on Android, on macOS.
44:30 We've got it working on GTK and we've got a PR in flight to make it work on Windows as well, I think.
44:35 That, you know, it just, same code just runs everywhere and just, where am I?
44:39 Give me an answer.
44:40 Give me a ping every time I move a significant distance.
44:43 And also for cameras, similar, similar thing for cameras.
44:46 There is a question out of the audience, which I don't know the answer, but I'll throw that for you.
44:50 Is there any more love coming for the Beware WebView widget?
44:55 Having a case, not what they're referring to with Ceph, but is there more love coming?
45:03 I mean, sure, as soon as somebody wants to pay attention to it.
45:05 Am I actively intending in the very near future to do anything with it?
45:09 Probably not.
45:10 The most likely change that's on the horizon is to close the loop on callbacks.
45:15 So at the moment, you can, from Python, inject arbitrary JavaScript into a web view,
45:21 but you can't have something happen in the JavaScript to trigger an action outside in the Python,
45:26 which is essentially kind of the last piece of the puzzle you need to have a full kind of electron clone.
45:33 Yeah, I was going to say, that's very electron.
45:35 Yeah, we actually have a bunch of tooling in place.
45:39 We call it positron because it's like electron, but positive because it's Python.
45:42 I love it.
45:43 I love it.
45:43 Yeah, so we can take a website and turn it into a native app.
45:48 The only thing you can't do is then close the loop back out and call native hardware type stuff back into the Python API.
45:56 Not impossible to do.
45:57 I know exactly how to do it on iOS and macOS.
45:59 I think I know how to do it on GTK.
46:01 I don't know how to do it on Windows.
46:03 So that might happen at some point in the not too distant future.
46:08 Beyond that, oh, Seth, are they referring to the Chromium framework?
46:12 No intention to, but if someone wants to write that up, there's no reason you couldn't be a standalone widget.
46:17 This is very much from the Django days of if there is no, just because something exists doesn't mean it needs to be in the core.
46:27 So if someone wants to write a third-party widget that wraps the Chromium embedded framework
46:33 and turn it into a Toga widget, Toga will support that.
46:36 And to the extent that if there's something that makes it a little bit crusty,
46:39 there's probably a couple of areas where it could be a little bit smoother.
46:41 If there's a way we can make it smoother, I'm totally on board with that.
46:44 Doesn't mean it needs to be in Toga core itself.
46:47 Django has a huge ecosystem of Django compatible plugins.
46:52 Toga very much can be in that same space.
46:54 Everything doesn't have to be in Toga for it to be useful in Toga.
46:58 That's awesome.
46:58 That's good to know.
46:59 So I guess maybe the big updates here are the textual and the web targets for Toga.
47:04 Is that right?
47:05 They've been the biggest changes in the last eight years, I guess, is that those two now
47:10 exist.
47:11 And obviously you still need a lot of work, but like proof of concept, you can do it.
47:15 And it's really just kind of turn the handle and make more widgets come out.
47:19 The biggest sort of impediment to that at the moment is actually testing.
47:22 One of the changes that has come on since I've been working at Anaconda full time is we've
47:28 gone and got test coverage.
47:29 We've got 100% test coverage of all of the core and all of the desktop and mobile platforms.
47:34 So we have a very, very solid regression test suite to know that things aren't going to
47:39 break as a result of this weird little tweak over here that we make.
47:42 We've actually got validation of all that.
47:44 We don't have that yet on web and textual, mostly because of quirks of how those platforms actually run.
47:50 There's a kind of a foundational question we need to answer on the web one
47:53 in particular.
47:55 Yeah, I can imagine how the textual one works.
47:57 What's the runtime look for part of the web?
48:00 Is that PyScript or is that PyOxid?
48:03 It is PyScript, yeah.
48:05 So it's a briefcase, which I guess we'll get to in a moment, But Briefcase has the ability to target a web deployment.
48:10 It generates a HTML page that injects a load this wheel.
48:17 And this wheel is your app.
48:19 But it's a Python wheel that just contains your code for your running app.
48:25 And, yeah, but it's PyScript that's making that work.
48:27 Yeah, PyScript is neat.
48:28 Definitely neat.
48:29 Just the fact that it's opening up these types of things.
48:31 So Briefcase, yeah, let's dive a little more into that one.
48:34 Yeah, so Briefcase is then sort of the other part of the story.
48:38 you know, I've written this out.
48:39 It gives you the runtime, but you're still in the terminal to launch it with virtual environments and all that kind of business, right?
48:44 Yeah, okay.
48:44 Yeah, so briefcase is, the scary thing is at the end of the day, briefcase is really just kind of three templates
48:50 in a trench coat.
48:51 There's not a lot of, like, there's not a lot that it's doing beyond that
48:55 and also encoding all of the annoying details that are embedded 15 pages deep in Microsoft's
49:02 how to write an app, you know, documentation around code signing and packaging and building an installer
49:10 and all of that kind of stuff.
49:12 So on the theory that 99% of Python users have code that runs as Python minus M, my app, make that be a macOS app.
49:21 And that's what Briefcase does.
49:22 It says, okay, how do I turn this into an icon on my desktop that I can double click and the app will just start.
49:28 And it will include an embedded version of Python.
49:32 So I don't need to tell my end user how to install Python.
49:35 it will be signed and notarized in accordance with Apple's latest specifications it might come
49:41 inside a DMG because I need to be able to distribute it along with a readme or it might
49:44 come as a.pkg file because I actually need like in the case of non-GUI apps you actually like you
49:49 want to be able to put something on your path and you have to have like a post install script and
49:53 pkgs how you do that on macOS similarly on Windows it produces an MSI and it drops a Python
49:59 embedded and all that kind of stuff make sure your dependencies are there on macOS it makes sure that
50:04 of you install. If I'm building it on ARM machine, the app will still run on x86 because it'll install
50:09 both versions of both the x86 and the ARM binaries and merge them where they're necessary and do all
50:13 that kind of stuff. So it's all the little fiddly details. It is essentially just running a bunch
50:18 of command line, like everything Briefcase does is just a command line tool or rolling out a template.
50:25 If you turn up the verbosity, it will tell you in the prompt, like this is what I'm running. I'm
50:34 notary tool and so on and so on.
50:36 But you don't have to worry about that.
50:37 Like it's just going to, this is what will encode.
50:39 It'll do it all for you and just spit out either a DMG, a.zip, an MSI, IPA files on iOS, APK files or AAB files on Android,
50:51 whatever the native platform is.
50:53 And then on Linux, one of the things we've added more recently, we can do flat packs, we can do Debian, RPM, PKG zip,
51:03 PKG files for Arch and Manjuro, like all of the common packaging formats we try to cover.
51:08 The only one that I can think of that's notable that we don't cover at the moment.
51:12 We don't do NCS installers on Windows and we don't do Snap packages on Linux.
51:19 Not because we can't, just because I've only got two arms and there's a limit to how much I can practically do.
51:25 If someone wants those, I can point you at the code and show you what you're going to do.
51:29 And it's a moderately...
51:31 If you know the commands you need to run to make a thing happen, I can show you how to
51:35 plug that into Briefcase.
51:36 And like Briefcase's infrastructure is designed to be pluggable.
51:39 So it doesn't even need to be in Briefcase.
51:41 You can, again, do it as an external plugin and have it plug into Briefcase.
51:45 There are two things I want to ask you about here.
51:46 One, notarization and signing.
51:48 I remember how long ago I built C++ desktop apps and.NET desktop apps.
51:55 And you could just compile them and give them to somebody and let them run it.
51:59 And those sweet days are long gone.
52:01 You know, it'll get flagged with big warnings.
52:03 Like this looks like a virus because it didn't go through our digital signature system.
52:08 Yep.
52:09 What a frustrating thing.
52:10 So this has support for that.
52:12 It does.
52:12 Yeah.
52:14 Yeah.
52:14 It turns out there are bad people on the internet and they're willing to do bad
52:18 things.
52:19 Who knew?
52:20 So yeah, macOS has a bunch of processes for signing all of the binaries in an application
52:26 and then stamping what's called a notarization certificate to the installer to say,
52:30 This is a package in a format that hasn't been modified that I am willing to verify as me as a person.
52:37 This is what the version of the package looks like when it's correctly installed.
52:41 And then Sorry, probably in practice, if you want to distribute stuff to Mac and Windows, you probably
52:47 need to create a developer account and sign these things, unless your users are willing to run with the big scary, this looks
52:53 unsigned and untrusted. We've moved it to the trash, or you can go in there and run it. You know
52:57 what I mean? Yeah, like on macOS, It like literally has to be at this point.
53:01 You actually can't get away with not getting a developer certificate because the secure stuff on the M1 ship
53:08 literally will not run.
53:09 You can do cheap and nasty ad hoc signing, which means it will run on my machine.
53:14 But if you want to give it to anybody else, it is now at the point where you've got to go into the settings,
53:19 explicitly say, I'm willing to trust content that comes from an unknown provider.
53:23 Start the app by pressing option and double click, selecting the option of I'm willing to accept this.
53:29 Like it can be done, but it's like nobody is actually ever going to do that.
53:33 So you basically, yeah, you've got to sign up for a $99 a year developer account
53:38 and then go through the signing process.
53:40 And signing is a non-trivial activity.
53:42 It is difficult.
53:43 There are like you've got to do things in the right order.
53:46 And there is like even you have to submit the app in a zip format.
53:50 But you can't just use PK zip or your standard command line zip.
53:54 You've got to use Ditto, which is Mac's version of zip, Because otherwise, file system properties can end up being corrupted because the UTF-18 coding won't go quite reversible in the way.
54:04 Like, it is a nightmare.
54:07 Briefcase solves all those problems for you.
54:09 It should be as straightforward as just package this thing and sign and it works.
54:15 Similarly, it's not quite as bad on Windows.
54:18 Like, Windows will let you install an unsigned binary.
54:21 It just comes up with sort of the, this comes from an unknown developer.
54:24 Are you sure you want to do this?
54:26 And you say, okay.
54:27 But realistically, like people's willingness to click the this looks like it might be insecure is low and decreasing.
54:35 And so, yeah, you've just got to go get a certificate, sign the app, validate that it's you.
54:39 It's kind of it's the price of doing app business at this point.
54:42 Yeah, I guess it's sort of the equivalent of you have to have SSL to run a website.
54:46 However, exactly.
54:47 It is exactly that.
54:48 Yes, but we're missing Let's Encrypt.
54:50 We're missing Let's Encrypt.
54:51 Yes.
54:51 That's that part.
54:52 Yeah.
54:52 From the Windows point of view, there is absolutely a window of opportunity to do a Let's Encrypt because Windows doesn't specify who you've got to get your certificate from.
55:04 It just has to be signed by a root certificate that they honor.
55:07 So, like, essentially the instructions in briefcase kind of go get a certificate.
55:10 Where do you get it from?
55:12 You know, here are some options.
55:14 Go have fun.
55:15 So there is absolutely an opportunity for someone to do a Let's Encrypt here for app signing.
55:19 Unfortunately for Apple, that doesn't apply because Apple does insist that the certificate needs to be issued by them, signed by them, so that they can revoke it.
55:28 And maybe the EU changes around app distribution will relax that somewhat, but at least for the moment, you've got to go through Apple.
55:35 Yeah.
55:35 As salty as I am at the EU about the cookie warnings.
55:39 Yeah.
55:40 Yeah.
55:40 But I do have hope that they can bring some reason to some of the other App Store type behaviors.
55:45 It would certainly be.
55:46 I would not.
55:47 I welcome that development.
55:49 I am waiting to see what happens.
55:51 I had a lot of hope that the App Store stuff, I had a lot of hope opening the App Store thing
55:55 would provide a way to make it easier for Beware to distribute apps.
56:00 But in practice, it doesn't look like that's actually going to happen.
56:03 So yeah.
56:04 It's, yeah.
56:05 Nice try, but they squeeze through another track, basically.
56:11 It is what it is.
56:12 It is what it is.
56:14 The gatekeeper stuff drives me crazy.
56:15 I've had so much trouble getting my mobile apps in the app store, not for reasons technical,
56:20 just for reasons of...
56:21 Yeah, and I guess that's the thing.
56:24 It's like, I will, to a limited extent, defend the, not so much the gatekeeping aspect of it,
56:33 but the fact that there is a process involved to protect against completely arbitrary content.
56:40 That side of it is useful.
56:42 But the fact that there's, like, it is that locked down and only from Apple is the part
56:46 where it becomes a little bit onerous and that there's no competition to make Apple work better,
56:50 I guess is the real thing.
56:51 Yeah, yeah.
56:52 You can't go into a competition.
56:54 Yeah, and the rent is a, yeah.
56:55 Yeah, yeah, yeah.
56:56 From my app there.
56:57 You don't have in-app purchasing.
56:59 Well, I don't want to sell anything in my app.
57:00 I just want to let people view the stuff that we already got online.
57:03 Well, you're going to have to add it.
57:04 So weeks and weeks of paying developers and stuff to build it just so they can have their few bucks,
57:11 you know what I mean?
57:12 And it's just like, you have no idea how much pain this is.
57:15 Yeah, and like, I guess, I could almost, I don't like it, but I could almost grant them that, you know, the golden rule of
57:22 has the gold makes the rules, but it's their store. They get to decide what's in there,
57:26 but I don't have the option of another store.
57:28 And in particular, the review process is so inscrutable. Like Google is no better in this regard. If something
57:37 goes wrong with your Google application, good luck with that. For all the money they're taking, they're not providing good
57:46 customer service. They're providing no as a customer service.
57:50 Exactly. Yeah. They're both bad. I'm not saying Google's good. They're both bad. Okay. But for a briefcase here, we have,
57:57 we have the targets that I would expect Linux, Mac, Windows. Yes. But iPad, iPhone, Android,
58:03 tell us about that. Even watch.
58:06 So we, yeah, so we don't, we don't actually have it working for watchOS.
58:09 I have a proof of, yeah, I have a proof of concept that it can work on Apple TV. I have
58:14 written a Python application for Apple TV.
58:17 Web deployment, actually, that's that website's out of date.
58:19 I should need to update that.
58:20 We do have web deployments.
58:21 Put that in the proper bullet list, right?
58:23 Yes.
58:24 Yes, it should be on the proper bullet list.
58:26 So, yeah, but submitting to an app store, there are iOS apps, there are Android apps in the Apple and Google app stores
58:34 that are written with BWare.
58:37 So you are producing a binary.
58:39 It is signed and validated and then sent to Apple, and Apple says, yes, that's fine, and Google says, yes, that's fine,
58:44 and it's available for purchase.
58:45 So, yeah.
58:46 Awesome.
58:46 So what do you get, like an APK for Android?
58:49 And what is the AP?
58:50 It's an IPA.
58:51 Yeah, it's an IPA, but you don't ever see it.
58:54 Like you basically have to, for all practical purposes, you have to submit it through Xcode.
58:58 That might be something we can resolve, but I haven't.
59:00 They don't make it easy to find out how to not use Xcode to do it.
59:04 No, I think you're probably committed.
59:06 Even for my Flutter-based app, I've got to go do a build and an app store submission through Xcode.
59:12 Yeah, yeah.
59:12 The tools are there, but yeah.
59:15 But yeah, you get an AAB for Android.
59:17 You get effectively an IPA, but an Xcode project you can submit for iPhone.
59:23 For web, you get a tarball that is basically upload to your web provider of choice,
59:29 and it would work, and it would end up being similar for Apple TV or WatchOS or WearOS eventually.
59:36 Awesome.
59:37 Well, that's really great that you've been making so much progress on this,
59:40 And is it Steven, the other guy you're working with?
59:44 Malcolm.
59:45 I'm sorry, Malcolm.
59:47 You and Malcolm have been making so much progress.
59:48 That's really, really great.
59:50 And I think only good things are going to come from having the backing of Anaconda.
59:54 So we've got just a couple of minutes left.
59:55 What do you want to tell people about this project, these projects, how they should adopt them, where
01:00:00 they're ready for use, and so on, things like that?
01:00:02 I guess the quick thing I'd say is that we're not done yet.
01:00:05 There's still more to come.
01:00:07 Just a week and change ago, PIP.
01:00:10 sorry, PyPI officially started accepting iOS and Android wheels.
01:00:15 So you can upload an iOS and Android wheel.
01:00:18 There aren't any on there yet that I'm aware of, but I'm actively working on that.
01:00:22 So just so I can prove, hey, look, yes, there's one over there.
01:00:24 Look at it.
01:00:25 But part of the reason there's not one there yet is that the tooling to build iOS and Android wheels is not quite there.
01:00:31 And that's what I'm actively working on right now.
01:00:33 I would be deeply surprised if by the end of this year, there aren't multiple high profile projects that have.
01:00:39 I have the patches for Pillow to literally produce iOS wheels as part of their normal release process.
01:00:46 They haven't even seen the PRs yet, but I'm certainly hoping to work with them.
01:00:51 Yeah, I mean, they know it's coming.
01:00:52 Hugo knows it's coming.
01:00:53 So there is a lot of work still to do in terms of getting that patch accepted, but at least I know it can be done.
01:01:00 And more importantly, things like CI build wheels, like the infrastructure for putting a build all these wheels as part of CI is something where I have the patch and I'm like this close to being able to submit a pull request to CI build wheel to say, here's the back end to let you generate iOS wheels.
01:01:16 Similarly, we've got to do all that work for Android as well.
01:01:18 So there is still a lot of work to come.
01:01:20 My hope is that sort of by the end of this year, says he, being very hopeful, we'll be in a position where like anything you can do on a desktop platform, you can basically do on iOS and Android as well.
01:01:33 With the caveat that there might be, if there's C code involved, you might need to actually like work out how to compile this thing for iOS and Android.
01:01:41 For a lot of simple projects, literally there's nothing you've got to do.
01:01:43 You've just cranked the handle and make the compiler do its thing.
01:01:46 Yeah, especially if you have Python.
01:01:48 Yeah, exactly.
01:01:49 The other part that I'm sort of playing around with this year as a sort of a background project is doing for Enscripten
01:01:55 what I did last year or I'm up and I did last year for iOS and Android, which is get Enscripten up to tier three support.
01:02:01 So there will be a PEP and official supported platform.
01:02:05 Like Enscripten will be an officially supported platform in CPython in the same way that iOS and Android are.
01:02:13 I'm mostly shepherding that as sort of a member of the CPython core team
01:02:17 and Hood Chatham is actually doing most of the heavy lifting on that.
01:02:21 He's a PyDyde maintainer and is involved with PyScript as well to a lesser extent.
01:02:27 And, yeah, so he is working on the patches for that and I'm kind of shepherding those patches into core.
01:02:32 We are about to stand up and build bot to actually make the kind of the –
01:02:35 make sure every pull request is validated to make sure it still works on Inscripten essentially, which is one of the big sort of milestones
01:02:42 for official platform support.
01:02:43 Yeah, that's super neat.
01:02:45 What about CI?
01:02:46 for people.
01:02:47 Yeah, what about CI for people who want to build wheels for iOS and Android?
01:02:52 That's essentially where CI build rule comes in.
01:02:54 So you can do it right now.
01:02:55 So every time we make a change to Toga, we run a full test suite on iOS, on Android,
01:03:01 on macOS and all the other desktop platforms.
01:03:04 You can use like GitHub Action CI will let you start an iPhone simulator
01:03:08 and run the tests on that iPhone simulator.
01:03:10 You can start an Android simulator and it will run a simulator on those platforms.
01:03:14 It's like it takes three minutes to start the simulator, but that's just the price of doing business for iPhone, basically.
01:03:21 Yeah, I guess they probably already have CI for iOS and Android because there's probably
01:03:25 a ton of mobile projects on there.
01:03:27 It's kind of unusual to complain it with Python, right?
01:03:30 Yes, absolutely.
01:03:31 And so you can do it.
01:03:33 You can run those tests.
01:03:35 There are probably some things that could be done at an institutional level at GitHub
01:03:38 to make those tests run faster.
01:03:41 But that's a, you know, now I've just got to convince Microsoft to implement an entirely new backend for GitHub Actions.
01:03:48 And they don't support like Windows on ARM yet.
01:03:51 So I'm not holding their breath thinking I support iOS.
01:03:53 Yeah, yeah, I hear that.
01:03:55 One final forward-looking question, I suppose.
01:03:57 What do you see support for MScript in giving us?
01:04:01 You know, for example, like having the JavaScript stuff, you'd see like, okay, well, great, I can run it in a browser.
01:04:06 But well, then Node comes along and now I can run servers on it or I can distribute it or there's tool.
01:04:11 Like there's these sort of ways in which these environments grow unexpectedly, at least for most people, I think.
01:04:17 And how do you think InScript in my...
01:04:19 So my hope is that what we'll end up seeing is the analog of React and Vue, but for Python.
01:04:29 So you can right now, or you have been able to write a Django server-side website,
01:04:34 pick any other GUI, any other web framework you want.
01:04:36 You can write your server-side code, excuse me, you write your server-side code completely in Python.
01:04:40 It's great.
01:04:41 but then you've got to push your code to the front end and you have to write JavaScript on the front end.
01:04:48 And so that's kind of essentially where Node came from is realizing that we've got to write this code,
01:04:51 like we've got validation code, you've got to run it around the client and run it around the server.
01:04:54 So I can't put Python in the client, so I might as well bring JavaScript back to the server.
01:04:59 And so having that same language everywhere is a real advantage.
01:05:03 InScripten lets us get Python into the browser, but the part that we don't have yet
01:05:07 is the rich Python-first GUI framework in the browser.
01:05:13 My hope is that with...
01:05:15 Oh, you lost me there? I'm not sure.
01:05:18 My hope is that with inscription in the browser, what we'll get is the ability to build that toolkit.
01:05:30 I don't know what it is.
01:05:31 I don't know what will stimulate its development, but it should hopefully make it, or at least makes it possible.
01:05:36 And once it's possible, then a bunch of people, you know, project people can start playing around with it and actually making things.
01:05:46 Oh, we lost Russell.
01:05:49 Well, that's probably a good place to call it, folks.
01:05:52 Thanks to Russell for being on the show.
01:05:54 And thank you all for listening.
01:05:55 Talk to you all later.
01:05:56 Bye.
01:05:58 This has been another episode of Talk Python to Me.
01:06:01 Thank you to our sponsors.
01:06:02 Be sure to check out what they're offering.
01:06:04 It really helps support the show.
01:06:06 This episode is sponsored by Posit and Posit Workbench.
01:06:10 Posit Workbench allows data scientists to code in Python within their preferred environment
01:06:15 without any additional strain on IT.
01:06:18 It gives data scientists access to all the development environments they love,
01:06:21 including Jupyter Notebooks, JupyterLab, Positron, and VS Code, and helps ensure reproducibility and consistency.
01:06:28 If you work on a data science team where consistency matters, check out Posit Workbench.
01:06:33 Visit talkpython.fm/workbench for details.
01:06:36 Want to level up your Python?
01:06:38 We have one of the largest catalogs of Python video courses over at Talk Python.
01:06:42 Our content ranges from true beginners to deeply advanced topics like memory and async.
01:06:47 And best of all, there's not a subscription in sight.
01:06:49 Check it out for yourself at training.talkpython.fm.
01:06:53 Be sure to subscribe to the show, open your favorite podcast app, and search for Python.
01:06:57 We should be right at the top.
01:06:58 You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the direct RSS feed at /rss on talkpython.fm.
01:07:08 We're live streaming most of our recordings these days.
01:07:11 If you want to be part of the show and have your comments featured on the air, be sure to subscribe to our YouTube channel at talkpython.fm/youtube.
01:07:19 This is your host, Michael Kennedy.
01:07:21 Thanks so much for listening.
01:07:22 I really appreciate it.
01:07:23 Now get out there and write some Python code.