Learn Python with Talk Python's 270 hours of courses

#378: Flet: Flutter apps in Python Transcript

Recorded on Thursday, Aug 18, 2022.

00:00 Have you heard of Flutter? It's a modern and polished UI framework for writing mobile apps,

00:05 desktop apps, and even web apps. While interesting, you may have kept your distance because Flutter is

00:11 a Dart language-based framework. But with the project we're covering here today, Flutter,

00:16 many Flutter UIs can now be written in pure Python. Flutter is a very exciting development

00:21 in the GUI space for Python devs, and we have the creator, Fyodor Fitzner, here to take us

00:26 through it. This is Talk Python to Me, episode 378, recorded August 18th, 2022.

00:32 Welcome to Talk Python to Me, a weekly podcast on Python. This is your host, Michael Kennedy. Follow

00:51 me on Twitter, where I'm @mkennedy, and keep up with the show and listen to past episodes at

00:55 talkpython.fm, and follow the show on Twitter via at Talk Python. We've started streaming most of our

01:02 episodes live on YouTube. Subscribe to our YouTube channel over at talkpython.fm/youtube to get

01:08 notified about upcoming shows and be part of that episode. This episode is brought to you by Sentry.

01:14 Join Sentry at their conference, Dex, Sort the Madness, the conference for every developer to join

01:19 as they investigate the movement and trends for better and more reliable developer experiences.

01:25 Get your seat now at talkpython.fm/Dex. It's also brought to you by IRL, an original podcast

01:31 from Mozilla. This season, they're focusing on a topic very relevant to Python developers,

01:37 AI in real life. Check out an episode at talkpython.fm/IRL.

01:42 Transcripts for this and all of our episodes are brought to you by Assembly AI. Do you need a great

01:48 automatic speech-to-text API? Get human-level accuracy in just a few lines of code. Visit

01:52 talkpython.fm/Assembly AI.

01:54 Hey, Peter.

01:56 Hi, Michael. Thanks for inviting me to your podcast.

01:59 Yeah, absolutely. I'm so happy to have you on the podcast.

02:02 I'm Peter Feitzner. I'm working on this flat project.

02:06 So excited about your project.

02:07 Well, I'm excited as well. It's something new. Yeah, it's open source. I love open source. It's

02:13 actually, this project is a spinoff. It's like a second iteration.

02:17 You had a project called Pagelet, right? Is that what you're referring to?

02:21 Pagelet. So yeah, it was Pagelet. So it started as a kind of internal tool for making like, you know,

02:29 quick apps, like throwaway apps. And it was for web mostly. So it was like, it started like as a web

02:37 thing. And it was Pagelet. Then I shortened the name to Pagelet. And some guy on Sacker News

02:46 said that it's probably about like old gram, something like, or Postgres, PL. Yeah. So I got

02:53 confused. And I started calling it like Pagelet. So I didn't like the name. Yeah. And I did like that

03:00 it's only web. Yeah. Because, you know, the next step right after web, I started looking into like

03:06 doing desktop apps with this stuff and realized that actually the only choice is using web view.

03:14 And web view is really platform specific. So on macOS is one thing is like Safari. On Windows,

03:22 it's like either like web view one, web view two, which is quite a separate number, et cetera, et cetera.

03:28 A lot of times they don't have full support for modern HTML as well. So certain things you do

03:34 might act janky on a certain version of an OS. Yeah, it's always a weird thing, isn't it?

03:39 Yeah. So this page web was made on React. And I realized you cannot open it like right away in

03:48 the web view on Windows because it's this, you know, Microsoft Edge browser. So we have to add some like

03:54 poly fields, et cetera, et cetera, to make it work on Windows. So yeah. Then I don't remember the exact

04:01 moment, but probably I saw like an announcement from Google that they're releasing this like

04:07 Flutter, something like into production for web and desktop.

04:13 And I've become interested. What is that? You know, like, and I look into like Flutter thing,

04:18 you know, and I realized actually that it was, it's been on the market like for a long time and

04:24 mostly useful. Absolutely.

04:25 For, yeah, mobile apps. And, I'd always kind of dismissed Dart as just kind of like a weird coffee script type of thing. It's like,

04:34 oh, just another language to program, to write JavaScript. But then when Flutter came around,

04:40 it got way more interesting. So before we dive into what Flutter is and how we work with it and

04:46 why you built it and so on, let's actually take a bit of a step back and let's actually talk about

04:52 the two building blocks or one of the building blocks. We have Dart, the programming language,

04:57 which has been around since 2011 or so. And then we have Flutter, the UI framework that traditionally,

05:03 or normally you would use with Dart to build initially, I think it was just initially web apps,

05:09 wasn't it? Yeah.

05:10 And then they added mobile and then they added desktop and add the combination of those three

05:14 things is fantastic.

05:15 Exactly.

05:15 All right. We'll start with Dart. Tell people about Dart. I'm not a super expert in it, but I have been

05:21 experimenting to see whether using Dart and Flutter might be the right way to rebuild the Talk Python

05:28 training mobile apps because they're okay now. They have bugs. There's a whole story about the app store,

05:35 about why they're not fixed as part of the problem, not just the way that they're written,

05:39 but I would really like to modernize them. And I'm thinking that Flutter is the way to go.

05:43 So I'm personally interested, but not very experienced in it, but I've done a little bit. So that's the

05:48 perspective I'm coming at this with. Tell us maybe about your background with it as well. And then we'll

05:53 talk a tad about Dart and Flutter before we get into the Python side.

05:57 Sure. So I have to say, I'm coming from Microsoft world.

06:01 Okay.

06:02 From .NET. I've been in .NET like since the eldest, you know, so.

06:07 Since like the year 2001 or something, right?

06:10 Yeah. Yeah. I remember we were going through the language specifications and sent to us by Microsoft,

06:17 you know, like in the word Microsoft Word file. So at that time, so web, then web, I'm a JavaScript guy,

06:24 of course. Yeah. And then I learned like anyone else, like TypeScript and then Flutter.

06:29 Yeah. So my impressions about Dart are very, very positive. You know, it's so nice. I mean,

06:37 maybe it's me, but it looks and it feels better than TypeScript. Like to me, maybe it's because of,

06:43 Yeah. They have a great tooling in Visual Studio Code, maybe. Yeah.

06:47 But it felt so natural to write something in Dart. And especially, I love this, like this sound,

06:54 no references, you know, like where you can't have basically nulls. It's a really huge problem. Like

07:01 this nulls or nils or like, so yeah, Rust, like did, dealt with that, you know, there are no nulls. Go,

07:08 some of the way like in between. So, you know, this flat server is written in Go and in Go, you can't have

07:15 like null strings, but you can't have null references, like new references. But Dart is great. By default,

07:21 it doesn't allow nulls and it makes your app working as expected.

07:26 Yeah. And for people who don't know, Dart is out in the audience. Tushar puts it as a modern language,

07:31 which is the mix of the good parts of JavaScript and Java. I would say it feels a bit like Java,

07:36 a bit like C# in its syntax and the way that it works. Also a little bit like Swift with its optional,

07:43 like explicit optional type system, kind of a mix of all the stuff that was either in those languages or

07:49 came out in Swift later. And it's a pretty nice language. It's really different than Python.

