Latest / Talk Python To Me / #245: Python packaging landscape in 2020
Transcript
- 0:00Python is growing incredibly fast, and it's found its place in many facets of the developer and
- 0:05computational space. One area that is still shaky and uncertain is packaging and shipping software
- 0:10to users. I'm not talking about building reusable libraries and hosting them on PyPI. I'm talking
- 0:15about shipping executable software to non-developers. Take a moment and stop and think about the ways
- 0:21you would send an end-user a program built with Python that they can simply run. It's a bit of a
- 0:26mixed bag, isn't it? On this episode, we welcome back Christian Medina to run through the state of
- 0:31Python packaging. This is Talk Python To Me, episode 245, recorded November 21st, 2019.
- 0:38Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries, the
- 0:56ecosystem, and the personalities. This is your host, Michael Kennedy. Follow me on Twitter,
- 1:00where I'm @mkennedy. Keep up with the show and listen to past episodes at talkpython.fm,
- 1:05and follow the show on Twitter via at Talk Python. This episode is brought to you by Tidelift and
- 1:10Linode. Please check out what they're offering during their segments. It really helps support
- 1:14the show. Chris, welcome back to Talk Python To Me.
- 1:17Hey, thanks. How's it going? It's been a while.
- 1:19It has been a while. It has been since the summer of 2018, so not quite two years, but it's definitely
- 1:25been a while since you were on. Previously, you were on to talk about continuous integration,
- 1:30continuous delivery with Python. That's right.
- 1:33And you know, that was a really popular episode, actually. I thought the topic would be popular,
- 1:38but you came across with all these little tools and techniques that people just loved. And so,
- 1:43yeah, it was really great. And we'll probably learn some more about cool tools and techniques
- 1:47this time around, too.
- 1:48Yeah, sure. It was a good episode to kind of get everything plugged together and a nice little
- 1:54summary for all that. So, yeah, anybody that's interested, it's a good one.
- 1:57So, let's maybe fill people in on what you've been up to lately, day to day.
- 2:03Sure.
- 2:04You were on the software development side, but it sounds a little bit like you're also on the testing
- 2:07and process, making sure stuff works for the folks around you, like that they don't build bad software
- 2:13as well.
- 2:13Yeah. So, when we recorded that last episode, yeah, I was mostly doing development side,
- 2:19but I was in a small team, so I was tied into everything, QA builds and everything. But since then,
- 2:24I've transitioned to a different organization and I'm mostly doing QA now. So, QA tooling,
- 2:31which still involves build stuff, but not really developing a product, more developing tools to
- 2:37help test and release code.
- 2:39That's cool. So, you're basically in the developer tool space, but internally for your company,
- 2:44not like JetBrains or Microsoft or something like that.
- 2:47Right, right. And I've done that in my career a lot. I actually like it because I can walk over
- 2:52and talk to my customers and tell them, did you like this? And they were like, no, it sucked.
- 2:56Okay, so I'll go fix it.
- 2:57That is a super cool feeling. I've worked in small offices where basically the users of the software,
- 3:03they were a few offices or a little lab space down. And it was like, all right, what we need
- 3:10for next week is this. Come back three or four days later. This is what I've built. I know you
- 3:14asked for this, but I think this part can be automated too. What do you think about it?
- 3:19Like either like, oh, that's amazing or no, what were you doing? Like, of course you can't do that.
- 3:23And so on and so on. Yeah. It's that quick feedback loop is pretty cool.
- 3:27Yeah. It just helps you produce something productive for people that'll help their productivity.
- 3:32Yeah.
- 3:32Yeah. Yeah. Cool. So, well, that sounds really fun. And, also related a little bit to what
- 3:38we're going to be talking about now.
- 3:40Yeah. Slightly. Slightly. Yeah. So I want to start really high level with our conversation.
- 3:46So the idea is we're going to dig into some of the options for packaging Python applications.
- 3:52And I think before we even dig into the details of how we do that, some of the cool tools
- 3:58that are out there, honestly, I think we have to define what the heck that means. And it's not
- 4:05because we just need to be precise, but I think some different people, they have vastly different
- 4:10expectations and needs and some tools completely solve that. And if your, your desire is different,
- 4:16it's completely broken. Like imagine I want to get my web app onto a server to run consistently.
- 4:24Maybe Docker and Kubernetes is the perfect answer. If I have a accounting application,
- 4:30I want to give to accountants running a Kubernetes cluster is not the right answer, right? Like these
- 4:35are really, really different. So maybe what are some of the definitions and like of what packaging
- 4:41might mean for different people? What's the spectrum out there?
- 4:43Right. So even in the org I'm in right now, we actually have this problem because we have a wide
- 4:47range of tools, right? So if you're building a bunch of services with REST APIs to help you
- 4:53deliver something to that's remote or let's call it cloud-like to people, right? That might,
- 5:00like you said, that's something you might want to package as a Docker container, as a service running
- 5:05on a server, which is a different deliverable than say a double click this icon here, desktop application
- 5:15that you'd want to deliver if you're wanting to say, create a log viewer for somebody to help them
- 5:21process that information, right? Right.
- 5:23Which then is completely different from some utility where you just want to provide a quick library
- 5:29for other people to write more code using your library, right? And all that you'd want to deliverable
- 5:37for all of that would be different and something that makes more sense to the user in the environment
- 5:43that they're in because they're all different environments.
- 5:45Yeah, absolutely. Like I suspect you're kind of on the border at work, right? Because you are working
- 5:51with developers. So it's probably reasonable to say, well, there's a REST endpoint or there is a command
- 5:58line tool. You type this in the command line and magic happens.
- 6:01Right. So the REST endpoint, easy, right? So there's this GUI uses some REST API and you can track your
- 6:07execution of your tests, for example, right? And then you can see how things are going. But when you're talking
- 6:12about the actual test you wrote, then that needs a library for you to access the infrastructure
- 6:19and a bunch of services in that infrastructure that might relate to just stuff you need, requesting
- 6:25resources for testing or using other, you know, integrating with other tooling that will help you
- 6:30with that, right? Which is then completely different from some utility that'll tell me, give me the list
- 6:36all my compute that I have available to run tests on, right? Yeah. And then that utility needs to run
- 6:43on every developer's machine. And then how you distribute that starts getting complicated.
- 6:47Yeah. And do you help these developers that you're working with? Do you help them
- 6:50distribute their tools, maybe to more end user type folks?
- 6:55Not so much. Some of the libraries that the organization runs are or might soon be open
- 7:01sourced. So we might wind up using IPI and GitHub to distribute some of that stuff. Internally,
- 7:06we have like internal private IPI repos and Docker registries and things like that today.
- 7:11Okay. Yeah. Yeah. Very cool. All right. Now I'm going to throw out as part of this high level
- 7:15discussion, an idea. I don't know if it's popular or not. It's not super positive, but I do want to kind
- 7:21of start there because I think this is a pretty serious issue. And I'm going to say that Python's
- 7:28in this broad sense that we've set it up, not necessarily like virtual environments and like
- 7:32pip install, but in the broad sense, Python's packaging of for applications in particular,
- 7:38it's fairly broken. How does that say with you?
- 7:41There's definitely a number of areas that need improvement, mostly because of the part of the
- 7:48problem is that we just have so many different ways of distributing say virtual environments or
- 7:53just the packages themselves or just putting the code together and giving it out to somebody.
- 7:59And part of it is good because just Python is flexible enough for you for allowing you to
- 8:06build whatever makes sense for your org, right? And then everybody puts it out there and then some
- 8:11people use it, some people don't. But if we had the one official supported thing that goes beyond
- 8:16just pip install because pip install involves a pre-existing Python executable, which is when
- 8:23things start getting complicated.
- 8:24Exactly. You've got to have a well-known, somewhat decent environment. You've got to have a certain
- 8:30version of Python or a range of version. It's got to be over 3.5 or say over 3.6 if you're using
- 8:36f-strings or whatever version it has to be. That has to all be in place and set up.
- 8:43Even when that works, it's usually difficult to give somebody an icon to double click to make their
- 8:48app go, right? Like, why is my thing not like Firefox? Well, you see, there's all these rules. Let me tell
- 8:56you about dependencies. Nobody wants to hear that, right? They want to go, I want the icon that I click.
- 9:02Yeah. It gets even more complicated once you're distributing compiled code along with it, like some
- 9:08of the machine learning stuff or whatnot, which is why you see all these alternative systems like,
- 9:13say, Anaconda exists to just help with that, right?
- 9:17Right. Yeah, yeah. That's a good point. That is sort of why Anaconda exists. I mean, it also focused a
- 9:22little more on the developer side, but right, it kind of tries to solve some of the challenges of how do I
- 9:26get some of the foundational bits in place for the developer users, right? Yep. So there was, here's a
- 9:34quote from the PyOxidizer page. So Greg, I believe, is on board with this idea. And this is from Russell
- 9:43Keith-Magee's PyCon 2019 keynote talk. So he's on idea. He's on board with this idea. But he gave a talk
- 9:51basically about these black swan events for Python. Are you familiar with this idea? Did you see his talk?
- 9:58Yep. And it was discussed in a couple episodes. I think you guys talked about it probably in a Python
- 10:03bytes episode before as well. Yeah, I do think we might have done that. Yeah. Yeah. So the idea of the
- 10:08black swan event roughly is like this thing that is very rare that people don't see coming in an
- 10:15ecosystem and society and cycles, whatever, that are potentially existentially critically bad,
- 10:23right? So the original example was something like a turkey thinks the farmer loves them. Every day,
- 10:30the farmer comes in and greets them, treats them really well. Feeds them. Yeah, feeds them. And nobody saw
- 10:36Thanksgiving coming, right? Something like that or, you know, things along those lines. I guess maybe
- 10:42another one might be traditional photography and Kodak and digital cameras, right? Like that might like
- 10:49nobody saw that coming in the sense, like well enough, I guess. I'll give you one more with server
- 10:55development and the commoditization of that and what happened with the larger manufacturers when
- 11:02all the cloud companies started to develop their own servers. Yeah, probably first they're like,
- 11:07you know what? It's no big deal that there's all these cloud hosting places because they're just
- 11:12going to buy our servers and put them in their data centers and we'll be fine until they said,
- 11:15you know what? We could do better on efficiency and our biggest cost is electricity. So thanks,
- 11:19but no thanks. Yeah, exactly. Yeah. Yeah. So Russell Keith-Magee said there are a couple of things that he
- 11:26believes are these black swan type of threats for different parts of Python, right? He loves Python,
- 11:33but like what might undo this great success that Python has had over the last couple of years and
- 11:39one of them is definitely about packaging. Yeah. Look, I believe some of the others, there was mobile,
- 11:45there was packaging and there was a few others, but those are the two that really stood out to me.
- 11:50It was like, you know, people who are coming into programming,
- 11:53why would they come into Python if they can't take the cool little app they built and share it with
- 11:57their friends, right? They're going to do it in JavaScript or they're going to do it in something
- 12:01else where they can package it up and share their game or whatever, right? Exactly. Yeah. So that's
- 12:06why I think this is a big challenge, right? I think it's important. It's also tricky, but I think it's,
- 12:10I do think it's really important. Also, you probably heard me go on and on about like building GUIs in
- 12:15Python, right? Like this is another, another one. And I've done my GUI thing too. So yeah. Yes,
- 12:19you have. That's right. You gave a talk at PyCaribbean about it. That's cool. And
- 12:23I think one of the reasons people don't build more desktop applications and GUI applications in Python
- 12:29is because one, yeah, there's a, there's a little bit of a gap in the tooling there, but things like
- 12:34cute and what, whatnot, they're actually quite decent. Cocoa touch and not Cocoa touch, but some of the
- 12:41PI OBJC or whatever, the wrappers around the Cocoa APIs, those are probably pretty much okay. But
- 12:49even once you build those, then you come back to this packaging problem that we're talking about here.
- 12:55I think it's, it's so much of a problem that people don't put any energy to build out the GUI apps,
- 13:01the GUI capabilities, because heck, once you build them, it's, you still can't really give them to
- 13:05anybody in like a super decent way. So why, why bother building, like, you're just going to build a web
- 13:10app or, or whatever. I think there's a bit of a chicken and egg problem where like people don't work on
- 13:15trying to distribute their application because it's so hard to build the type of applications that get
- 13:20distributed. So like, it's just kind of like, it's a little anemic in that space. So what I'm trying to
- 13:25say.
- 13:26No, no, I'm with you. And, and even, so when I said like, I did my GUI thing. And so I have my attempt
- 13:32at a GUI framework where I went through the analysis or what you're just talking about. And I
- 13:36just pretty much just gave up and said, well, the web one, we can just make our GUIs in the web.
- 13:43Let's figure out how to do that a little bit easier and just go down the Chromium distribution
- 13:48kind of electron JS equivalent to do everything. And then everybody just gets a web browser,
- 13:53which is cool that that works. But then when you start thinking about the, what else you're
- 13:58distributing with your application, just to do a simple GUI or whatever, like an entire web browser
- 14:02or whatnot, then just seems kind of wasteful as well. Yeah.
- 14:05Yeah. Yeah. I do think actually that might be something that happens for Python, something
- 14:11like electron, right? That's actually really totally possible. And the WebAssembly stuff
- 14:16could make that really interesting as well. If you could package up the runtime as a web
- 14:19assembly and just drop that with your, your electron distribution.
- 14:22I managed to do it. It works. I'm not using electron itself. I'm just using the stuff that
- 14:26electron uses in the backend. So it's all totally possible.
- 14:31This portion of Talk Python To Me is brought to you by Tidelift. Tidelift is the first managed
- 14:36open source subscription, giving you commercial support and maintenance for the open source
- 14:40dependencies you use to build your applications. And with Tidelift, you not only get more dependable
- 14:46software, but you pay the maintainers of the exact packages you're using, which means your
- 14:50software will keep getting better. The Tidelift subscription covers millions of open source projects
- 14:55across Python, JavaScript, Java, PHP, Ruby, .NET, and more. And the subscription includes
- 15:00security updates, licensing, verification, and indemnification, maintenance and code improvements,
- 15:06package selection and version guidance, roadmap input, and tooling and cloud integration.
- 15:11The bottom line is you get the capabilities you'd expect and require from commercial software.
- 15:16But now for all the key open source software you depend upon, just visit talkpython.fm
- 15:22slash Tidelift to get started today.
- 15:26All of this conversation sort of started from this, it's almost like a retrospective on a journey
- 15:33that you went on. This blog post that you wrote, four attempts at packaging Python as an executable.
- 15:40I'll put the link for that original article over there. So maybe just tell us a little bit about
- 15:45what that was all about in the journey and then we can dive into some of the details that we pulled
- 15:50out of there. Sure. So in the, even in the previous episode, when I was working on mostly CI/CD stuff,
- 15:56as part of that CI/CD system, there's a, you know, you need to execute some code inside it to like keep
- 16:03your process going. Right. And one of the limitations I had at the time was that the containers that I was
- 16:09using required Python to be installed in it. And I wanted to remove that dependency. I knew it was
- 16:14possible to compile my code down to an executable. I wanted to figure out what, what method worked for
- 16:20me. And I tried, I didn't have a lot of time. So I tried four systems, which at the time was
- 16:25Cython, PyInstaller, Nutka and PyOxidizer. Right. And each one had, you know, I fumbled through most of
- 16:35them and, and, you know, I'd use PyInstaller before. For simple cases, you could get it to work,
- 16:38right? Like Cython, you sort of got it to work, but only for a simple app. Yeah, exactly.
- 16:42I got what I wanted. It works pretty well. It's been in production for my side of the world for a
- 16:47while. So I'm, I'm happy with it. But yeah, so out of that came, you know, this analysis of where we're
- 16:52at with like how to turn your Python script into a double click executable kind of thing.
- 16:58Yeah. And I definitely think it depends on what level you need to be at, right? If you're building
- 17:04a tool for fellow developers, that's one thing. If you're building a tool, like I said, for accountants
- 17:08or lawyers, exactly. They expect something to put next to their word icon in their macOS doc or
- 17:15whatever, like that's a different type of thing. Right. So let's go through it. I guess we've got
- 17:21it broken up into some, some nice taxonomy here. Let's talk about delivering an application first.
- 17:29Yeah, sure. So just to give the overall taxonomy a little bit, right? We have three things based on
- 17:35what deliverable, what your end goal is from having this Python package, this distribution to your end
- 17:42user, right? And we have the idea of putting it together as an application that you run or putting
- 17:48it together where you just distribute a virtual environment with it, or you just give out a specific
- 17:53executable. And then there's some other things along with it that we talk about later. But if you want
- 17:59to deliver an application or a service type of application, one of the best things to use these
- 18:04days is Docker. I've used it successfully to run pretty much everything Python related. And in fact,
- 18:11there's an official Docker image that you can run that's based on Debian, I believe. And I use that in
- 18:17my automated testing all the time.
- 18:19That's supported by the PSF. I've learned, right? That's pretty interesting.
- 18:22Somewhere in the Python builder, a little bit after that comes an official Python Docker image
- 18:27that you can just pull from and use.
- 18:29Yeah, that's cool. Docker is cool. But it makes me a little bit nervous because you're taking like
- 18:34layers of customized operating system that maybe different people have, you know, changed or built
- 18:40on stuff. And then, you know, how sure are you that those are not, you know, that somebody hasn't
- 18:45slipped something in there. I think the Docker files are maybe a safer bet, of course, right?
- 18:50To just like build it yourself rather than to download the full container.
- 18:53But you still need to start from an image, right?
- 18:56Yeah.
- 18:56So if you start from, say, some official distribution of something like the Python one,
- 19:01but just the same, there's like all kinds of other images from Postgres, Ubuntu, MySQL,
- 19:05whatever that you can use. You can, you know, slowly build up with your Docker file,
- 19:09whatever dependencies it is that you need.
- 19:11Now, the advantage of this is that you're distributing all the dependencies for your
- 19:16operating system along with the Python executable that you need along with your actual application,
- 19:23right?
- 19:23Yeah.
- 19:24That makes the, it worked on my machine problem go away, essentially.
- 19:29I do think Docker is a pretty cool solution. If having Docker running on your operating system,
- 19:37it's not a big deal to you, right? You've already got the desktop Docker or whatever.
- 19:41Or it's installed on your server.
- 19:43Right.
- 19:44Then this is a pretty solid way, certainly to deliver like services and stuff.
- 19:48If it's just a matter of pulling it down and say, you know, Docker run this container or whatever,
- 19:54then it's, it's okay.
- 19:54Yeah. I've also come across a couple of applications, I would call them that where you,
- 20:01you run a CLI and the, your interface is the CLI, but in the backend of CLI,
- 20:06Docker runs something for you. So it all runs in its own little contained environment.
- 20:10And then just exits.
- 20:11Yeah. One of the slicker instances of this was from Gigantum. Are you familiar with them? They're pretty new.
- 20:18Nope.
- 20:18So I just had them on the show three or four episodes ago, not very long ago.
- 20:22Okay.
- 20:23And basically what they are is they are like a collaboration environment for data science.
- 20:28So they distribute their application to you as a Docker container. And then each environment you create starts from one of these containers as well.
- 20:38So either it's like an Anaconda pre-configured container or it's a, you know, just a bare one with Python or whatnot.
- 20:45But yeah, it's really cool that the PS has enough PSF has an official Docker container. Cause I didn't, I didn't realize it. That's great.
- 20:51Yeah. Yeah. It really does help it along.
- 20:54Yeah. The other thing that can be tricky with Docker is you're trading that,
- 20:59well now set up this version of Python in this way for now make sure you expose these ports and the right way.
- 21:05And you map that volume over there. There's just like, there's still some friction to distribute and stuff as a Docker container, right?
- 21:12Yes, that's correct. So if once your application, if you get like something that's really somewhat complicated and you need to have persistent data and things like that,
- 21:21then you got to worry about making the proper volumes or mapping the correct directories into it so that you can persist the data outside the container or even access it without having to get into the container.
- 21:32And then when you have to do things like when you depend on networking in some way, like if say you're running HTTP server, then you need to make sure you pass in the right commands to open the correct ports for it to work for you.
- 21:43So that's some of the complications you get there.
- 21:45But it could get wrapped up, right? Like you don't, the example you pointed out where you don't really know that you're doing Docker when you're working with your CLI.
- 21:54It just happens to Docker behind the scenes to make things reliable. Like that's a pretty good use case.
- 21:59Yeah, I think so.
- 22:00Cool. All right. So another one that you have out there, which is maybe pre-Docker.
- 22:05Yes.
- 22:06I'm just going to give you a virtual machine and you can just run that.
- 22:10Yep. And along with that. And so like the original thing was, yeah, here's your virtual machine application, essentially.
- 22:16And you just, it starts an entire operating system that you can run in VirtualBox, but along as well as other virtual machine environments.
- 22:25But along with that came Vagrant, which was kind of like a Docker file for virtual machines, except before Docker files.
- 22:33And so you can sit there and say, oh, it's a VM. It's going to have this configuration for your network, for memory, CPU, whatever, file systems and whatnot.
- 22:41And spins up essentially a pre-configured OS, fully packaged OS for you.
- 22:47And now, of course, when you distribute a VM, you're distributing a whole OS.
- 22:52So it's going to be a large image that you're giving out, which is the difference with something like Docker, because it's a layered file system.
- 23:00Then you only need to, you only distribute the pieces that you're adding on top of some basic image.
- 23:06Any changes you make to that virtual machine maybe requires like a new 5 gig download, whereas a change or two Docker file might just, well, you just rebuild like the last layer of that Docker image.
- 23:17Yeah. And then you can find, like for the Docker side, you can find, you know, tiny OS images in the tens of megs versus a full VM, right?
- 23:27That'll be like probably a couple of gigs. You can get small VMs too.
- 23:30Yeah, a couple of gigs to start. Yeah, yeah, true.
- 23:33The other thing that seems like a challenge with the VM option is it's now your puppy.
- 23:40You've got to caretake it, right? So if it has a security vulnerability or something like that, then you've got to go in there and like patch it and whatnot.
- 23:48Right. Which you technically still have to do with Docker.
- 23:51But if you spin off your image on top of an existing one, for example, let's go back to the Python thing.
- 23:59If I have my application built on Python 3.6 and 3.7 comes out, I just need to change my base image to 3.7 and stuff just starts working on top of that.
- 24:09Right. Or you could just live a little bit out on the edge and do something like Ubuntu Python colon latest.
- 24:14Right. Exactly.
- 24:15Something like, right. Whatever's the latest. If there happens to be a new latest when I rebuild it, get the new latest and then give me that.
- 24:22That one's probably patched at the OS level and got the newer version of whatever in it.
- 24:26Right. Exactly.
- 24:27There's a risk that it's not 100% repeatable potentially, but things like Linux and Python, they're pretty backwards compatible.
- 24:35Yep.
- 24:35As opposed to I now have to log into my Docker images and patch them. That's another level of effort.
- 24:42Yeah, exactly. That's a lot more complicated.
- 24:45Usually, it's just considerably easier to just update the base image.
- 24:49Right, right, right.
- 24:50It's also a great little test thing, right? If you want to check whether your code works in 3.7 versus 3.5, for example, just start an image with 3.7 in it and you're done.
- 25:02Yeah, and run it through your CI and see what happens.
- 25:04Yep.
- 25:05Another thing that might be a benefit of the Vagrant VM style, though, could be background work, background jobs and whatnot.
- 25:13Like, Docker, typically, it has the Docker container, but then there's, like, the one thing it runs as its life, right?
- 25:20Like, there's not a system D in Docker that I'm aware of and things like that, right?
- 25:25Right. Depending on what you want to do, right?
- 25:28Because you can configure it to do whatever, pretty much.
- 25:31And there's, like, privileged containers, too, right?
- 25:34So, you got some limitations on your normal stuff, but you can also add other kernel privileges to it to help it communicate or create new devices and whatnot.
- 25:42And, yes, the process manager and service managers inside the container aren't there by default.
- 25:49So, if you want to do that, you get to configure it yourself.
- 25:51Right.
- 25:52Right, which is complicated, but it can be complicated, but it's also good because you get, like, a really base thing.
- 25:58So, if you don't need it, you don't have it.
- 26:01Yeah.
- 26:01One of the things that's cool about that, though, is you have all the control, right?
- 26:05That's correct.
- 26:06Once you set it up, it might be painful to set it up, create that Docker file that's just right, but once you got it, like, you put it in version control and you just forget about it, right?
- 26:15You just build on top of it.
- 26:16Yeah, exactly.
- 26:17Yeah.
- 26:17Yeah.
- 26:17Yeah.
- 26:17And you can have, like, a build container, for example, in version control just exists to build your code, for example, or package your code.
- 26:25Yeah.
- 26:25And then just gets destroyed afterwards.
- 26:28Yeah.
- 26:28Yeah.
- 26:28So, we've got these different container technologies, like, really big shipping container style, and then, like, the small, I don't know, Tupperware style with Docker and VMs.
- 26:38Right.
- 26:38But we also have, you know, things like PyInstaller, right?
- 26:41Yep.
- 26:41So, with PyInstaller, it has been around for a while.
- 26:44That's what I used to distribute the GUI stuff we were just talking about earlier.
- 26:50So, PyInstaller can take your Python application, like you pointed to your directory, and it can output fully installable application in both Linux, Windows, and Mac.
- 27:02So, in Mac, you'll get a .app, you know, in Windows, you'll get an executable, and for Linux, you'll get another executable file.
- 27:10I used it recently to do something simpler, which is what I discussed in my recent article, but I used it in the past to not only write a Python app that ran, say, a WebSocket server in it, right?
- 27:23It also included an entire Chromium browser along with it and got delivered almost like an Electron application.
- 27:30Yeah, that's super cool.
- 27:31Yeah.
- 27:32I do think PyInstaller is quite nice.
- 27:34It's been around for a while, but it seems to be, like, one of the go-tos that people are keeping around.
- 27:39Yeah.
- 27:39So, actually, after I wrote my post, I got a number of folks that pinged me when, like, talking about how great PyInstaller is, and they've been using it for a while.
- 27:46Yeah, yeah, super cool.
- 27:47This is pretty close to here's your executable you can have and run.
- 27:53Yeah, just double-click and go.
- 27:54Yeah, I've had pretty good success for it.
- 27:56I used GUI, you know, GUI, G-O-O-E-Y.
- 27:58Yep.
- 27:59I used GUI to build a little app, which was a super simple thing, and then I packaged it up with PyInstaller.
- 28:07And it was good except for it ran fine on Windows.
- 28:11Like, it had a .exe.
- 28:13It, like, had an icon.
- 28:14You double-clicked it.
- 28:15It did the thing.
- 28:17On macOS, I had a .app file.
- 28:19Mm-hmm.
- 28:20And you double-clicked it and did its thing, except for it also opened a terminal kind of off to the side.
- 28:26Oh, really?
- 28:26Which, for the life of me, I couldn't get it to go away.
- 28:28Like, the commands to make the terminal not show were obviously working on Windows, but not on Mac.
- 28:33And I was like, ah, it's so close to working.
- 28:35Oh, that's interesting.
- 28:36Yeah, yeah, yeah.
- 28:37So, I still think there's some rough edges, but it definitely seems...
- 28:40Like, the other stuff I tried didn't get that far, right?
- 28:43So, that was cool.
- 28:44Yeah, so I haven't had that experience.
- 28:46But I have had complications, because when you package your application, now you have to worry about things that depend on some of the Dunder methods to come in with Python, like the Dunder file stuff.
- 28:57Which is supposed to tell you the directory in which the file that you're working on is located.
- 29:03Right.
- 29:04Well, that's kind of different, because the way PyInstaller works is it bundles your application, all the files, and whatever extra data you want with it, and it bundles a Python interpreter in it.
- 29:14So, when it runs, it just extracts all this stuff into some internal directory that you're not aware of.
- 29:21So, Dunder file just doesn't work.
- 29:23It gives you anything.
- 29:25I can't remember.
- 29:26It's wrong, right?
- 29:27So, but PyInstaller provides its own little API to get the actual directory where the files actually exist.
- 29:33So, you just got to be aware.
- 29:34You do a check in your Python code to say, oh, we're inside PyInstaller, so we need to check here and go here instead.
- 29:40Okay, that's interesting.
- 29:41Yep.
- 29:42Can you use the Dunder file to still get, like, I need to go up one folder and get that other file next to it, or is it even relative stuff is not really working?
- 29:52Even relative stuff is not quite set up right.
- 29:55Okay, but if you build for it, it's not a big deal, it sounds like.
- 29:58Yeah.
- 29:58Yeah.
- 29:59And then another option is, I mentioned Russell Keith-Magee.
- 30:03Right.
- 30:03And his big project is the whole Beware project.
- 30:05And one of those is about packaging, right?
- 30:08Yeah, briefcase.
- 30:09Yeah, briefcase.
- 30:09And so, you know, Beware is a whole slew of individual repositories that provide different functions, specifically a way to, together, they provide a way to build cross-platform Python applications, which involve GUIs in mobile devices, as well as your desktop app or the web.
- 30:30And as part of that, they need a way to package the application.
- 30:32And so they built a briefcase, which is the repo that lets them do that.
- 30:36And so you can take, essentially, write a base app and using briefcase, produce, you know, an Android application and iOS application and everything else.
- 30:47I haven't particularly used it to do anything major.
- 30:52So I don't know a lot about the internal details, but I know it's there and people are working with it.
- 30:58Yeah, certainly it's pretty interesting that it has iOS and Android.
- 31:01Yeah.
- 31:01And I have seen the apps work.
- 31:03And, you know, Russell's done several talks on how that all does all this stuff.
- 31:08It's actually pretty neat, all the things that they're doing.
- 31:10Some of the Android stuff, last I checked, was transpiling some of the Python code.
- 31:15Some of the iOS stuff was directly calling into Objective-C, a few things.
- 31:19So it's pretty neat.
- 31:20Yeah.
- 31:21So that is some subset of the options for delivering an application, right?
- 31:27Like, I want to have the whole environment come along and whatever that takes, if that's a VM or bundling stuff up like Chrome or whatever you need, do that.
- 31:36Maybe another level is delivering a virtual environment, right?
- 31:41This sounds like it's most useful kind of for developer and automation and server type stuff.
- 31:47Great.
- 31:47So say you have an organization or customers that you know are on a set Python interpreter.
- 31:53So you don't need to bundle your Python interpreter with you.
- 31:57Then you can use some of these tools to bundle your application along with all of its dependencies into one file.
- 32:04So the ones I'm talking about here are PEX, for example, which was built by the folks at Twitter and SHIV, which was built by the folks at LinkedIn based on the PEX stuff.
- 32:16And the idea is they take all your code and they bundle it into one file and you can feed that file into Python and it follows a, I forget, I should have made note of that.
- 32:26There's a PEP that explains how to build these zip apps.
- 32:31PEP 441.
- 32:32There you go.
- 32:33Python zip applications.
- 32:34Yeah.
- 32:35Right.
- 32:35And so then with one command, you can just feed that into your Python interpreter and it knows how to unpack it and run all the stuff in it.
- 32:41Nice.
- 32:42And does PEX and SHIV, do these package up the dependencies?
- 32:45Yes.
- 32:46Like if I depend upon HTTPX or requests or Sook Alchemy, it'll take it with it?
- 32:50It'll do it.
- 32:51Yeah.
- 32:51That's pretty cool.
- 32:52But typically the virtual environments, at least on the Unix, Linux, macOS systems, are like symlinks back to the real Python, right?
- 33:01They're not full copies of Python.
- 33:03Right.
- 33:04Right.
- 33:04Yeah.
- 33:05So is that kind of how it works?
- 33:06It's like, here's a little virtual environment shell and just link back to the main Python and then run?
- 33:12Right.
- 33:13So you'll be using whatever the Python it is.
- 33:15And I haven't done this, but I imagine you could make a virtual env with your Python interpreter that you want to use.
- 33:21And then in that virtual env run your PECS or your SHIV package code.
- 33:23Yeah.
- 33:24Yeah.
- 33:24I would think so as well.
- 33:25Yeah.
- 33:26So you still, basically the idea is you still got to have Python bare bones as a thing, the version that you need as a thing.
- 33:34There to bootstrap.
- 33:36But once you have that, at least you don't have to say, first step is create the virtual environment.
- 33:40Second step is pip install dash are the requirements.
- 33:43Like you can skip all of that.
- 33:45Long as Python is present, you can basically run it potentially.
- 33:49That's correct.
- 33:49Yeah.
- 33:50Okay.
- 33:50Yeah.
- 33:51That looks really cool.
- 33:52When I first saw that, I was like, oh, please let this package up the Python runtime with it.
- 33:57And no, you're right.
- 33:59It just builds on top of that PEP 441 to say, basically you can create these zip versions that are directly executable by Python.
- 34:09That's it.
- 34:09Yeah.
- 34:10Yeah.
- 34:10Yeah.
- 34:10So if you have like a, in a large organization, sometimes you have a standard virtual developer, virtual machine or developer laptop or desktop stuff that you distribute to everybody.
- 34:20And if you have the stuff in place, which not everybody does to automatically keep that up to date with say whatever Python interpreter it is that you're running, then you can make a safe assumption that your customers, your users are all going to have this Python environment and just go from there.
- 34:36Yeah.
- 34:36It definitely seems like an interesting way to ship stuff to a server.
- 34:39Right.
- 34:39Instead of creating the environments and setting them up there and installing the packages, just like, I'm going to take this zipped up virtual environment, send it over there and say run.
- 34:49It's not quite Docker works on my machine level, but it's closer.
- 34:55Right.
- 34:55So other things you'd have to think about at sites from the interpreter would be any other like external dependencies of your package.
- 35:02Those will probably not get zipped up with it.
- 35:04I think there's some options to help that along on both of them, but I'm, I don't know all the details with that specifically.
- 35:10Right.
- 35:10But maybe you need Redis on the machine and like, that's not a Python thing.
- 35:14Or you need lib MySQL.
- 35:16I see.
- 35:17Yeah.
- 35:17Or something like that.
- 35:18I'll throw one more into this part of the taxonomy delivering as a virtual environment.
- 35:22PIPX.
- 35:23Are you familiar with PIPX?
- 35:24I am.
- 35:25I use it a little bit.
- 35:26Yeah.
- 35:27I haven't done much else after initial config.
- 35:30Yeah.
- 35:30Yeah.
- 35:30So PIPX is interesting because PIPX, if you have Python on your machine and you pip install PIPX, from then on, you can do basically the way things like homebrew or chocolatey work for installing like utilities into your, your OS.
- 35:47If those utilities are based on Python, PIPX serves the same role as say homebrew.
- 35:53Right.
- 35:53Right.
- 35:54So I can go, and if I pip install --user PIPX, from then on, I now have a PIPX command.
- 36:00And I could say like PIPX install glances.
- 36:03And glances is like a cool terminal sort of process explorer type thing with, you know, ASCII bar graphs and whatnot.
- 36:12Right.
- 36:13So if I wanted that, I could say PIPX install glances and we'll create a dedicated virtual environment just to run and install glances.
- 36:22And if then, if I want HTTPY, which is a cool alternative to curl, that's Python basic, I say PIPX install HTTPY and it'll actually go and create a dedicated isolated environment for that command line tool.
- 36:32So if you've got a command line option that you want to, a command line tool that is Python based and you want to be able to have it upgrade itself because you can say PIPX upgrade all and stuff like that.
- 36:44And it's isolated.
- 36:45It's not being installed in one of your projects.
- 36:47It's just something you want on your machine.
- 36:48PIPX is actually a pretty cool option.
- 36:50Yeah.
- 36:50Like I would use it for, I would even use it for something like a linter or a, you know, install flacate.
- 36:57And then you can use, when you type flacate anywhere, it'll just run your PIPX frozen essentially.
- 37:02environment for that.
- 37:04Yeah.
- 37:04Yeah.
- 37:04That is pretty cool.
- 37:06And then along with that, if you want to create a package that fits into that world, I want to create a package that I'm going to create as a tool for somebody.
- 37:14Then you can create an entry point in your package, right?
- 37:18Which is a thing you can do in your, I think in the setup PY, where you put it.
- 37:22Yep.
- 37:22Yep.
- 37:23And you say, here's the command and here's the entry point.
- 37:26And like, here's actually what that means in terms of my package, right?
- 37:29Like black or whatever.
- 37:31Right.
- 37:32Yep.
- 37:32So you can set those up.
- 37:33And then if you install them with PIPX, now you're managing that almost as a separate command line set of APIs.
- 37:40Right.
- 37:41That could automatically be updated.
- 37:42Obviously you can install them with PEP elsewhere, but PIPX is cool because it's isolated and automatically, well, upon request will automatically upgrade stuff for you.
- 37:51Yeah, no, that's another cool utility.
- 37:52This portion of Talk Python To Me is brought to you by Linode.
- 37:57Whether you're working on a personal project or managing your enterprise's infrastructure, Linode has the pricing, support, and scale that you need to take your project to the next level.
- 38:06With 11 data centers worldwide, Linode delivers the performance that you expect at a price that you don't.
- 38:21Get started on Linode today with a $20 credit and you get access to native SSD storage, a 40 gigabit network, industry-leading processors, their revamped cloud manager at cloud.linode.com, root access to your server, along with their newest API and a Python CLI.
- 38:37Just visit talkpython.com.com when creating a new Linode account and you'll automatically get $20 credit for your next project.
- 38:45Oh, and one last thing.
- 38:46They're hiring.
- 38:47Go to linode.com slash careers to find out more.
- 38:50Let them know that we sent you.
- 38:54All right.
- 38:54And then the third part of our trifecta, three or four, something like that, is basically what I started with.
- 39:05I want an icon next to Firefox and Word in my doc.
- 39:09I click it and I want to see it run and do its thing.
- 39:12Right?
- 39:13Like that type of thing.
- 39:15Take us through what our options are here.
- 39:17Great.
- 39:17So we already kind of discussed PyInstaller and that's the best one for the icon, double click and go.
- 39:23Yeah, it works for all the operating systems, right?
- 39:25It works for macOS and Windows and Linux.
- 39:27But don't you need those systems in place to build the deliverables?
- 39:33That's correct.
- 39:33Right?
- 39:34Like if I just have Windows, I'm in trouble because I don't have a Mac to build my Mac version.
- 39:38Right.
- 39:39In fact, to the point where I even considered it would be interesting to set up some online stuff that creates PyInstaller packages for you
- 39:47that just somebody that's essentially renting out the Windows or the Macs for doing it.
- 39:53Right?
- 39:53Yeah.
- 39:53That would actually be a really cool service.
- 39:55It's like, here's my Python application.
- 39:57Here's its icon.
- 39:59Here's what I wanted to just make that for all the operating systems and give it back to me as like an MSI installer on Windows,
- 40:06a .app on a Mac and a Linux binary or something like that.
- 40:09Right?
- 40:09That would be a super cool project.
- 40:10And yeah.
- 40:11So PyInstaller gives you that.
- 40:12And, you know, we mentioned it earlier.
- 40:14And you can also get just a package application without all the extra pretty stuff along with it.
- 40:19But the one that makes it the most pretty so far for me has been PyInstaller.
- 40:24Yeah.
- 40:25Now the next contender.
- 40:26So actually, before I go with that, let's just talk about Newtka a little bit.
- 40:30So that package has been around for a while.
- 40:34And so PyInstaller produces and packages all of your stuff together for you.
- 40:39It doesn't compile it for you.
- 40:42Right?
- 40:42Okay.
- 40:43Yeah.
- 40:43It just takes Python along with it.
- 40:46And then it like drops your files out and then like runs those.
- 40:49It doesn't fundamentally change what's happening.
- 40:53That's right.
- 40:54It just delivers the two pieces and it clicks them together and says go.
- 40:57Like CPython already.
- 40:59Yeah.
- 40:59Right.
- 40:59If you want to actually compile it and get some extra speed boosts out of having an actual compiled C code instead of an interpreted language,
- 41:08then you can use something like Newtka, which actually produces the one file.
- 41:13You can just .slash run or double click and get it to run your stuff.
- 41:18Right?
- 41:19Now there's, of course, since you're compiling it, things get a little bit more complicated and you have to start thinking about having compilers,
- 41:27having the correct libraries in order to do all of that and the dependencies of those libraries.
- 41:32So it's slightly harder to do it.
- 41:35But you'll get in the end code that doesn't, you know, when you run your application in PyInstaller, you're extracting the application and then running it.
- 41:45But if you run it on something like Newtka, you don't need to extract it.
- 41:48It's just the one file that just runs.
- 41:50Right.
- 41:51It's converted to machine instructions that just do its thing.
- 41:54That's correct.
- 41:55Yeah.
- 41:55So that sounds actually like an incredibly good option.
- 41:59Right?
- 42:00It's got to run pretty fast.
- 42:01It sounds like it's nice and independent.
- 42:03That's great.
- 42:04But what if I depend on other complex things?
- 42:09Like I'm using NumPy or I'm using SeqAlchemy, which has its own compiled bits or something like that.
- 42:18So if you're using something like NumPy, then you're not going to get a lot of speed boosts out of it.
- 42:23Right?
- 42:24Right.
- 42:24Because you're already running at C.
- 42:26Is it going to take NumPy along with it?
- 42:29Like, can it handle like dependencies of this type?
- 42:32Do you know?
- 42:33Pretty sure it can.
- 42:34I haven't had to do it myself.
- 42:36Yeah.
- 42:36I've not tried either.
- 42:37Yeah.
- 42:37Yeah.
- 42:37I mean, if it could, that would be pretty cool, actually.
- 42:39Yeah.
- 42:39All right.
- 42:41Want to talk about the new kid on the block?
- 42:43The new kid on the block is PyOxidizer, which has come up a few times this year already.
- 42:49Clever name.
- 42:50Yep.
- 42:50It's built on the packaging tools that the Rust programming language brought with it.
- 42:57And so it can produce executables for you.
- 43:02It still bundles things as well.
- 43:05The difference is that instead of extracting them into the file system like PyInstaller does,
- 43:10it extracts it into memory.
- 43:13So you'll get a faster startup time when, and all your library loads are going to happen
- 43:18straight off of memory because it's all mapped in there.
- 43:20That sounds really good.
- 43:21I know that you tried this on your example in the article that you wrote and you didn't
- 43:25go with this.
- 43:26That's correct.
- 43:27Like, if I had to just guess, close my eyes and say, all right, I don't really know too
- 43:31much, but I'm going to guess, I would, I would actually guess PyOxidizer might be the
- 43:35place to start because it's a little fresher, but what was the challenge there?
- 43:39So there's just a couple of different things similar to the PyInstaller stuff.
- 43:43Dunder file doesn't work.
- 43:45So you got to configure a few things.
- 43:47And in this case, it's a slightly more complicated because it's not like it's a different directory
- 43:51because there's no directories in memory.
- 43:53In memory.
- 43:53Yeah.
- 43:54Yeah.
- 43:54Right.
- 43:55But they have like very extensive documentation on how to get past it.
- 43:58And so that, that was like my biggest holdup, which at the time to me just kind of felt like,
- 44:03I need to think about it a little more.
- 44:05So I just put it on the side as a come back to this later.
- 44:09But the thing I really liked about it was it's like the config options you have for the, for what
- 44:15you can, the output that you can get out of it are really neat.
- 44:18And so you can get an executable that runs a function inside a module, or it just runs file,
- 44:26works as if you were running your file from the CLI, your Python file from the CLI.
- 44:29Or you can get, which is what I like because I can play with, you run it and it just starts
- 44:35your Python interpreter, your REPL with your entire virtual environment along there available.
- 44:42So you just say, create my REST API application, a client application, and I can just run client,
- 44:51not that PI because it's compiled, right?
- 44:54And well, it's an executable and I'll get a Python REPL with, you know, requests already
- 45:00available for me to import it.
- 45:01And I don't have to pip install anything.
- 45:03That's cool.
- 45:04So in that sense, it's slight.
- 45:05And I think you can do that with pecs and shiv as well.
- 45:08There's a way of doing that.
- 45:09But this was really neat.
- 45:11You have a lot of control over it and you can watch it, pull in all the dependencies.
- 45:15You can have it, it'll pip install everything for you into this, this kind of directory structure
- 45:19when it's trying to put itself together.
- 45:22And so it grabs all the dependencies fresh out of PI PI or whatever indexes you feed it and
- 45:26then creates your final environment from that.
- 45:29It sounds pretty promising.
- 45:30It seems like it's got a nice modern take.
- 45:32I like the making your code run faster.
- 45:34It's already in memory.
- 45:35Yeah.
- 45:35It's all pretty cool.
- 45:36This one does all the OSs as well, right?
- 45:39Yes.
- 45:39Cool.
- 45:40As I'm sitting here listening to talk about all this stuff, it seems to me like one of
- 45:45the big challenges is how do I get Python to come over correctly?
- 45:48How do I get the dependencies to come over correctly?
- 45:51Sometimes it's a little bit tricky to get the program to actually start.
- 45:56You know, it seems like there's some challenges on around some of the platform stuff.
- 46:00What I don't see with any of these is what do you think the viability of saying like you
- 46:05can take CPython and embed it into any application, right?
- 46:09Yeah.
- 46:10Like you can host CPython.
- 46:12What if you created an app that is just a C-based app that obviously runs, no problem.
- 46:17It already has Python compiled into it.
- 46:20And its job is to unravel the virtual environment and run your code alongside.
- 46:27So you're just shipping this, your EXE that already comes with Python and like it already
- 46:34knows how to run totally reliably.
- 46:35It's just a matter of executing your Python code as part of its like internal automation
- 46:40or whatever.
- 46:40Yeah.
- 46:41So I haven't done too much work into all of that, but I think it's things like PyOxidizer
- 46:48will help with that or even something that the ones that do the compilation for you, if
- 46:54you're trying to deliver an executable like Nutca or even Cython, it can help you along
- 46:59those lines.
- 47:00Okay.
- 47:00Interesting.
- 47:01All right.
- 47:01Yeah.
- 47:01So you mentioned Cython, that one in your article sounded like I'm a fan of Cython.
- 47:07I've used it for a couple of things.
- 47:08It's really cool that it supports the Python type hints.
- 47:12Now it doesn't have its own like type language necessarily.
- 47:16It still has it, but it used to be, you'd have to describe your types in the Cython way.
- 47:22Now, if you just describe them in the CPython way, Cython goes along with that, which is really
- 47:28cool.
- 47:28That means you can write kind of just annotated Python in the traditional sense or the normal
- 47:33sense and you get compiled machine instruction type stuff.
- 47:38That's pretty awesome.
- 47:39But it's not really built for packaging, is it?
- 47:41The end goal of Cython was really to integrate C and Python essentially so that you can go
- 47:47into C code and use Python libraries from it, or you can go into, which is the more common
- 47:53part, go into Python code and use a C library inside Python code, like say NumPy or something
- 47:59like that.
- 47:59Yeah.
- 48:00Something beyond just C types and some of the base stuff that Python already has.
- 48:06But it'll compile your Python code for you.
- 48:08And it has an option to produce a single file executable.
- 48:12It just isn't going to do a lot of like, for example, if you do it with Nuka, it'll traverse
- 48:17all of your dependencies and compile and put them together.
- 48:20But Cython will only do a little bit of that.
- 48:23It won't traverse dependencies.
- 48:25Right.
- 48:26Right.
- 48:26It probably expects like, you're going to compile these three files and then put them together
- 48:30or something.
- 48:31Right.
- 48:32And you just want to give it a Python application and say, put these pieces together for me.
- 48:37And it's just, it's not really for that, is it?
- 48:38Yeah.
- 48:38It's not really built for that.
- 48:40But it's one of the things I tried.
- 48:41Yeah.
- 48:42Yeah.
- 48:42Sure.
- 48:42And it, you know, it does get you C code, which is, and you can compile.
- 48:47And yeah, it's, it's a possibility, but it's, yeah, it just seems like it's abusing Cython
- 48:53because you, because you could probably make it work, but it's not like it's goal, right?
- 48:57Like PyOxidizer doesn't have another purpose other than to package up your thing.
- 49:01And so it's kind of what it's for.
- 49:03Yep.
- 49:03Then two of the things that didn't fit in the taxonomy were Flatpak and Snapcraft, both
- 49:09of which are ways to package up an application.
- 49:13It's for Linux.
- 49:16Is it?
- 49:17And specifically Linux.
- 49:18Yeah.
- 49:19Linux.
- 49:19And, and, but what's cool is they, they both have like their own little app store.
- 49:23It's kind of like the macOS app store or the Windows 10 app store, but it's the Snapcraft
- 49:28or Flat, Flat, Flatpak app store.
- 49:31Yes.
- 49:31It's more like apt or yum, like its own little package manager type thing.
- 49:36And it, it packages everything together with you, Flatpak.
- 49:40I don't have a lot of, it's been a while since I've gone into all the details of how
- 49:46Flatpak did its, its thing.
- 49:48And I think it even included some, some OS stuff when it did all its packaging.
- 49:52So you run in a completely isolated environment, your application and Snapcraft does something
- 49:57similar.
- 49:59And on top of it, it's an app store.
- 50:01So type experience.
- 50:03So if you push an update, it'll, if you enable it, it'll automatically update your application
- 50:09for you.
- 50:10Yeah.
- 50:10I think that's actually pretty cool.
- 50:11Yeah.
- 50:12I think that's neat.
- 50:12There's actually a lot, actually a lot of use cases for that, even in, in large organizations,
- 50:17beyond just, typical customer stuff.
- 50:20Like if you're talking about developers, if you have a bunch of developer tools and
- 50:25you just produce some new Python package with these tools in it, then you got to go ask all
- 50:30the developers to go pip install --upgrade.
- 50:33Right.
- 50:33Yeah.
- 50:33But if you do, if you have something like this and everybody's on Linux, which may or may not
- 50:38be true, then you can just push the update out to the developers.
- 50:43And since I'm on that, that just reminded me, there's another system, which isn't a packaging
- 50:48system, but it's a distribution system called pulp that works a little bit like artifactory.
- 50:54If you're aware of that, which is essentially a package distribution system.
- 50:59it will do like a private PI PI server.
- 51:03Yeah.
- 51:03But yeah, it covers like all the different types and languages.
- 51:06Yeah.
- 51:06Docker registries and all that.
- 51:08But pulp has agents that you can install on your systems and push updates to them.
- 51:12Oh, I see.
- 51:13And then like, Hey, run this script to make sure everybody's got like the newest engine
- 51:17X or the newest whatever.
- 51:19Right.
- 51:19Yep.
- 51:20Okay.
- 51:20That's pretty cool.
- 51:21I definitely like the auto update.
- 51:22Now you should be able to a very strong should not necessarily could, but should, if you could
- 51:28get high oxidizer or PI installer to truly work correctly, you should be able to take that
- 51:35output and put it in the macOS app store or in the windows 10 app store.
- 51:39I think so.
- 51:40Yes.
- 51:41Right.
- 51:41And then you get the benefits of doing that.
- 51:43Those app stores always have weird restrictions.
- 51:46Yeah.
- 51:47I know one of the worst parts of my mobile app.
- 51:50I know you had your experiences.
- 51:50Yeah.
- 51:51Oh man.
- 51:52I'm still, I don't want to go into it, but I'm still having, let's call them disagreements
- 51:57at very strong levels with some of the app stores, right?
- 52:02Like just some of them were completely weird and out of place.
- 52:05Other are just, I don't know.
- 52:08They're just, no, you have to change your app to be like this for no particular reason.
- 52:12But they're very frustrating.
- 52:13But if it works, it's actually a great experience for the user.
- 52:16Right.
- 52:17Right.
- 52:17When I install an app on my Mac, if it has a version in the app store or I could buy it
- 52:25separately, I get it in the app store because then I know it's going to be just be on all
- 52:28my machines.
- 52:28Yeah.
- 52:29I don't have to worry about what happens if I lose the license code or I've activated it
- 52:32twice, but that one machine actually died.
- 52:34So I'm not actually using it, but I can't deactivate it because it's actually dead.
- 52:39Like, you know, like how often have you been through this experience of like, you've over,
- 52:42you've used up your five activations.
- 52:44It's like, well, but the machines were virtual machines and I threw them away.
- 52:48I can't unactivate them.
- 52:49I don't know what you want from me, you know?
- 52:50So the app stores are good in that regard.
- 52:53They are.
- 52:53And you can also have the experience of, well, I have all the, all of these devices that are
- 52:58registered on my app store and I want to install this application.
- 53:04Please install it on all of them for me.
- 53:06Right.
- 53:07Yeah.
- 53:07Because the system's already built with the permissions to do that.
- 53:10Then you're set.
- 53:11Yep.
- 53:12Absolutely.
- 53:12Well, I think these are all really good options and I think it's most important to break it
- 53:18into that taxonomy.
- 53:19Like first, what are you even trying to do?
- 53:21Because the fix for one of these is definitely not the fix for another one of them necessarily.
- 53:27Right.
- 53:28So, yeah.
- 53:29But this gives people a lot to think about and a lot to go play around with.
- 53:32So, yeah, it's cool.
- 53:33Yeah, for sure.
- 53:36Yeah.
- 53:36Now, I do have one plea, one request for the folks maintaining all of these things.
- 53:42Maybe not all of them.
- 53:44Like Cython, Cython's off the hook.
- 53:46But for many of these things, right?
- 53:49For Pi Installer, for Briefcase, for a lot of these, have one or two showcase applications.
- 53:57That when you go there.
- 54:00And guess what?
- 54:01We found this awesome open source GUI application and we built a Mac, Linux, and Windows version of it.
- 54:08Here's a screenshot.
- 54:10Click to download and run it and see what the experience is as a user.
- 54:13Right.
- 54:14Briefcase is really cool.
- 54:15But I go there.
- 54:15There's not like a single example of anything built with it or what.
- 54:20Right.
- 54:20There's no evidence to me before I commit to trying it out.
- 54:24Like, look at this amazing stuff that's built with Briefcase or Pi Installer.
- 54:28Right.
- 54:28Like, here's three applications that are well-known apps that you probably didn't even know were built on Python.
- 54:34Right.
- 54:35So anyway, I'm going on and on.
- 54:36I'm with you.
- 54:37If people are out there like, please put this.
- 54:39This will do so much to help the adoption.
- 54:42If people can go see like that.
- 54:44And it doesn't have to be the owner of that application.
- 54:46Find an open source application that's awesome that you could package up and then package it up.
- 54:51Like, you know, it doesn't even have to.
- 54:52Right.
- 54:53You could just do it as your own proof of concept and then tell, like, do a PR back.
- 54:56Who knows?
- 54:57Yep.
- 54:57All right.
- 54:57Well, let's maybe wrap it up there for the.
- 55:00Oh, go ahead, Chris.
- 55:01I was going to say maybe we need one of those awesome lists.
- 55:04Awesome lists of Pi Installer applications.
- 55:06Awesome list of.
- 55:09That's right.
- 55:09Mahmoud Hashemi just recently did an awesome Python applications.
- 55:14I'm sure there's a bunch.
- 55:15I know that there are a bunch of GUI applications there.
- 55:17You could go and package one or two of those up and put it on your site.
- 55:21Exactly.
- 55:21No doubt.
- 55:22Cool.
- 55:23All right.
- 55:23Well, let's leave it there for the packaging exploration landscape.
- 55:26And just, you know, talk about a few things really quick before I let you get out of here.
- 55:30Sure.
- 55:30Is there a rumor that you might be doing less typing and more talking and communicating with the world?
- 55:36Maybe.
- 55:38I've been exploring the idea of starting up my own podcast, something short form type thing,
- 55:47kind of 10 minute, 15 minute episodes with the idea.
- 55:51A little bit like developer tea?
- 55:52A little bit like developer tea where we just pick a technical topic based on some online article.
- 55:59People can send suggestions and we read through it, not in complete detail, but just kind of give you my take on it and just kind of analyze what it's talking about and how it affects just development topics in general and technologies.
- 56:17Well, if you get that out, I'm definitely looking forward.
- 56:19Are you going to call it the Try Accept Pass podcast?
- 56:22That's the plan for now.
- 56:23The Try Accept Pass podcast.
- 56:25I might change my mind on that, but I think that's good for now.
- 56:29That's cool.
- 56:29It could be Try Accept podcast.
- 56:31Try Accept podcast.
- 56:32Yeah.
- 56:34Yeah.
- 56:34If it doesn't work, make a podcast about it.
- 56:36Why not?
- 56:36Yeah, exactly.
- 56:37Right.
- 56:37That's the finally clause of the podcast.
- 56:39Either way, you're going to podcast.
- 56:40Exactly.
- 56:41Yeah.
- 56:42Yeah.
- 56:42So I was looking for a way to kind of diversify the content I'm putting out with the website, try acceptpass.org, which lately has been doing, well, just finishing up a series on CI/CD and all the different aspects of it.
- 56:57Yeah.
- 56:57And you have a newsletter too, right?
- 56:58That people can go sign up and hear about it.
- 57:00That's correct.
- 57:01If you're interested in the site and keeping an eye out for the podcast and everything that's coming up, just feel free to drop by the website and sign up for the newsletter.
- 57:10We're also open for any suggestions of anything you want to hear more about.
- 57:14Like my biggest request so far has been async stuff.
- 57:17So I'm going to be doing a few more things on that.
- 57:19Or if you want to contribute an article, it's a good way of getting yourself out there.
- 57:23Yeah, absolutely.
- 57:24Cool.
- 57:24Well, I know the articles you have out there so far are pretty good.
- 57:28So people should check it out for sure.
- 57:30Yeah.
- 57:30The articles are long form too.
- 57:32So expect 2,000 word articles more or less every couple of weeks.
- 57:37A little bit like a magazine type of article or something.
- 57:40Yeah.
- 57:40Yeah, cool.
- 57:41Yes.
- 57:41All right.
- 57:42Well, excellent.
- 57:42Yeah.
- 57:42So keep up the good work over there at trixatpass.org.
- 57:44I will keep on chugging.
- 57:46Yeah.
- 57:47The content creation, it never ends.
- 57:48No, it doesn't.
- 57:49It's fun though.
- 57:50I have lots of fun doing it.
- 57:52Yeah, that's awesome.
- 57:52All right.
- 57:53Now, time for the final two questions before you get out of here.
- 57:56If you're going to write some Python code, what editor do you use?
- 57:58These days I am using VS Code.
- 58:01All right.
- 58:01Right on.
- 58:02The remote extension is awesome.
- 58:04Yeah.
- 58:04Yeah.
- 58:04Very cool.
- 58:05I just read that Facebook has made VS Code their official editor.
- 58:10Oh, really?
- 58:11Yeah.
- 58:12Interesting.
- 58:12Which is a pretty interesting move there.
- 58:15Yeah.
- 58:16So it's cool.
- 58:16And then notable PyPI package.
- 58:18There's probably some in our list here.
- 58:20But what comes to mind, you're like, oh, you should totally know about this thing.
- 58:23I'm going to throw out Sanic.
- 58:25I've been using Sanic a lot lately as a REST framework.
- 58:30But it also has WebSockets integrated with it.
- 58:34And so you can provide both endpoints that answer HTTP requests and endpoints that answer WebSockets.
- 58:39And it's asynchronous.
- 58:41So I've been playing with async APIs, REST APIs using Sanic lately.
- 58:45Oh, that's super cool.
- 58:46Yeah.
- 58:46Sanic is one of the contenders for the hot new async ASGI Python web framework.
- 58:52So yeah, it definitely seems like it's a good one.
- 58:54Yep.
- 58:55I've had great experience so far.
- 58:56Oh, that's good to hear.
- 58:57All right.
- 58:58Final call to action.
- 58:58People, they got some kind of Python app.
- 59:01They got to package it up.
- 59:02What do they do?
- 59:03Yep.
- 59:03Just have a listen to the podcast and see where you land.
- 59:09Make a decision on who your users are going to be and what your best deliverable is.
- 59:15And make your choice based on that.
- 59:18If you can help out anybody to, like we were just talking about, produce some examples of
- 59:24how their packaging systems work, that would be great.
- 59:27Yeah.
- 59:28And if you're out there and you've built a cool application and you've bundled it up with
- 59:31one of these things, shoot a note back to the maintainer.
- 59:35Say if you use PyOxidizer, shoot a message back to them and say, hey, here's a cool thing
- 59:40I did.
- 59:40Could you feature this?
- 59:43Here's a picture you can feature on the site.
- 59:45Like, I don't know.
- 59:46I just think we need more of that.
- 59:47Yeah.
- 59:47I'm with you.
- 59:48And some of it, I know there's lots of apps already.
- 59:50And some of them might not even be using any of these systems.
- 59:53I think that just having examples of Python producing these types of system applications
- 59:59is just good for the language.
- 1:00:01I agree.
- 1:00:02It would start to break the chicken and egg cycle.
- 1:00:05Yeah.
- 1:00:05And I'm tired of hearing that Python is only a scripting language.
- 1:00:08Yeah.
- 1:00:09So am I.
- 1:00:10Awesome.
- 1:00:11Well, thanks so much for being here, Chris.
- 1:00:14It was a lot of fun to go through all this stuff with you.
- 1:00:15Yeah.
- 1:00:15Loads of fun.
- 1:00:16Thanks for having me.
- 1:00:17Yep.
- 1:00:17Bye.
- 1:00:17This has been another episode of Talk Python To Me.
- 1:00:21Our guest on this episode was Chris Medina.
- 1:00:23It's been brought to you by Tidelift and Linode.
- 1:00:25If you run an open source project, Tidelift wants to help you get paid for keeping it going
- 1:00:31strong.
- 1:00:31Just visit talkpython.fm/Tidelift.
- 1:00:35Search for your package and get started today.
- 1:00:37Start your next Python project on Linode's state-of-the-art cloud service.
- 1:00:41Just visit talkpython.fm/Linode, L-I-N-O-D-E.
- 1:00:46You'll automatically get a $20 credit when you create a new account.
- 1:00:49Want to level up your Python?
- 1:00:51If you're just getting started, try my Python Jumpstart by Building 10 Apps course.
- 1:00:56Or if you're looking for something more advanced, check out our new Async course that digs into
- 1:01:01all the different types of Async programming you can do in Python.
- 1:01:04And of course, if you're interested in more than one of these, be sure to check out our
- 1:01:08Everything Bundle.
- 1:01:09It's like a subscription that never expires.
- 1:01:11Be sure to subscribe to the show.
- 1:01:13Open your favorite podcatcher and search for Python.
- 1:01:15We should be right at the top.
- 1:01:17You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the
- 1:01:22direct RSS feed at /rss on talkpython.fm.
- 1:01:26This is your host, Michael Kennedy.
- 1:01:28Thanks so much for listening.
- 1:01:29I really appreciate it.
- 1:01:30Now get out there and write some Python code.
- 1:01:32We'll see you next week.
- 1:01:52Thank you.