- Podcasts
- Python Bytes
- #80 Dan Bader drops by and we found 30 new Python projects
#80 Dan Bader drops by and we found 30 new Python projects
Python Bytes
- May 29, 2018
- 31 min
- Episode 80
About this episodeTopics covered in this episode: Packaging Python Projects gidgethub — An async library for calling GitHub’s API pystemd PyCharm 2018.2 EAP…
- Packaging Python Projects
- gidgethub — An async library for calling GitHub’s API
- pystemd
- PyCharm 2018.2 EAP 1 includes improved pytest support
- 30 amazing Python projects (2018 edition)
- Extras
- Joke
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
#80 Dan Bader drops by and we found 30 new Python projects
Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds. This is episode 80, recorded May 25th, 2018. I'm Michael Kennedy. And I'm Brian Okken. And Brian, we have a special guest, don't we? Yes. Hey, hello, Dan Bader. Hey, guys. It's me, Dan. Good to be back on the show.
For those of you who don't know Dan, Dan's well known from RealPython and dbeta.org and a bunch of Python goodness. Before we get to the show, I want to say thank you to DigitalOcean. So they're sponsoring this episode and a number of them coming up, as well as the actual infrastructure delivering all this technology to you.
So pythonbytes.fm/digitalization, get a $100 credit for new users. Pretty awesome. Brian, I feel like there's a few themes that we touch on frequently in this podcast. Yeah, I guess that we do. And one of them is packaging. So we've talked about packaging a few times. And the Python Packaging Authority has their tutorial on how to package Python packages.
They were either too small. They didn't include everything they needed. Or they were too big and kind of scary. And now this is a medium-sized example setup.py that is actually pretty nice. You know, I read through it and it looked like the same tool set that I used to push up. So I think it's pretty accurate now.
I don't know how to do it now because it changed. But now this is all up to date. So it's good. Very nice. Dan, did you do much packaging? Yeah. So I run a couple of open source projects and I always felt like, you know, exactly like what you were just saying, Brian, where I had to combine a couple of tutorials just to get it to work.
And it never really felt all that straightforward. And so I think this is a pretty nice and pretty minimal write-up. I like that. And I'm surprised that the recommendation now seems to be to use Markdown-based readme files. Like I really like Markdown. I really warmed up to restructured text so much.
It's sort of a minimal, simple way to put Python packages on PyPI. So they kind of completely done away with the setup.py. Instead, you write an init file where you just put in, you know, your author name and your homepage or whatever. And it generates all of that other stuff. And it might not be really necessary anymore now.
You know, if you have like a really sort of short and sweet tutorial, like the one that we were just talking about. But it is super, super beginner friendly, this FLIT thing. Oh, that's cool. Nice. It's F-L-I-T? It's F-L-I-T. Yeah. Awesome. All right. And so that's probably on GitHub, isn't it, Dan?
Yes, it is. Nice transition. So the next thing you have for us is an async library for calling GitHub's API. Yeah. Yeah. So I was going to talk about this thing called GidgetHub, which is, yeah, a Python wrapper around the GitHub API. So basically allows you to talk to GitHub and you can interact with all the different content types that GitHub provides or exposes.
So you can add and modify issues. You can, you know, create pull requests. You can add comments to pull requests. You can download all the comments to pull requests and all that stuff. So the other thing it does, it allows you to parse GitHub's webhooks. So you can configure GitHub so that every time a new pull request or something like that is created, it sends, essentially calls a, an API callback on the web, like on some URL that you give it.
And so what you can use GidgetHub for is a really nice and clean way to write GitHub bots with Python, essentially. And it's just a really cool library. And I think it's API super well designed. So we were recently using it on a workshop that we did in Vancouver, like Marietta, who's a CPython core developer, did it.
So you get some PR data, then you say await GitHub.post. And, you know, all your, all your methods are async. Yeah, definitely nice and scalable. Well, it looks like it's based on aiohttp, which is a really nice client side, async enabled REST library. What's really, really cool about this GidgetHub thing is that it's actually abstracting away from the actual backend, I want to say, you know, what the actual library you use to talk to or to handle those web requests, whether they're incoming or outbound.
Super friendly. Yeah. Brian, do you guys do any GitHub automation? You just started with Git at your organization, right? We're doing a, we've got a private server, so we don't go through GitHub for work stuff. But I use GitHub all the time. Yeah, of course. Locally. Yeah, nice. Yeah, I feel like this kind of automation is more relevant and useful when either you're building an app or you have like a big organization and you want to automate your company's interaction with GitHub, right?
Like me as an individual, I just don't really see a massive use of this for me because I just don't do that much different other than what I personally do with GitHub. But I think it looks really cool and I love the way it works. Some uses where you could often use like Travis or something like that.
Or you have that one person on your team that often breaks the build. So you run extra tests when you see them do a check-in. A harassment bot that just goes in and be careful. Yeah, I think they use it on CPython. You know, they've moved all of the source for that to GitHub. And I think now they, they have run a couple of bots that I think one of the things they do is, so when you contribute to CPython, they need you to sign an agreement that you're giving up the rights essentially for your contributions.
And so they, I think Marietta actually runs that bot. I might be mistaken here, but it's a bot that checks if that committer or that contributor already has given their permission. And if they didn't yet, then it's just going to ask them to do it. And it sets a flag on the PR. So it's, it's super cool that way when you can sort of code up a workflow like that, that you never have to worry about again in your life because it's a hundred percent automated.
So you can create things that are daemons. You can say like, I would like to have my Python web app start and I want it to start in this way, but I want it to not start before my MongoDB server starts. I don't want MongoDB to start in that way. You can configure these things to all just happen on boot or on demand, things like that.
So I think this is really pretty awesome. So if anyone's doing any sort of automation with system D and they're already using Python, here's a really great way to just like, you know, import this library and just ask, hey, let's load up this unit, which is like one of these services and ask, is it running?
Let's start it. Let's create a new one. All sorts of stuff. Really, really nice. That's cool. Yeah. And also kind of cool how this was built. So this is like based on Cython. So it's a wrapper and the C library that actually talks to system D, right? Yeah, I think so. And actually, I'm going to cover in the next episode, this sort of article on using Cython as a way for a simple way to wrap C APIs.
That's what surprised me. Yeah. I think that's why, because it doesn't seem like a performance thing, right? I think it's like, let's use Cython to get a really simple API into the C layer as well as build the integration back into Python. So pretty cool. Yeah, nice. I'd love to see that because I'm surprised they're using Cython for that and not just, you know, C types or CFFI or something like that.
And this is probably pretty polished and comes from a pretty well, well-informed space if it's being used there, right? Pretty sweet. All right. So before we get to the next one, let me tell you guys about DigitalOcean. So DigitalOcean is definitely one of the best hosting frameworks or places out there.
It has been for a long time and it's been working great. So like I said, if you're thinking about running servers and you want to do it affordably, high performance with lots of control, then go to pythonbytes.fm/DigitalOcean. If you're a new user, you'll get $100 credit. And, you know, check out what they have.
Speaking of products, Brian, you're excited about one. Oh, an update one, right? Yeah, I am. I usually, for a while, I was running the latest or the last 2017 release of PyCharm. But I don't know how recent this was, but not too long ago, we had the early access program build one of 2018.2 is out for PyCharm.
So if your test was using fixtures and you was returning an object or a function or something, and you were trying to call that, you didn't have all of those cool autocomplete features, those are now in for fixtures of tests. And that's really cool. But the thing that I'm really excited about is parameterization now works seamlessly within PyCharm.
If you wanted to rerun one or rerun the failing ones, it would just rerun all of them. I see. It treated like a whole method in the decorator bit that had, here's all the variations. That was just like a thing that it would just rerun, right? Yeah. So now you can run a test. And then in the left sidebar, you can right click on one of them and rerun just one of the parameterizations.
Or you can, like, for instance, if like only two or three or some of them failed, when you rerun failures, it only runs the parameterizations that failed. And this is a huge time saver for me. So I'm really excited about it. Yeah, that's nice. I use that feature a lot where I just say rerun the failed tests.
Yeah, I do. Yeah, I actually just, you know, used it. I rewrote the backend for realpython.com. So we've got pytest powered tests and integration tests for that. And yeah, it's just been a joy to use, like especially the parameterization stuff. It's just so nice when you can reuse a lot of test code.
You don't have to like copy paste it around so much. So Dan, one thing I was going to cover, but you put it in here before, before I could get to it. So you're faster is basically why is installing Python 3.6 so hard and so sort of confusing, right? Like you talked about this workshop that you recently did and I've thrown this out on Twitter and people sometimes tell me, oh, it's not hard.
So Mariada was teaching it and I was just running around kind of, you know, supporting people. And for some people we spend almost like two hours to get them to a working Python 3.6 install. That's insane. And, you know, there were some really, like you hit all of these interesting, but obviously kind of frustrating edge cases.
I think it defaults to Ubuntu. I'm not sure. I think it's Ubuntu as well. Yeah, that's nice. So basically you have this like really tightly integrated Linux environment that you can just work from, from your Windows host environment. The problem is that people maybe accidentally installed Python in the Linux environment and they try and access it from the Windows environment because it's a little bit unclear if you're a beginner, like what actually the difference is, you know, between these like two different terminal windows.
It doesn't work. For sure. Well, so you guys are writing this up at realpython.com slash installing dash Python as sort of an ongoing guide, right? Yeah. So we decided to do something about it. So shout out to John Sturtz and Jim Anderson. And we got together and put together this sort of the ultimate Python 3 install guide.
And we're going to keep it maintained. And it tells you how to install Python in very specific steps in all kinds of different configurations. So Linux, macOS, different Linux distributions, how to compile it from source. And we're just going to add to it and, you know, improve it based on feedback.
I don't think we even mentioned it in that particular piece. This is Python 3 only. And then my Mac is about ready for a format because, you know, it's time. It's been like, it's been bad. So anyway, it's about time for format. What would you, like, after going through this whole experience, we could do homebrew.
You could do anaconda. You could do download the PKG file from python.org, et cetera, et cetera. What would you do if you were setting up a new computer? Like on Mac? Yeah, on Mac. Yeah. So I'm a big homebrew fan because it makes upgrading very easy. And it's just something that I personally use for other purposes as well.
So one of the things I usually do, you know, when I set up a new macOS development environment, I upgrade bash. So I use bash as my preferred shell and macOS ships with a super old version of bash. And with homebrew, it's super easy just to get the latest version of bash. And then, you know, a bunch of other command line tools that I use.
And so I just use that to install Python as well. So I kind of like that. I mean, Python.org version, it works as well. But if you're going to use homebrew anyway, which I think you want to use if you're on a Mac, then I would just keep everything in homebrew. Yeah, that's what I'm thinking as well.
It makes a lot of sense. Awesome. Both on Mac and on Windows. I just always just use the python.org installer. Yeah, that's what I've been doing as well. But with homebrew, you just type upgrade, you know, and you can have different versions and stuff. I don't know. I'm thinking of playing with homebrew next time.
But anyway, very cool. Yeah, there's also pyenv. So that's sort of the other. If you're going to go with homebrew, you could just go, you know, brew installed Python 3. And you get sort of one, the latest version of Python 3. Or you could install something called pyenv first. And then that's another layer of abstraction on top that allows you to switch between different versions of Python, including different versions of Python 3.
So you can just go, you know, I want Python 3.5 for testing. And I'm going to run all of my latest stuff. On the Python 3.7 beta version or something like that. So that's super nice. It's maybe a little bit more advanced. So I feel like you're probably there, Mike. But for a complete beginner, I'm not sure if I would recommend it.
Yeah, yeah, yeah. Sure, of course. I don't think I'm there. I've tried it several times and it hasn't worked for me. I don't want to go too much longer. But what I've started doing on my servers is when I SSH in, part of my shell profile automatically configures the main virtual environment for whatever that purpose of that server is.
But it's more technology focused than just say Flipboard or Zite, those types of things. And the article starts with the MyBridge AI evaluates the quality by considering popularity, engagement, recency, and so on. So apparently they have this AI, which is kind of cool, that goes through and looks at human interaction with all these articles, these tech articles in the Python space, and then says, here's the articles that our community sort of interacted with that they really liked, or packages actually in this case.
So let me just give you a quick rundown on these just to kind of give you all some exposure and like, oh, hey, I hadn't heard of that package. That's pretty cool. And then you guys can jump in and give me some thoughts. So I'll go from the least popular to the most popular. So number 30 is PDF tab extract, which is a set of tools for getting tables out of PDF documents, which is pretty cool.
And data mining on scan documents, pretty sweet. There's number 28 is surprise, which is a scikit learn extension for building and analyzing a building a recommender system. So you can like say, you might also like this, which is kind of cool. Number 27, we won't do all of them. That's why I'm skipping number 29.
Number 25, clairvoyant, a Python program that identifies and monitors historical cues for short, short term stock movement and stuff. So I don't do really any stock trading. I mean, I put money into mutual funds, so I don't really care that much about it. But the reason I bring this up is Python actually is pretty involved in the whole stock trading automation and real time stuff.
There's actually a really good documentary called The Wall Street Code that goes into all these programmers that are building like AIs and stuff in Python. And it's pretty cool. So it's free on YouTube. Nice. Yeah. Brian, are you a fan of Mr. Robot or Dan? Either you guys? Yeah, I was just going to say.
No? No. Oh, man. Dan? I like it. Yeah. Good show. I think it went a little weird in episode two. I was sorry, season two. But like the first year, I was just like blown away. So there's this thing called F Society, which is a hacking tools pack for penetration testing in Python, which of course, Python is very big in the cybersecurity space.
You might, if you want to like check your own stuff, run some of these tools against your things before someone else does. We talked about Kenneth Wright's last time. And number 18 was Maya, date time for humans. Better exceptions. I think we covered that as well. 16, API star, a really cool, expressive Python 3, 5 based API from Tom Christie.
Same guy that does Django rest framework. But this is like the re-envisioned Python 3 version, which is cool. Micro Python, very awesome for little projects. spaCy, industrial strength. Natural language processor is number six. Number two was PyTorch for machine learning. That seems to be sort of becoming one of the main machine learning libraries.
It's a good solution, I think. Yeah, yeah, I think so. It's a good solution if I could just find a problem to like apply it to. Those that I read off there, are those surprising? Any of those like super interesting to you guys? I'm a huge fan of MicroPython. So I just learned a little bit more about it.
And, you know, we're talking kilobytes and stuff. And it's just insane that you can program this with Python. Yeah, yeah. So cool. Yeah, and you got one of those little in your goodie bag at PyCon, right? They did like a video review of that on YouTube. And I was just, you know, all giddy about it, just playing with this thing.
It just plugs into your USB and you can, you know, start running Python on this thing. That's a really good implementation they did. Brian, how about you? Yeah, I guess I'd have to second that. MicroPython is awesome. And a bunch of the Adafruit products run, are able to run it. And yeah, it's all fun.
So just a quick point to an article from our friend Chris Medina at tryexceptpass.org slash article slash GDPR. Sort of a take for developers. And if you haven't got your stuff all in line yet, please consider doing so for your own good. Pythonbytes.fm is all up and ready. So yeah, Dan, you probably had to do the same for real Python, right?
Yeah, some sleepless nights because it's, well, everything is up for interpretation, right? So it's kind of hard to, yeah, just to put it into concrete terms. But I mean, it's just been nuts, you know, that now that the deadline for that law to go into effect is passed. Like we've seen some services shut down.
That was quite the discussion on Hacker News. The other thing I wanted to bring up, which I don't know, this is pretty cool to me. I deal with an insane amount of large files. And I use Dropbox mostly for that. Like to give you a sense, like I have the terabyte plan and it's like sometimes gets too full and I have to clean up my Dropbox storage.
So if people have this problem, Dropbox came out with this thing called Smart Sync that will basically give you and your Explorer and your Open Dialogues and Windows or Mac a view which pretends as if the files are there. And as soon as you try to interact with them, even from like the command line, they will automatically download if they're not.