07:54 Oh, well, yeah. Especially untyped Python, right?

07:58 Yeah. Yeah. You can see all different things in the Dart, like TypeScript, you know, like C#. Yeah,

08:05 I agree. But I mean, I would love to see many things like implemented in Dart, like transfer to

08:12 JavaScript with TypeScript, you know, like it's pretty easy to write. Yeah, it is. Before we,

08:17 if people are listening, we might not want to scare them away thinking they would have to learn Dart

08:22 in order to do this, right? Sure. The whole project that you are working on

08:26 Yep.

08:26 is sort of a, what if we use Python instead of Dart, but we still kind of use the building blocks

08:31 of Flutter, which I think we should probably discuss as well, because it's a unique way of programming.

08:36 Yeah. Absolutely. Yeah. The problem is not in Dart itself. Dart is a great language. I mean,

08:42 you can spend like a few days and pick up basic things and you become really decent and write that.

08:48 The Dart is not the problem. The problem isn't in Flutter. I mean, it's a great framework. It's so

08:55 flexible. It's so powerful, but it could be kind of like a steep learning curve, you know, like I would

09:01 compare Flutter to React. So if you come in from React, it could be easier to you, you know?

09:07 React Native. Yeah.

09:08 So yeah, you know what I, again, as a guy coming from like .NET world, I remember those times when we

09:15 were writing apps using like ASP.NET web forms, you know, stateful controls sessions, you know, on server

09:23 side. And now we translated to these stateless apps, like single page applications where the UI is filled

09:31 of like application state. And to my mind, this application state, managing application state,

09:38 like mutating application state is the most challenging thing, you know?

09:43 It is.

09:43 It's all right for a simple hello world apps, but if you write something really complex,

09:49 there are a lot of tons of libraries, you know, like Redux, probably the most people like there is

09:55 blog for Flutter. So it's a really challenging problem, you know?

09:59 Yeah. And I've been working, like I said, I've been exploring and trying to learn some Flutter to

10:03 see if it makes sense to work with. And the state stuff about it is crazy. It's really difficult to

10:07 figure out kind of where does this fit in my application code?

10:12 Yeah. Yeah. Sometimes you just want to take, you know, something and write like a simple,

10:18 simple app, you know, like it don't bother with this state. Yeah. It could be really challenging.

10:24 Like, there are a lot of questions. Why would, why, if we're talking about React, like tree re-renders

10:31 all the time, you know, like what's going on? Like, is it all right to use this or that? So it's kind of

10:37 like, if you look at any, even trivial app in React or Flutter, it's pretty, it's pretty complex right away.

10:45 And we're not talking about backend because you have to fetch data, like synchronize

10:51 data with the database and server side, right? So it has like even more complexity, like having

10:58 like a backend. Yeah, for sure. You got to create all the APIs and then you somehow got to keep them

11:02 in sync. Then you've got to do security from the front end to the backend. And there's all,

11:06 there's a whole bunch of stuff. So just having a- Exactly.

11:09 Single app that just has all your code, all your state running is really convenient.

11:13 Yeah. I mean, I don't remember exactly when we transitioned, like we developers transition to that

11:20 common concept, you know, like, like those apps should be made like, of like front end and backend,

11:27 you know, it should be like, so we abandoned the idea of Monoly or like maybe because they're not scale,

11:35 but you know what, actually the idea behind like flat. So we're not trying to pursue like

11:42 a framework, like, you know, for building apps serving like millions of users. Right? So if you're

11:48 building like a line of business app and you have a huge developer's team, maybe you don't need that

11:54 framework. But if you're doing something small to serve like, you know, hundreds of users, it's all

11:59 right to assume that you get memory. You can be a little bit slower here, you know, like, so you can

12:06 lose a little bit your requirements. Yeah. And I think it's probably worth just taking a step back just for

12:10 a second and talking about Flutter and how it runs, because while some of these things you're saying are

12:16 true, a lot of this would be running on the client side. So that's fine. It's running on the desktop app,

12:21 it's running in your web browser, but as a sort of a front end type of thing or whatever. Right?

12:26 It's not so server focused. Yeah. It depends on the applications. Exactly. So if you write in the game,

12:32 let's say everything is running on the client. Right? So most of business applications, I don't know,

12:39 like admin panels or tooling, you know? Yeah. I just need a dashboard that shows me the recent orders and

12:46 I need to like click them off to turn them to say we've finished them or they're pending or

12:51 like that kind of, it doesn't have to be Netflix level of design. You just want something quick and

12:55 get it up and share it. Right? Yeah. And in these apps, if you look into these apps, every click on a,

13:01 on a UI, actually it's a call to a bookend. Yeah. So if you write something like that can work on the

13:08 mobile, like on the desktop, yeah, it's a standalone app. Maybe it requires some service like for

13:14 authentication, but if it's mostly a standalone app, yeah, you don't need backend, then Flutter is great,

13:20 etc. Yeah. So if you look, if for people who are listening, if you go to flutter.dev,

13:25 you can see some of the apps that are in the app store with Flutter. And there's some really nice

13:31 ones here. You've got the BMW car app, you've got Stadia, you've got whatever the heck it's called,

13:36 Google Pay. There's a showcase you can go and they actually talk about the different apps that are up

13:41 here. Google Pay, ByteDance, eBay, iRobot. Like there's legitimate...

13:45 iRobot. Oh, nice. Yeah. iRobot. I got this app, right?

13:51 There's a question in the comments, but we'll get to in a minute about that actually. Right.

13:56 A bunch of apps. And then you can also go and see that there's a thing called, it's all widgets.

14:01 As you'll see, the way in which you design these apps is code first and you create these things

14:06 called widgets. You have some interesting ideas around that, but yeah, you can flip through and

14:10 there's just tons of apps. So here, at least the ones people submitted, there's like 3,000 apps in

14:14 the showcase, which... So it's a pretty well used project, right? So we have Flutter. Yeah.

14:20 And it's not like React Native or something where it puts HTML into your code, but it kind of is

14:25 powered on top of the HTML engines. It runs by using an HTML canvas, but then it just completely

14:33 does its own rendering to that, like 120 frames a second type of render. But the idea is it's supposed

14:39 to be completely in control of the pixels so that it looks pixel perfect across all the devices. That's

14:44 their selling point and you can see how well they go. But until recently, I thought the only way to

14:50 program that was Dart. And then I learned about your project, Flett. And I got to say, I'm not the

14:55 only one who thought it was pretty cool. Out in the audience, we've got... Abhay says,

15:00 Fedora, I love you, man. Thanks for creating Flett. And then there's another...

15:05 Nice. Thank you for your support.

15:07 Yeah. There's another, you know, biggest fan and so on. So people definitely appreciate this project.

15:14 What is the story? I gave my limited experience with what Flutter by default is. Oh, also, we mentioned

15:21 this, but it's worth just emphasizing once again, Flutter compiles to different targets. Flutter runs

15:27 as a JavaScript app on the browser, but it compiles natively with a head of time compilation to execute

15:34 on the desktop and on mobile, right? So it's not just running some sort of web interpreted type of

15:39 thing. It's literally compiled in native code on the other platform.

