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