Python for Decision Makers and Business Leaders Transcripts
Chapter: No Python here
Lecture: Probably not for shipping apps

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Another thing where Python is challenged. This one is not impossible, it's certainly doable but it's not as easy as some of the other languages.
0:09 Is shipping packaged up applications to consumers. Now it's easy to ship Python web apps to servers
0:16 and make them run, or data science docker containers to data scientists to run their analysis. Like, that type of shipping stuff is, easy.
0:24 Same as, it's easy to ship the libraries like NumPy Or Jupyter to developers so, they can use to write their code and do the things they got to do.
0:34 What I'm talking about is I would like to give a consumer a final end user an icon they can put in their mac doc click it, and make it run.
0:44 Or they put it in their start menu in Windows and they click the icon, and it runs. They don't necessarily know anything about Python.
0:51 They don't know anything about setting up Python. They don't want to know the thing was created in Python.
0:57 They just want, here's a thing I receive from this company or this project. I double click it, a UI comes up, and magic happens.
1:06 There's two reasons that this is challenging. One, we talked about Python being an intermediate level of goodness for building UI desktop applications.
1:17 There's things like [Cute], Qt for Python. There's thing like WX Python, so yeah you can definitely build some decent UI's in Python.
1:25 But, it's not as easy as say windows forms or like old school visual basic where you had a designer and you drag and drop stuff over.
1:33 Remember that thing I just showed you about IOS and our app? We have that cool visual designer and the properties and all that?
1:39 There's not much of that. I believe the Qt folks have a Qt creator which is kind of like that. I don't know how well it supports Python though.
1:47 Anyway, you can build these desktop apps. It's not as good as some of these other frameworks but it's not bad. But, it's also difficult to turn Python
1:55 the Python source code, the Python run time and the libraries to depend upon into a thing you can give
2:00 to a user with no dependencies and no other requirements. Like, they don't have to set up Python and configure it.
2:06 Just, I want the icon, I just want to double click it and I want to work like Microsoft Word, Firefox Chrome, whatever.
2:13 Let's talk really quickly about some options for making that happen. If you do want to do it you can use something called PyInstaller.
2:21 So, PyInstaller is a thing you can point at a virtual environment with your Python source code
2:26 your dependencies installed, and it will create stand alone executables with these icons like I'm talking about
2:32 for Windows, Linux, Mac OS, Free BSD, Soleris, and AIX. I don't even know what AIX is actually. But it will create them for them.
2:40 So, you can distribute your applications there. And this works pretty well actually. I've done it a few times.
2:46 There's certain weirdness-es and things like why does the terminal show up on this operating systems but just the UI and no terminal on windows.
2:55 There's just, it's not smooth and absolutely perfect. There's just a few rough edge cases. So, I guess the advice I would give you here
3:03 is this might actually totally solve the distribution give me an icon I can double click it problem
3:09 but just test it. Make sure it's going to work for you. This one's been around here for a long time. You can see it's doing this fun razor thing.
3:16 Don't know what the status of it is but it's been recently updated. A newer one this one uses the Rust packaging tools to try to do some more
3:24 but maybe even improve upon PyInstaller called PyOxidizer. It's the same basic idea though. It's going to take your Python code
3:31 it's going to bundle Python the run time into it it's going to bundle the libraries that you said you depend upon and try to run your code.
3:38 So, maybe this is what you need maybe PyInstaller is what you need. If you can get those two to work for your project
3:43 then you're really far down the path of like we can probably use Python to distribute our application. For example, Dropbox does this.
3:51 If you have that little box icon in your start menu or you have it in your task bar or menu bar that is a local .exe or .app file
4:01 that is 100% Python or mostly Python. So, it can be done. It can totally be done. It's just not necessarily the easiest
4:07 pressing to compile button in visual studio and there's the .exe, I copied over and it runs. The streaming of these applications is challenging
4:15 but it can absolutely be done. So, It depends how committed you are to Python this is something that does take some work but it can be done.

Talk Python's Mastodon Michael Kennedy's Mastodon