15:42 This portion of Talk By Theonomy is brought to you by Sentry. You know Sentry as a long-time sponsor

15:50 of this podcast. They offer great error monitoring software that I've told you about many times.

15:54 It's even software that we use on our own web apps. But this time, I want to tell you about a fun

15:59 conference they have coming up. Sentry is hosting DEX, Sort the Madness, the conference for every developer

16:06 to join as we investigate the movement and trends for a better and more reliable developer experience.

16:11 What is this madness, you ask? It's the never-ending need to deploy stable code quickly.

16:18 Come to DEX to engage with developers who will share their epic fails and their glorious saves.

16:23 Since we can't fix the madness, but they can start sorting through it with you. Register today to join in

16:29 San Francisco or attend virtually on September 28th at talkpython.fm/dex. That's talkpython.fm/dex.

16:37 The link is in your show notes. Thank you to Sentry for supporting Talk Python to Me.

16:43 Tell us about FLUT, this F-L-E-T, the fastest way to build Flutter apps in Python. So exciting. What is this thing?

16:53 So, all right. I have to admit maybe the current title is a little bit click-baity.

16:59 There's a whole thing about marketing open source projects and gaining momentum and, you know?

17:03 Yeah.

17:04 I'm not going to hold against you.

17:06 Yeah. I was thinking a lot about how would I tell people what I'm working on? Like, but heck, why not?

17:11 Maybe we're not building Flutter apps per se, but with help to build your Flutter apps. What is that if it's not Flutter apps? So yeah, I can say, yes, you can build Flutter app in Python and it's good.

17:25 Flutter app in Flutter app. It's not just about collecting all the widgets, all the power available in Flutter, like to Python space, you know? It's not. In Flutter app, we try to cater all these to present all those widgets, you know, and their combinations to Python users in a very, you know, digestible form.

17:50 Yeah.

17:51 Like Flutter. It's those widgets, they're very highly specialized in Flutter. There is a widget for padding, there is a widget for opacity, there is a widget for depth. So it's like, if you try to write something like real, you will get this ladder, like widgets. And it could be really challenging to work with this ladder.

18:13 Yeah.

18:14 In Flutter, we're trying to combine some widgets to flatten this hierarchy, you know, to make people more productive, you know?

18:23 I've been trying to look around the Flutter site, and I'm not doing very well while we're talking for an example. But the way that you write code, the Dart code version, and the flat code version, the Python version, is some UI frameworks have kind of a designer, right? Think Xcode and storyboards, think Visual Basic or Windows Forms or WPF, like where you can see it and you can drag things around.

18:47 Flutter is very code focused on using these widgets. So you might create a list tile, and then you would have the contents equals a list of, you know, rows, and the row object you're allocating or creating there has like a list of things that are, you know, buttons. And it's just, it's like very, you see almost the hierarchy on the screen, right?

19:09 Yep.

19:09 And in some sense, programming in Flutter feels a lot like that, right? You can sort of see on the home screen that there's this place where you're adding, going to a page and adding a row, which takes a list of icons and so on. But it sounds to me like you've also done some work to build larger building blocks than just that, right? You call them components and not just widgets.

19:30 Yeah, well, definitely to work with these frameworks, you have to have pretty good sense of, well, like imagination, you know, like you put these controls and you have to imagine like what would be on the screen. And also Flutter has like hot reload, so you can experiment very fast. And there is also a project Flutter Flow. I looked into that project and it's really nice. It's a new startup. Maybe you can cover it in some of your...

19:57 What's it called?

19:57 Flutter Flow.

19:58 It's like Web Flow.

19:59 Flutter Flow, like that?

20:01 No, like Flow.

20:02 Oh, I see. Flow like that. Got it. Yeah, yeah. Flutter Flow. Okay.

20:05 Yeah, here you go.

20:06 Oh, interesting. Okay.

20:07 So...

20:08 This is news to me.

20:08 These guys, so yeah, you can drag and drop and they produce like a Flutter, like a package, you know, like basically...

20:16 I see. It's a UI designer and it'll generate the hierarchy of widget. Probably it writes the codes behind the scene for you or something like that, right?

20:22 Yeah.

20:23 Okay. Wow. Interesting. Okay.

20:24 We have something in our roadmap as well. So we're going to make something very similar, but instead of like Flutter code, it will be generating like button code instead. So it's going to be interesting as well.

20:39 So yeah, components. So we call them controls. We call them controls. People asking about why control, like why not call them widgets? I don't know. Maybe I didn't use term widget a lot at the time, like, but it's historically maybe. Maybe it's because of it's coming like from design to replicate these people.net web forms.

21:03 Yeah. That was the terminology there. Sure.

21:04 Yeah. Controls and WPF, Windows Presentation Foundation also play controls and the Xamarin controls.

21:12 You've been swimming in this terminology. So here it is, right?

21:15 So yes, controls. Again, it's not like one-to-one reflection of Flutter widgets. We try to be creative. So we're trying to have some opinion, you know, like what we like to put into control.

21:29 So we don't want them very generic. We don't want them very complex. So, and actually it's an interesting thing. If we talk about Paradigma, it's React and Flutter, they're like declarative style programming.

21:45 And we are converting this back to imperative style. So you can find an article on Flutter website describing the differences and why it's cool, you know, to build UI from the state. But with Flutter, we are going back to imperative style, Xamarin style.

22:03 Right. Okay.

22:04 Where you change control provenance, you know, and they have a state.

22:09 Yeah. You can say like a dot text equals type of model. Yeah. So let's actually, I think maybe the best way for us to understand this, there's a ton of questions about how it runs. Like, does it transpile? Does it compile? How does it, I want to get into that.

22:23 But I think the best way for us to set the stage for that discussion is let's talk through your tutorial. Okay. Because that'll cover a lot of the capabilities, some of the programming model and so on.

22:34 And if people drop over to flat.dev slash docs and click on the tutorials, you have the obligatory to do app. But the one that looks interesting to me is this calculator app.

22:45 Yeah.

22:46 Here's something that looks, it looks literally like the one that I have on my iPhone. It boggles my mind that a trillion dollar company cannot put a calculator on their larger version of their iPhone.

22:58 So I can't say it looks like my iPad one, but this would run on the iPad as well. But, but this looks something I would really interact with. This is built with Flutter running on Flutter with Python.

23:08 So let's go. And what's cool is you can find a live demo because Flutter runs on the, as a single page app in the web, it runs on iOS and Android. Oh wow. Yeah. It runs on iOS and Android. It runs on the desktop.

23:21 So if I say five times, you know, 10, like granted it's a calculator, but it's pretty neat. And it's just one of the deploy targets, right?

23:28 So let's talk us through like how to, first thing I can pip install Flutter. Do I have to have Flutter? Do I have to do, there's like a, quite a series of steps to set up your machine to be a Flutter dev machine.

23:38 It's got to have like iOS simulators potentially and the Flutter and Dart SDKs, all of that's a prerequisite to this, right?

23:45 Yes. You know what? Actually, it's also a huge obstacle. Like if you want to start doing Flutter, it's a, I have both Windows and MacOS machines. Like it worked.

23:55 Same. You have to install a lot of things to start doing something like, especially on MacOS, it's Xcode, you know, like something. I'm still trying to figure out the whole like bunch of tools you need. Yeah. Like for, especially for deployment.

24:09 But so Flutter actually comes with this thing called Flutter Doctor. I'll put up a screenshot of what I get when I run it. It's, I'm running it right now and it's still running. There we go here. Hold on. I'll put this up. And so people can see.

24:22 So I'll try to include a screenshot or link to this or something, but it's like checks that Flutter is installed. Check that the Android tool chain is installed. Check that Xcode is installed. Check that Chrome is there. Android Studio, IntelliJ or VS Code that there's hosts available. Like there's a bunch of steps to make all this happen. Right? So we still need to do this though. That's my question is I still need to go through the steps to generate like the Flutter configuration on my machine.

24:46 So I have to say you have ideally green list, you know, like, because I have some gaps. I didn't install like IntelliJ like it was that. So in Flutter, this client part, it's a Flutter app, which knows how to render, let's say, JSON tree, like page or UI presentation in JSON format.

25:09 So it knows how to render it. And it has like a final functionality. So it's compiled, it's recompiled for all the platforms, like for Windows, for Max and these executables that included into Python wheels.

25:24 So when you install Flutter, it basically downloads as a part of a wheel, it downloads Flutter client, which is Flutter, like combined Flutter app, and it downloads Flutter server.

25:36 Oh, so I might not actually need to do this.

25:38 Well, yeah, you don't see it. I mean, you can see it in logs or if you go and see site packages of your flight installation, you'll see all those executables.

25:48 Okay. Interesting.

25:50 Yeah, that's why you need nothing, you know.

25:52 Oh, that's fantastic. Yeah.

25:53 Yeah, it's for desktop, for web, like compiled Flutter web app is embedded into Flutter server. So it adds another two megabytes to like SQL itself. But so yeah, we have embedded web bar and you download either Linux, Windows or MaxQuest client with your wheel.

26:15 Right. Okay. Yeah. The wheel knows which platform it's being installed on.

26:19 Yep, exactly.

26:20 Exactly.

26:20 Yeah. Let me check how big this thing is. I went through your example and that we're going to talk through and I compiled it to a .app, a Mac.app application and it's 38 megs. That's totally reasonable for me for the base runtime, basically.

26:35 Oh yeah, I'm frozen.

26:37 You know, you.

26:38 Was I? I was, sorry. I was just thinking about, I was just thinking a lot. That's all.

26:43 Yeah. It's pretty, yeah. For macOS, it's the biggest, like 30 something. Like for Windows, it's probably the smallest cells. Maybe not news for the years.

26:53 Yeah. But when you compare that, say, to an Electron app. An Electron app is very large compared to that.

26:58 Yeah. Yeah. Because it packages browsers. So you have the same picture on all platforms, right? So Flutter is nice because like you said before, it's same rendering engine like on all platforms.

27:12 It's clear, something like, and even on web, it's canvas. So you have the same picture on all platforms. And this is nice.

27:19 Yeah. Fantastic. It is. All right. Let's talk to this. Let's talk to this example. So pip install Flutter, that takes care of all of it. I'm sorry. I derailed us talking about all the setup of Flutter and Dart and all that.

27:30 And so in order to write code with this, I don't want to talk through too much code, but I want to give people a sense of what it feels like to write code with this. It feels like a very much like kind of a Python variation with the difference that it's more imperative, as you said.

27:44 So we would say from Flutter, import page and text. And you have a main method that is past a page. And then you just say add text and you set the value. You could set the background color and then you just say run. And well, hello world Flutter, there you are, right?

27:58 But you have other controls, like you have elevated button, and then you have a bunch of layout. I mean, you, like you as the developer.

28:05 Yeah, like row.

28:07 Because Flutter provides a lot of these, Git provides row and column and containers and all of those things. And you just have a way to talk to those from Python, right?

28:18 Yep.

28:18 How does that happen? What's the interop layer between Flutter and Dart and Go and all those like low level aspects? And then when I write Python code, how does that work?

28:28 So yeah, it's a good question, right? Because people are constantly asking about like doing APK or IP files from this stuff.

28:37 Those are the compiled output for the what you ship to the App Store for people who haven't done that.

28:42 Yeah. So the way it works is the following. In the middle of all this, there is a web app basically like written in Go and GoLang. It's called Flat Server or Flat D for sure.

28:53 And it holds in memory this current state of the page.

28:58 When you like from one side of this server is language or this Python library.

29:05 Like basically when you do this page.add, it sends like a JSON basically to this web server and updates the state.

29:14 I see. So when I do this, I'm working in Python and the result is to send, to build up this control structure, this widget structure, and then it sends over to this embedded web server that's native that says build this in Flutter now.

29:30 Right. Something like that.

29:31 Exactly. So this Flutter client from other side, it connects to this server with WebSockets.

29:38 Yeah.

29:38 So in like in real time, and there is like a bi-directional channel between like this server and the client.

29:44 When you push changes from the language to this server, it sends an update to Flutter app.

29:51 And when you click something on Flutter, in Flutter, you know, like you do some like type text in the text box, text field.

29:58 Right. Some event is raised. Yeah.

30:00 It sends, yes, back to server and server routes it back to Python code.

30:05 So yeah, it's like three components, like client library in language right now is Python, server, and client.

30:13 So it's like three things.

30:15 Okay. So when I execute my Python code, is that running on full CPython or is that running on some limited lesser thing?

30:24 Like do I have full access to all of Python while I'm here?

30:27 Exactly. And when we're talking about deployment, this stuff to mobile devices,

30:33 devices on the first stages, we're going to support this so-called web server driven UI approach.

30:40 And yes, your code runs by a real Python and you have access to all libraries.

30:46 Yeah.

30:47 Wow.

30:47 Because if you decide to put this on a phone like Python, there could be limitations.

30:52 Right. And most of those projects I went through Kyrie and the Beware project as well.

31:00 Yep. Yep.

31:01 Beware, Kivi.

31:02 They do absolutely amazing job packaging Python for mobile devices, but there are always like bots.

31:09 So mostly they encourage you to use pure Python modules, right?

31:14 Yeah.

31:15 Because if you decide to use like modules with native libraries and then you have to make sure that those are compiled for ARM 64 architectures, right?

31:24 Right. Which gets really tricky.

31:26 Sort of related to that out in the audience, maybe the first question we'll take before we get to some of the others is,

31:32 can we use other Python packages with Flet?

31:34 Like, could we run machine learning code on the click of a button?

31:37 Asks Raul.

31:38 Yes, absolutely.

31:39 And the idea of Flet was not like to be a central park, like in your app, but to be on the side, you know,

31:47 like to add UI to your application so you can make your app live.

31:53 And goal was, first of all, to add like web-based UI, you know?

31:57 So you can share your app with your colleagues, with your team, you know, customers.

32:01 So yeah, absolutely.

32:02 You can use any libraries, but we lack some visualization controls compared to other tools like Streamlit, for example, like for scientists.

32:14 Sure.

32:14 Absolutely.

32:15 Or there is another project like DearPaiGui.

32:18 DearPai, yeah.

32:19 DearPaiGui.

32:20 I've had both of those groups on the show before.

32:22 Yeah.

32:22 Yeah.

32:23 Which is amazing, like for very fast visualizations that wouldn't be there probably like in a lot.

32:29 Yeah.

32:30 Right.

32:30 More of a building interactive.

32:32 Yeah.

32:33 Applications, perhaps.

32:34 With low latency, yeah.

32:38 This episode of Talk Python to me is brought to you by the IRL podcast, an original podcast from Mozilla.

32:44 If you're like me, you care about the ideas behind technology, not just the tech itself.

32:50 We know that tech has an enormous influence on society.

32:54 Many of these effects are hugely beneficial.

32:56 Just think about how much information we carry with us every day through our cell phones.

33:02 Other tech influences can be more negative.

33:04 I really appreciate that Mozilla is always on the lookout for and working to mitigate negative influences of tech for all of us.

33:12 If those kinds of ideas resonate with you, you should definitely check out the IRL podcast.

33:17 It's hosted by Bridget Todd.

33:19 And this season of IRL looks at AI in real life.

33:22 Who can AI help?

33:24 Who can it harm?

33:25 The show features fascinating conversations with people who are working to build a more trustworthy AI.

33:31 For example, there's an episode on how the world is mapped with AI.

33:36 But it's the data that's missing from those maps that tells as much of the story as the data that's there.

33:41 Another episode is about gig workers who depend on apps for their livelihood.

33:45 It looks at how they're pushing back against algorithms that control how much they get paid

33:50 and how they're seeking new ways to gain power over data and create better working conditions for all of them.

33:56 And for you political junkies, there's even an episode about the role that AI plays

34:01 when it comes to the spread of disinformation around elections.

34:04 Obviously, a huge concern for democracies around the world.

34:07 I just listened to The Tech That We Won't Build, which explores when developers and data scientists should consider saying no to projects

34:14 that can be harmful to society even though we do have the tech to build them.

34:19 Does this sound like an interesting show?

34:21 Please use the link talkpython.fm/IRL to subscribe.

34:26 Yes, you could search for it in your podcast player, but use the link talkpython.fm/IRL to let them know

34:33 that you came from us.

34:34 The link is in your podcast player show notes.

34:36 Thank you to IRL and Mozilla for supporting Talk Python to Me.

34:43 I feel like we kind of answered this, but I think it's also maybe worth pointing out.

34:47 Like Tushar asked, is this a transpile to Dart project?

34:50 It sounds like definitely no.

34:52 It runs in CPython and it serializes the UI to this other part of its process.

34:58 Is that right?

34:58 Yeah, there is no transpile.

35:00 Yeah.

35:00 And, you know, I saw a lot of, I know what people talking about, like I saw a lot of horrible

35:06 implementations, like, you know, transpiling Rust to Dart, Dr. Rust, Python to all these

35:12 guys.

35:12 I mean, it's going to be a fragile solution, unnatural, you know, like, and to my mind.

35:17 Well, as soon as you say, well, can I use this library or that library?

35:21 The answer almost is always is no.

35:23 Right.

35:23 If you're, you know, you think of something like Sculpt or Brython, which is like Python

35:27 in the browser, but transpiled to JavaScript.

35:29 It's well, how to use these other libraries?

35:31 Like there's no way to really.

35:33 You will hit the wall.

35:34 You will hit the wall at some point, you know?

35:35 Like, so if I were like an engineering manager, I would never go for this, you know, like

35:40 in a real project.

35:41 Yeah.

35:41 Yeah.

35:41 Except for maybe some real special tools or use cases, but yeah.

35:44 All right.

35:45 Moving on down the line of our tutorial here.

35:47 One of the things that you have to keep in mind and focus on when you're working with Flutter

35:53 in general and Flutter with Python is how do you build out these, these layouts and how

35:58 do you position the controls?

35:59 And it looks like if you know one, you kind of know the other pretty well.

36:02 So for example, here we're adding a row whose control is like the output, but then the next

36:07 row is you say the controls are the first row of buttons.

36:10 And then another row whose controls are the next row of buttons.

36:13 And you just keep building this up and you pretty quickly end up in something that looks like

36:18 it's kind of a real basic calculator app.

36:20 Yeah.

36:20 And then you get into containers, right?

36:22 Where you've got a container contains like a column that has each row and you kind of like

36:27 put it together like this, right?

36:28 Mm-hmm.

36:29 But I guess the question I wanted to ask you here is how similar or different is this

36:34 than Flutter?

36:35 It feels to me like it's pretty similar, at least in the zen of it.

36:39 Yeah.

36:39 Exactly.

36:40 So PageLit was based on Microsoft Fluid UI library and for making new layouts, there was

36:47 like stack.

36:48 So stack could be like horizontal or vertical.

36:52 And here we decided to do not bend Flutter into something else, but go with the same terminology.

37:00 So stack is like a bunch of layers and we use row and column and all this stuff, you know.

37:09 And it feels good.

37:10 Row and columns inside, like rather than having stack everywhere or like div, if you will,

37:17 like div and then add semantics to div by classes, you know, like it's still form like div, div,

37:23 div, div, div.

37:24 Here we have row, column, column row, at least.

37:27 So you can distinguish this like, you know, visually.

37:31 Right.

37:31 One of the benefits of structuring your code like this, and you do touch on it in this

37:34 tutorial, is that you can build little reusable segments, right?

37:39 So for example, if you've got a row that has a column of stuff and then another row of more

37:44 columns, you could take that, just that column or even build up just one row at a time and

37:49 put that into its own function or its own class and then sort of include that kind of in the

37:53 control sense of the traditional visual basic windows forms.

37:58 Like, like here's the, now I have a bigger thing to drag around, but in this world, like

38:02 drag around is just like right code to create it and put it in the right spot.

38:05 You know what?

38:06 And I've been really amazed, you know, because it works so good.

38:10 I understand the first question people ask, like, how would I make my own like clutter component?

38:17 But you know what?

38:18 You can do these user controls in the, made of these primitives, flat provides, and it works

38:26 pretty well.

38:27 They're isolated.

38:28 They can handle events inside them.

38:31 Like if you put few of those user controls like on a page in different places, they will

38:37 be all behave separately.

38:39 And it's so nice.

38:41 I mean, maybe it's side effect, you know, like I wasn't thinking about that while doing this

38:47 stuff, but it's so good.

38:48 So you can build.

38:49 Yeah.

38:50 And can these controls, do they have their own state?

38:53 Absolutely.

38:53 Yeah.

38:54 Oh, that's awesome.

38:55 So you could have like put information about it and need some buttons to interact with it.

38:58 And it just, they sort of keep track of just that little block, right?

39:01 Even better.

39:02 Whatever you do on flat UI, it's getting persisted right away.

39:08 So whatever, let's say if you have a new form and you type something into this form and you

39:14 do refresh in your browser, all the information will be there after refresh.

39:19 So it's like...

39:19 And for a desktop app, say if I close it and open it again, will it remember?

39:24 It depends.

39:25 So right now it's a standalone app.

39:27 And when you open it again, it will load another instance of this flat server with the

39:33 clean state.

39:34 Right.

39:34 So it kind of loses the state.

39:36 Yeah.

39:36 Yeah.

39:37 But I suspect you have access to the file system somehow.

39:40 You could save it if you wrote the code to do it, right?

39:43 Yeah, sure.

39:44 We're going to make it.

39:45 Yeah.

39:45 Since this is Python executing, could I do like SQLite?

39:49 Absolutely.

39:50 And say SQLAlchemy and figure out like, I'll put the file in my user's app, you know, data

39:57 directory in their profile.

39:58 Absolutely.

39:58 Right now we're working on a more advanced example with using database.

40:03 I mean, like not advanced, like, but with using the database.

40:06 And also we're going to add data table control for working with Greece, you know, like...

40:12 Nice.

40:13 Because this reason right now, yeah.

40:15 Yeah.

40:15 Related to that out in the audience, Rob will ask, is the way it looks and feels, is this

40:20 material UI?

40:21 Can we change the theme and styling?

40:23 I know in raw Flutter, you can have like buttons out of the material design or you can have buttons

40:28 out of, what do they call it?

40:29 They call it Darwin or whatever the iOS equivalent.

40:32 There's like different places you get the buttons to look different.

40:35 And what's the story around that?

40:37 So it's a good question.

40:38 You know, again, I came from Microsoft world and there they have fluent UI and it looks different

40:45 and what actually Flutter was my first experience with material UI.

40:50 And you know what I see?

40:51 Honestly, even compared to Fluent UI, it's pretty solid, you know?

40:56 And they, I would say they have a strong commitment to this material UI strategy, you know?

41:02 Like, and it looks really nice.

41:04 You don't have to sell people what it is.

41:07 Like I would probably need to sell people Fluent UI, but I don't need to sell people like this material UI.

41:14 It's nice right away.

41:16 Looks nice.

41:16 It looks pretty solid.

41:18 But for different styles, yes, you can style, like there are limited styling features right

41:25 now like in flat, but we're going to pull more.

41:28 And also we will be doing these adaptive controls.

41:32 Oh, so if I run the app on Windows, it might look different.

41:37 It might be material versus I run it on macOS.

41:39 It'll be the, whatever the heck is the Darwin variant.

41:42 Yeah.

41:42 Exactly.

41:43 So yeah, you can actually, I don't know how to share a link with you, but I can.

41:48 Yeah.

41:48 Yeah.

41:49 There's a private chat here in the streaming through it and I'll pull it up for us.

41:52 Yeah.

41:52 I'll show you what it might look like.

41:54 Oh, fantastic.

41:55 While you're looking at it, I just also want to point out for event handling is a super important

41:59 thing in UIs, right?

42:01 Like UIs are basically get the stuff on the screen and start handling events and updating the UI

42:05 accordingly.

42:06 And so in flat, all you got to do is, for example, for your button, you say on click equals like

42:12 a function called button clicked and you get past the data.

42:15 Yep.

42:16 And you can also associate like, here's the indicator or the data of the button.

42:19 And when it's clicked, pass that over to it.

42:21 Like, for example, the action to take.

42:24 And those can even be lambda expressions, right?

42:26 Oh, yeah, absolutely.

42:27 Yeah.

42:27 If you manage to put it in the single line, like, you know.

42:30 So lambdas in Python are limited somehow, you know, like.

42:35 Yeah.

42:36 Oh, yeah.

42:36 They're single line.

42:37 They're like expressions of the other languages.

42:40 I use it a lot, like print something as lambdas, you know, in the event headers to see if it's

42:46 being called.

42:46 Yeah.

42:47 So I dropped you a link to Fluent UI.

42:50 Yeah.

42:51 It's a library for Flutter.

42:52 It's really cool.

42:54 And there is a web demo, even like, and there is also like, water, Macos, UI, something like.

43:02 I'm dropping you a link as well.

43:04 All right.

43:04 Cool.

43:05 So, and for mobile apps, we have a lot of controls like this Cupertino library built into Flutter.

43:13 That's what it's called.

43:14 Cupertino.

43:14 Yes.

43:15 Not Darwin.

43:15 Cupertino.

43:16 Yeah.

43:16 Yeah.

43:16 Yeah.

43:17 Yeah.

43:17 Yeah.

43:17 Right the way.

43:18 So, yeah, you know, yeah, I get it from many users.

43:20 It's, it could be really inappropriate to see a Fluent UI, Fluent, let's say, toggle button

43:27 on iOS, you know.

43:29 This looks fantastic.

43:30 Yeah.

43:30 I mean, one of the, it's just, when you open an app and it clearly looks like it doesn't

43:35 belong in the platform, you're like, hmm, this is weird.

43:37 What is this?

43:37 Yep.

43:38 It just, it doesn't bring the right impression.

43:40 And this, I mean, the stuff that you're showing on the screen, and I will link to the examples.

43:45 Yeah.

43:45 I can be convinced that this is a proper macOS app as well as proper Android or whatever

43:51 it is you're looking at, right?

43:52 Beautiful.

43:53 Well, if you're like a specialist, you can definitely see like, you know, some odds, you know, that

43:58 it's not like native.

43:59 Yeah.

44:00 Yeah.

44:00 You're like, oh, that button's not quite.

44:01 Yeah.

44:02 Yeah.

44:02 Yeah.

44:02 It's drawn, you know.

44:04 Right.

44:05 The way Flutter works is it doesn't pull in the underlying window widgets out of your

44:10 OS.

44:10 It literally redraws them from scratch, but they try really hard to make it look the same.

44:14 You know what?

44:16 It's always a debate.

44:16 If you go somewhere like in Harkin US, you'll have these debates.

44:20 What would be like?

44:21 Because React Native, it's about like display native controls, right?

44:25 But is it a good thing when you precise design?

44:28 And I work with designers in big companies like, and could be a problem if you cannot deliver

44:34 precise design.

44:36 Yeah.

44:36 This gives you more stability across platforms for your look and feel.

44:40 A question in the audience, which I think we're going to get to in a second.

44:44 Sugato.

44:44 Hey, Sugato.

44:45 Can you create mobile apps with Flet?

44:47 And I don't know if this is on the roadmap or this is already ready.

44:51 We might have to save a bit of the conversation for the roadmap discussion.

44:54 But sure.

44:55 So as requested multiple times by our users, I put this, I assembled this model strategy.

45:02 If you, Michael, if you can open this in a blog, it's in the blog.

45:05 Ah, the blog.

45:06 Gotcha.

45:07 Okay.

45:07 It's a blog, Flet mobile strategy.

45:09 There you go.

45:10 Cool.

45:10 So it's not like we forgot about mobile devices.

45:14 No, quite the opposite where I'm always thinking about mobile experience.

45:19 We're getting there maybe slowly, but we're getting there and we will be there.

45:24 So we want to deliver, not just, you know, like the way you can build like APK, you know,

45:29 we want to enable developers, you know, like to quickly test, for example, these like experiences

45:34 on mobile devices, because it's a complex process, you know, like it's very complicated.

45:39 Yeah.

45:40 Like packaging and signing and publishing, reviewing, et cetera.

45:44 So it's, and many companies, they're moving to this server driven approach, like Airbnb,

45:50 like Lyft, like big players.

45:53 So they can bypass like App Store reviews, you know, and push some new functionality, like

45:59 right away from their web servers.

46:01 So we're going to explore this approach first.

46:04 And yeah, definitely we will look into packaging everything into mobile package.

46:13 Like, I mean, Python compiled for ARM 64, this Go server compiled for ARM.

46:20 And so making this like sandwich working on mobile and packaging it and delivering to mobile

46:26 device like the last.

46:28 This is the biggest challenge for you all, right?

46:30 It's not quite.

46:31 It's challenge.

46:32 It's not quite there yet, right?

46:33 It's challenge.

46:34 Yeah.

46:34 It requires you to be a low level programmer, you know?

46:37 Yeah.

46:38 And Stugato actually has a follow up saying, cool, PyTorch is trying to make model serving

46:43 available with React and using Flet could be a very accessible alternative.

46:46 I will look into that.

46:48 Well, so.

46:49 Yeah.

46:49 I mean, that is interesting.

46:50 It's a fancy topic, right?

46:52 Yeah.

46:52 So for now, out of the box, I can package this up as a desktop app or a mobile app.

46:57 And desktop means Linux, Windows, macOS?

46:59 So yeah, just to make it right, you can package it as a desktop app, Windows, Linux, Mac, and

47:06 there's a web app.

47:06 Yeah.

47:07 On the mobile experience, you can use it as Power BWA app.

47:12 Right.

47:13 So you package it as a mobile app and then you install that as a progressive web app and

47:16 then it's kind of good to go.

47:17 Okay.

47:18 Yes.

47:19 But not like a native mobile experience.

47:22 I'm working on it right now and there is a branch for that.

47:26 You know, you can always observe, you can live life real time.

47:29 Yeah.

47:30 Okay.

47:30 Very last thing.

47:31 There's some stuff we talked about the events.

47:33 You have in there, you talk about how to package it up as an executable and basically that's

47:38 Pi installer.

47:38 And then you have steps on how to package it up as a web app as well.

47:43 Mm-hmm.

47:43 Cool.

47:44 So let me ask you, maybe I'll pull up the roadmap as put that as the background.

47:48 Is this ready for people to build apps with?

47:50 Like what's the state of Flet?

47:52 It's very exciting and it looks quite capable, but should people be using it yet?

47:56 Should they be giving feedback or where are you with this?

48:00 So as it basically like a second iteration, so we've had this proof of concept, like page

48:05 let as a proof of concept.

48:07 And it's still, despite it's like a second iteration, it's still a zero point something.

48:14 So there could be, I don't expect any drastic changes into API, but there could be some breaking

48:21 changes going forward.

48:23 And also to have a complete feature, I would love to have like mobile experience to complete

48:29 the cycle, you know, like web, desktop, mobile.

48:31 But in general, it's really ready to build these apps with apps it made for, you know,

48:38 like simple app.

48:39 Yeah.

48:39 We're talking the forms over data, the little portals and the dashboards that we talked about

48:43 at the beginning, right?

48:44 Exactly.

48:44 So I think it's pretty much ready for, well, front time, why not?

48:48 Nice.

48:49 All modern software is beta, you know, like, yeah.

48:53 So it's like prom, you know.

48:54 Always evolving.

48:55 What's the contributor story?

48:58 Are you open to having other people submit PRs and help out with say tutorials and stuff?

49:04 Absolutely.

49:04 All people welcome.

49:06 Awesome.

49:06 And I know it's a challenge for some projects, but I really want to spend time on that.

49:12 Working with people, writing guidelines, you know, et cetera, like establishing rules.

49:17 So absolutely.

49:18 Because it's not an open source project if you're not accepting PRs, you know, or if you

49:24 don't work with people.

49:25 It's like publish source project.

49:28 For sure.

49:28 Yeah, exactly.

49:29 It's source open, not open source.

49:31 That's right.

49:31 Yeah.

49:32 And only the next.

49:33 Let me put an idea out there.

49:34 You have two really great tutorials here.

49:37 Are you willing to accept more tutorials?

49:39 Sure.

49:40 So over on the flutter.dev slash learn section, they have some tutorials over here.

49:45 Maybe it would be fun if people could like try to create the equivalent of these tutorials,

49:51 but in Flutter.

49:51 I don't know.

49:52 That might be a cool thing to create and see how they come out.

49:54 Yeah, it's a nice idea.

49:56 But you know, maybe it's not even worth a separate tutorial.

49:59 Like, you know, look, in Flutter could be like a single page of gold, you know, like.

50:03 Yeah, absolutely.

50:05 So when I look at this.

50:07 I will take a look.

50:08 Yeah.

50:08 Yeah.

50:08 When I look at this, this looks a lot like a Dart version of Flutter or Flutter looks like

50:14 a Python version of this, right?

50:16 It has this same hierarchical code type of thing.

50:19 There are some differences that we talked about, like state and stuff, but it looks really,

50:23 really similar.

50:23 So if I am a Flutter developer, how easy is it to go to Flutter?

50:28 And if I go to, if I learn Flutter and like, I really need the true native version, how easy

50:33 is it to go to like pick up Dart and then go to Flutter?

50:35 If you're already a Flutter developer, well, the only requirement there probably is you should

50:41 know Python, right?

50:42 Like at the moment.

50:43 Yeah.

50:43 Yeah.

50:44 I'm assuming that you know Python.

50:45 Yeah.

50:45 Yeah.

50:45 Sure.

50:46 Yeah.

50:46 And I think it's pretty acceptable to write something in Flutter.

50:50 I especially love the idea of using Flutter as a prototyping thing or because you can easily

50:58 do something all weekend.

51:00 It is so much easier.

51:01 It's so much easier.

51:02 People who have not tried to write in Dart, I feel like I am constantly chasing what const

51:08 means.

51:09 I didn't mean to double it up.

51:10 Constantly chasing const around.

51:12 I do not understand this language.

51:14 So you might have a class which you're passing as const.

51:18 Maybe this is my complaint as well.

51:20 And you might need to take away that const, but then it's required to have const in other

51:24 places.

51:24 But then it like cascade.

51:25 It's just, I'm like, okay, there's like five places I got to either remove or add const

51:29 because I just want to change.

51:31 Like this is driving me insane.

51:32 And I don't see any of that in Flutter and it makes me happy.

51:35 It sounds like you've been down this as well, Thador.

51:38 Yeah.

51:38 Because maybe you're a perfectionist.

51:40 You're trying to avoid all those warnings.

51:43 Yeah.

51:43 It's a hassle.

51:44 Yeah.

51:45 Yeah.

51:45 So the prototyping story makes me think like maybe you could build out stuff really quick

51:49 because it's, you don't have to deal with all those little weird language edge cases.

51:52 Yeah.

51:53 And I had a few customers, like users on Discord coming from Flutter world.

51:59 So yeah.

52:01 The way back to Flutter from flat is also possible.

52:05 Why not?

52:06 I mean, like if you grow up, grow out of like this flat thing, you know, like, and you need

52:12 something really unique, like animations, you know, like some weird transitions.

52:17 So why not?

52:18 So you can go and learn Flutter and dive into this world, you know?

52:22 Yeah.

52:22 I agree that they should be pretty transferable.

52:24 Certainly knowing one will help you know the other.

52:27 No doubt about it.

52:28 Absolutely.

52:28 And the way you think is real similar.

52:30 So John asks, how do you handle Android and iOS permissions entitlements?

52:34 It sounds like you're not quite there yet, but maybe you have some ideas on where that might go.

52:38 So as right now, we actually, we are not delivering these anywhere, like, but we already building iOS

52:47 Android packages as part of our CI process.

52:51 So they're already there and they're already published into App Store ready to be sent for

52:58 review, you know?

52:58 And do you just put the entitlement in that compilation target, basically?

53:02 Yeah.

53:03 So yeah, if they, all these permissions right now, they have to be put into these pre-compiled

53:09 Flutter client, like Flat client app, or right now we're working on the Flutter widget.

53:17 So Flutter widget called Flat.

53:19 So you can embed the Flat experience into any existing Flutter app.

53:24 So that sounds like you're doing it in reverse.

53:27 So you create a, build a Flutter application, a native one, compile it.

53:32 But what you can do is you can create a section of your UI that is flat.

53:36 Yeah, exactly.

53:37 Imagine you already have an app written in Flutter or native app, like in Kotlin, you know, like

53:44 for, or Swift.

53:46 You can replace part of your app with this flat driven by server-side code written in Python.

53:52 Cool.

53:53 In that scenario, where does the Python run?

53:56 It runs on the server?

53:57 On the server.

53:58 Yeah.

53:58 Okay.

53:59 And you can actually have in this app, your mobile app deployed to client devices.

54:05 You basically have to redeploy code, Python code in the server to deliver new experience,

54:12 new UI, new clicks, you know, like whatever.

54:14 I don't know how relevant this is, but it might be.

54:16 Have you looked at PyScript?

54:18 Yeah, sure.

54:19 You know, if some of the challenges is like, well, how do I end up running the Python part?

54:23 Could you WebAssembly your Python in and get it native and get it locally, like for offline

54:30 version?

54:31 So yeah, people are asking, there are a lot of technologies right now, right?

54:35 If we're talking about PyScript and the WebAssembly, it makes sense for web apps, right?

54:40 You know what?

54:41 And actually, Dart itself is being compiled.

54:45 Okay, right now, it's only part, it's here, Engine is in WebAssembly, but they have, Google

54:51 have plans to compile Dart, Flutter apps into web assemblies as well.

54:57 Okay.

54:57 So it makes sense for web, for mobile, it should be native code.

55:02 Yeah.

55:03 So for mobile, it should be native code.

55:04 I'm not sure, maybe tomorrow we'll see some like engines translating like this WASM into

55:11 native code.

55:12 Yeah.

55:13 If you could run WASM in your native application on iOS, then maybe this has opened some kind

55:19 of door.

55:19 Yeah.

55:19 But again, as far as I know, it's really restrictive environment, mobile phones.

55:25 So...

55:26 Yeah, it's not the same as saying, well, sure, you can use PyTorch or requests or whatever.

55:30 Yeah.

55:31 Okay.

55:31 Well, Fedor, I think we're just, we're out of time.

55:34 But I want to congratulate you on a super interesting project.

55:38 It's really cool.

55:39 Thank you very much.

55:40 Yeah, you bet.

55:41 Now, before you get out of here, you got to answer the final two questions.

55:43 Sure.

55:43 If you're going to write some Python code, what editor do you use these days?

55:47 Nice.

55:47 I love Visual Studio Code.

55:50 Yeah.

55:50 Yeah.

55:50 I mean, I would love, some people recommend trying PyCharm.

55:55 And I believe it's a really great idea.

55:58 Maybe I will look into that, especially if it's like, it's free for open source projects.

56:02 But yeah.

56:03 Right now it's VS Code.

56:04 It's great.

56:05 Cool.

56:05 Well, I can tell you your calculator tutorial works all the way through on PyCharm because

56:11 I just did it right before our show.

56:13 So it's all good.

56:15 It's all good.

56:15 Now, also notable PyPI package, like obviously Flatt is a good one, but other libraries you

56:21 may have run across recently.

56:22 You're like, oh, this is cool.

56:23 People should know about.

56:24 Well, for me, it's a really challenging question because I'm a new guy to Python.

56:29 And I don't know, like I don't have any really any like favorite packages, you know?

56:35 Yeah.

56:36 Well, we can throw Flatt out there.

56:38 How's that?

56:38 So yeah, maybe Flatt is nice.

56:41 It's not disallowed.

56:43 You pip install it.

56:44 You can say that if you like.

56:44 Yeah.

56:45 And you know, actually it's not trivial.

56:47 And I spend a lot of nights trying to put this, you know, wheels right, you know, like

56:53 to include these binaries.

56:55 So it's pretty cool.

56:57 And I can, if you guys have some questions, like how would you repackage those wheels

57:03 during the ECI process?

57:04 So I would be really too happy to share my experience, you know?

57:08 Yeah.

57:08 Awesome.

57:09 Because I learned a lot of packages and the internal structure to understand how it works,

57:13 you know, basically like zip files, you know, like what's inside.

57:17 Awesome.

57:17 All right.

57:18 Well, final call to action.

57:19 People want to get started with Flatt.

57:21 They want to build an app with it or maybe even contribute to it.

57:24 What do you tell them?

57:25 Absolutely.

57:25 Go and try.

57:27 Hope on Discord.

57:28 I'm always online.

57:29 Let me know what you like, what you didn't like.

57:32 We're always listening.

57:34 So, and definitely contributions are welcome.

57:38 So, yeah.

57:39 Awesome.

57:39 And you at the bottom of the homepage of Flatt.dev, you've got a subscribe to our newsletter.

57:44 I guess people can get updates on the project if they want there, right?

57:46 Yeah.

57:47 I haven't sent anything there yet, but yeah, there are a couple.

57:51 It's all about building up the group of people who are interested in what you're doing.

57:55 So, it's mostly Discord right now.

57:57 Yeah.

57:57 Got it.

57:58 So, it's pretty active.

57:59 Yeah.

57:59 Good to know.

58:00 All right.

58:00 Well, once again, super exciting project.

58:03 I've ranted on this before.

58:05 Having some kind of UI framework that is really modern and fresh in Python is super important,

58:12 but it's quite interesting in that space.

58:14 Having a very viable mobile story for Python, also really interesting.

58:20 So, as much as you bring those things forward, you know, more power to you.

58:23 We love it.

58:23 Yeah.

58:24 Sounds great.

58:25 Yeah.

58:25 Thanks.

58:26 Thank you, Michael.

58:27 Yeah.

58:27 Bye-bye.

58:28 Thanks, everyone, for listening.

58:29 Bye.

58:29 Bye-bye.

58:59 Bye-bye.

59:29 Bye-bye.

59:31 Bye-bye.

59:33 Bye-bye.

59:33 Bye-bye.

59:33 find the iTunes feed at /itunes, the Google Play feed at /play and the direct RSS feed at

59:39 /rss on talkpython.fm. We're live streaming most of our recordings these days. If you want to

59:46 be part of the show and have your comments featured on the air, be sure to subscribe to

59:50 our YouTube channel at talkpython.fm/youtube. This is your host, Michael Kennedy.

59:55 Thanks so much for listening. I really appreciate it. Now get out there and write some Python code.

59:59 Thank you.

Back to show page
Talk Python's Mastodon Michael Kennedy's Mastodon