Latest / Talk Python To Me / #115: Python for Humans projects
Transcript
- 0:00When you think of popular Python packages, what comes to mind?
- 0:03There's a good chance that this week's guest, Kenneth Wright, wrote the package you just thought of.
- 0:09He's the author of some of Python's most popular libraries, including Requests, Records, Maya, and Pipenv.
- 0:16I got a chance to catch up with Kenneth at PyCon 2017 this year. Here's the story.
- 0:20This is Talk Python To Me, episode 115, recorded live at PyCon on May 20, 2017.
- 0:27Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries,
- 0:57the ecosystem, and the personalities.
- 0:59This is your host, Michael Kennedy. Follow me on Twitter where I'm @mkennedy.
- 1:03Keep up with the show and listen to past episodes at talkpython.fm, and follow the show on Twitter
- 1:08via at Talk Python.
- 1:09This episode is brought to you by Codeship and Hired.
- 1:13Be sure to check out what they're offering during their segments. It really helps support the show.
- 1:18Kenneth, welcome back to Talk Python.
- 1:21Hi, Michael. Thanks for having me.
- 1:22It's really nice to have you back. You always seem to have so many amazing projects.
- 1:26Oh, thank you very much.
- 1:28And your pulse on what's going on in the community. And we happen to be like right in the center of it.
- 1:33Yes, we're here at PyCon. This is my favorite week of the year by far. It's the highlight of my life.
- 1:38It's definitely a highlight for me as well. And it's the fact that I can drive to it and not fly to it.
- 1:42Oh, where do you live?
- 1:43I live 15 minutes from here by car.
- 1:45Oh, I'm very jealous.
- 1:46So that makes it quite easy.
- 1:48It won't be that way next year.
- 1:49No, next year is going to be a four-hour flight with no... If I'm lucky, right?
- 1:53Yeah.
- 1:54Yeah.
- 1:54It's all good, though. I'm definitely making it there.
- 1:56We'll have the Rock and Roll Hall of Fame. It'll be worth it.
- 1:58It'll totally be worth it.
- 1:59And, you know, there's a bunch of people that wanted to go to this one, and it's sold out, right?
- 2:05Yeah, it sells out every year.
- 2:06So if you guys are listening and you're like, this sounds so fun, I want to come, but it's sold out, get your tickets early.
- 2:11Yep, always get your tickets early.
- 2:12PyCon sells out every year.
- 2:13Every year. Okay. You don't need too much of an introduction, but you've done a ton of amazing projects that we're going to talk about.
- 2:19But tell people, what do you do day to day? Like, who are you?
- 2:22My name is Kenneth Reitz. I'm most well known for being the creator of the Request Library, and I work for Heroku.
- 2:30I'm the Python overlord at Heroku, so I'm the language owner of Heroku.
- 2:34It's not the language owner of Heroku. The language owner of Python at Heroku,
- 2:38meaning that everything that's related to Python, basically, that is about the Heroku product is something that I am in charge of.
- 2:47I see. So if I want to deploy my Pyramid or Flask web app...
- 2:51Yes. It's my job to ensure that you can.
- 2:53Or decide if that's appropriate.
- 2:56Yeah, exactly.
- 2:57Okay. Yeah, that sounds like a pretty fun job. I've never really had a position that was at an overlord title.
- 3:03Oh, I gave it to myself.
- 3:04Yeah. Well, look, that's all right.
- 3:06They asked me what they wanted on my business cards when I started, and I said Python overlord, so it stuck.
- 3:11With the fact that they let you do it, that's awesome. That's really cool.
- 3:13My official title is Senior Member of Technical Staff.
- 3:16I see. That's way less fun than overlord.
- 3:17I know, I know.
- 3:18But no, it sounds like a pretty fun project. You like working at Heroku?
- 3:21I do. I've been there for five and a half years, and I'm not planning on leaving anytime soon. It's a great company.
- 3:26Yeah. You don't think this cloud computer thing, it's a fad?
- 3:28No, I'd say I think we're good.
- 3:30I think it's going to be around for a while, right?
- 3:31Yeah, definitely. Platforms as a service is something that I think only more and more people are going to be using.
- 3:37And infrastructure as a service, I think, is probably going to change a lot over the next several years, because things like Docker are coming out and becoming more ubiquitous, and there's a lot of technologies and innovation happening in that space.
- 3:50And I think that platforms as a service are going to provide a stable platform for people to kind of keep their heads on straight in that world.
- 4:01Yeah, that sounds really interesting. I like Docker, but I feel like we're kind of, like, Docker is an intermediate evolutionary step of something else.
- 4:10Yeah, I know exactly what you mean.
- 4:12Yeah?
- 4:12I haven't used Docker too much. I've only done, like, little toy experiments with it or building example repos.
- 4:18To me, it feels like a response to a need that exists, but it's, like, not the answer. It's just, like, the first answer.
- 4:27Right, like, we have these VMs. They take too long to set up.
- 4:31Too long to start.
- 4:33The cache is ridiculous on your machine.
- 4:35If you use Docker in any capacity, you should check your disk cache for Docker.
- 4:39There's a command to do it, and it'll be, like, 30 gigs.
- 4:42You know, there's a lot of room for improvement, but I have to give them a lot of credit.
- 4:47The Docker format client is stellar.
- 4:50It's a very nice client, and they did a lot of work to build it the right way.
- 4:55Nice.
- 4:55So do you guys have Docker support at Heroku?
- 4:58It's not in GA yet, meaning it's not in general availability, but we do have it in beta.
- 5:02Okay.
- 5:03Yeah, and it's available.
- 5:04You can use it in production if you'd like, and I recommend people doing that, especially if you're using scientific applications.
- 5:10It works very well for that on Heroku.
- 5:12So you can app get install anything you want.
- 5:14You use Conda, for example.
- 5:15Right, so you can have a lot of the machine learning stuff that's got lots of weird compilation all set up right on your Docker image, right?
- 5:22Yeah, exactly.
- 5:22Okay.
- 5:23Yeah, very cool.
- 5:24So maybe tell us, what's it like to deploy a Python web app to Heroku?
- 5:27Git push Heroku master.
- 5:29Sounds all right.
- 5:30Now, so you have a requirements.txt file that you use to specify your pip requirements, and that's how we know that it's a Python app.
- 5:39Okay.
- 5:39And we install those requirements, and that's effectively it.
- 5:42Then you have a proc file, which is standard on Heroku, which you use to say what your entry points are for your application.
- 5:48So you do, like, web colon space command to start your application.
- 5:52Gotcha.
- 5:53Okay. Yeah, sounds very cool.
- 5:54And that's all you need.
- 5:55Yeah, so that's maybe a good segue over to the projects that you're working on.
- 5:58Like, you've been doing some stuff trying to make virtual environments or environments in general better, right?
- 6:02Yes, yes.
- 6:03I'm working on a project right now called pip Env.
- 6:05It's had, like, 40 releases in the last three months.
- 6:07It's been quite a bit of work behind it.
- 6:10It's relatively stable.
- 6:11All right, so what problem is it trying to solve?
- 6:13It's trying to solve, try to be as succinct as possible.
- 6:16It's trying to combine the workflows of pip and virtual M together, as well as make it as easy as possible to enable deterministic builds and solve the UX problem of requirements.txt.
- 6:31Because requirements.txt can be used deterministically, where you just specify all your requirements and all your pin versions.
- 6:37Yeah.
- 6:38And it can also be used in a more human-friendly format, where you just put the things that you want, and you may or may not put version numbers in there.
- 6:45Right.
- 6:45And sometimes it's fine, and sometimes it's not.
- 6:47So there's a new project from the PyPA, the Python Package Authority, called pip File.
- 6:52And it's a new standard that will replace requirements.txt.
- 6:56And it's kind of like a YAML file, is that right?
- 6:57It's a TOML file.
- 6:59TOML file.
- 6:59Yes.
- 6:59YAML was discussed, but TOML is what we ended up settling on.
- 7:03There are two components to it.
- 7:04There's a pip file, which is the human part that you put in the things that you want, like Flask.
- 7:10And then there's a lock file, which is JSON.
- 7:12And it is generated by a machine and can be parsed by machines.
- 7:16And it has the deterministic list of all of your packages that you want to have installed, including all the versions.
- 7:22So if you had Flask in your first file, the second file would have Flask, WorkZug, isDangerous, Click, etc.
- 7:30I see. That's cool.
- 7:31So does it capture the version?
- 7:33Yes, absolutely.
- 7:33So it captures the version and the transitive closure of your dependencies.
- 7:38So you say the top-level dependencies, and it gets the lock JSON as all the dependencies.
- 7:42Correct.
- 7:42And you have two groups.
- 7:43You have default and develop.
- 7:45So you can say that there are things that you just want for development and things that you just want for production.
- 7:51Right, like pytest.
- 7:52Exactly.
- 7:53Probably not a good reason to deploy that.
- 7:54In production.
- 7:55Yeah, but there's no reason.
- 7:56It's not harmful.
- 7:57So if you're doing something like Selenium or Django toolbar or something like that.
- 8:03You need the debugger toolbars that give you extra access.
- 8:06Yeah, exactly.
- 8:07Maybe don't put that in the plain one, right?
- 8:10Exactly, exactly.
- 8:11So that's the new work that PyPA is doing.
- 8:14So yeah, that's what pipfile is.
- 8:16And so what pipenv does is it allows you to use...
- 8:19So pipfile is going to be put into pip in the future.
- 8:23Do you have any idea of the timing?
- 8:24There's a man named Donald Stuffed who is solely responsible for almost all things Python packaging.
- 8:29He is Mr. Pip.
- 8:30And so he is the gil that is responsible for the contention lock on that project.
- 8:36He's doing good work there.
- 8:37I've contributed to helping it come along, but he wants to rewrite it and make it more functional and less object-oriented.
- 8:42And then eventually we are going to land it in pip proper, so pip will support it.
- 8:46In the meantime, you can use it in pipenv.
- 8:49So you can use this great new functionality today.
- 8:52And what pipenv does is it takes away the brutal frustration of having to create and manage virtual environments.
- 8:59In addition, it also allows you to use the pipfile and the pipfile.lock, and it gives you a lot of other niceties.
- 9:05For example, I was inspired by using Composer for a few moments when I was helping someone with some PHP stuff,
- 9:12which is not something I do, but it was something I was helping a new developer friend of mine walk through a tutorial.
- 9:19And we did Composer install something, and it said adding that package to Composer.json.
- 9:25And that was when the light bulb struck.
- 9:27I thought that was a great idea.
- 9:28Yeah.
- 9:29So when you do pipemp install requests, it will automatically add requests to your pipfile for you.
- 9:35So you don't have to go and manually curate this file.
- 9:37It'll add and remove packages from it for you.
- 9:39So the file exists basically as you pip install things.
- 9:42Pipemp install things.
- 9:44Inf install things.
- 9:44It will find that file and update it automatically.
- 9:47Precisely.
- 9:48All right.
- 9:48And you can lock it, and then you can also specify if you want a Python 2 or Python 3 virtualenv.
- 9:53And it's really nice.
- 9:55It put a lot of work into the UI, and it has some nice colors and Braille spinners, and it's a very polished product.
- 10:01Really awesome.
- 10:02And so that's out now, right?
- 10:04People can find it.
- 10:04Yes.
- 10:05What's the path?
- 10:06How do they go get it?
- 10:06Well, you can pip install pipemp.
- 10:08It's very meta.
- 10:09And also, it's available at pipemp.org, and there's a nice little animated GIF that'll, or
- 10:14GIF, I'm not sure what the official terminology there is.
- 10:16You're going to start a GIF GIF fight.
- 10:17I don't remember.
- 10:18I'm too tired.
- 10:19It's PyCon.
- 10:20Yeah.
- 10:20I actually don't know which one's proper.
- 10:22Anyway, there's an animated image file that allows you to see it in action.
- 10:28So yeah, pipemp.org.
- 10:30You can check it out.
- 10:31Nice.
- 10:31And are you looking for people to contribute to it, or is it kind of doing its own thing,
- 10:35or what's the status?
- 10:35It's relatively stable.
- 10:36What I'm looking for right now is as much feedback as possible, so I can know how to
- 10:39iterate next.
- 10:40Awesome.
- 10:40So people should just try it out.
- 10:42I want everyone to start using it, because I think it's in a great place where it could
- 10:47become the next virtual M wrapper, effectively, the thing that everyone uses to manage virtual
- 10:52M's and be their go-to tool.
- 10:54And I think it's actually ready for that.
- 10:56So I just kind of want to market it and get people to know it.
- 11:00And then once it gets enough, the snowball starts rolling, then people use packaging tools
- 11:05because they're told to by other people.
- 11:07So it needs to be...
- 11:08The tutorial says type this.
- 11:10Exactly.
- 11:11Exactly.
- 11:11Exactly.
- 11:11So that's...
- 11:12It'll be a snowball effect, and it'll...
- 11:15That's the goal for the project, is to become the next de facto standard, and to have all
- 11:19the best practices baked into it so that you don't have to worry about them.
- 11:22Yeah.
- 11:22It sounds really nice.
- 11:23It also sounds beginner-friendly.
- 11:25Yeah.
- 11:25It's very beginner-friendly.
- 11:26It's also very advanced user-friendly, too, because it just does all the stuff you would
- 11:30do by hand for you.
- 11:31Yeah.
- 11:31Yeah.
- 11:32It's just the beginners don't know what the magic is, and the people who have been doing
- 11:36it for a while are like, oh, it's doing these three things, or whatever, right?
- 11:38Yeah, precisely.
- 11:38Precisely.
- 11:39But if you're a beginner, or you haven't used Virtual Lab and stuff like that, it just works,
- 11:43and it tells you what to type next.
- 11:44You just type pivm shell, and it gives you a shell that has your new Python interpreter
- 11:49in it.
- 11:49And it's much more approachable, and it works on Windows, and it's just a lot of
- 11:54UX polish into the whole process.
- 11:56Yeah.
- 11:56It's good that it works on Windows.
- 11:57That means it's really easy to recommend for your tutorial and your whatever project you're
- 12:02trying to get set up.
- 12:03Okay.
- 12:04So that's your new virtual environment dependency project.
- 12:09What else are you up to since we talked to you about two years ago?
- 12:12I've written a couple of libraries that have been interesting.
- 12:15The one that I want to talk about the most is called Maya, which I think is very interesting.
- 12:19How do you spell it?
- 12:20M-A-Y-A.
- 12:22Maya.
- 12:22Yeah, yeah.
- 12:23Like the Hindu philosophy of the illusion, because time zones are an illusion.
- 12:27So it is a daytime library that kind of turns time zones on their head, because when you're
- 12:33dealing with time zones, you have to deal with localization if you're doing any time zone
- 12:36algebra normally.
- 12:37So that's if you want to do any math to calculate this time zone versus that time zone, which is
- 12:42something that you have to do a lot if you're dealing with timestamps.
- 12:45Effectively, you're already you're parsing a website.
- 12:47Yeah, for example.
- 12:48What are we going to say?
- 12:49I was going to say, like, if you're already dealing with time zones, you're like, you're
- 12:52a little one step down that path as well of like, well, yeah, you can always hack it to
- 12:56work.
- 12:57But if you're trying to do things the right way, I actually cannot figure out how to do
- 13:01it the right way without using it without building this library.
- 13:04So the problem for me was writing a little thing with like an RSS feed and it scraped the
- 13:10time from a website and I told it what time zone it was in and like it would report
- 13:14back that the RSS feed was being published at like two in the morning and it was like that
- 13:18was not the right time.
- 13:19I wanted to be at midnight.
- 13:20So I wanted to fix it the right way at the standard library and I and I worked on it for
- 13:24like four hours on like three, like four lines of code.
- 13:28And, you know, and I'm like someone who knows Python pretty well, you know, is it's like
- 13:32not, it shouldn't be this difficult.
- 13:34You should be able to compare two times.
- 13:35Come on.
- 13:35And I spent all that time and then I finally got it to work and then I deployed it and then
- 13:39it didn't work into production because the server had a different locale than my local machine
- 13:44because the time zone algebra is different when you have different locales.
- 13:47And that was what the straw that broke the camel's back.
- 13:50So I see.
- 13:51It's one thing to have just time zones.
- 13:52It's another to have German time zones versus U.S. time zones or something like that, right?
- 13:57Precisely.
- 13:57Precisely.
- 13:58Yeah.
- 13:58When I'm doing math on time zones, I don't care what the machine, where my machine is located.
- 14:04It's the same everywhere.
- 14:05It doesn't matter.
- 14:06That should not be taken into account when I'm doing time zone algebra.
- 14:09So Maya exists to be, have the philosophy that your data should always be in UTC all the
- 14:16time.
- 14:16You can import it from another time zone.
- 14:19You can export it to another time zone.
- 14:20You can do that very easily.
- 14:22You can generate date times with it, either naive or non-naive.
- 14:26What's a naive date time?
- 14:27A naive date time is a date time object that does not contain a time zone object.
- 14:32Yeah, sure.
- 14:33So in Python, you can't be kind of like...
- 14:35Which is surprisingly difficult to do.
- 14:37That's not like a one-liner.
- 14:38That's like an eight-liner in Python.
- 14:40Which is crazy.
- 14:41If you've got one date time that has a time zone.
- 14:44But with Maya, it is a one-liner.
- 14:45Yes, of course.
- 14:45Yes.
- 14:46And you've got a date time with time zone and one that doesn't.
- 14:49You can't even subtract them, right?
- 14:51They can't be...
- 14:52I'm not sure what would happen.
- 14:53I think it would say it's incompatible.
- 14:54Yeah, I think they're kind of incompatible with each other.
- 14:56Yeah.
- 14:57So the way that you should approach this, if you're ever building an application, is that
- 15:03all of your data should always be UTC all the time.
- 15:05And you should know that.
- 15:06So it should be time zone aware.
- 15:08You should say it's always UTC.
- 15:09You should never store it as anything else other than UTC.
- 15:12And UTC has its problems because UTC is off by a second now and then.
- 15:18But that's okay.
- 15:19We're building...
- 15:19This is for humans here.
- 15:20This is a date time for humans.
- 15:22Right.
- 15:23So the idea is...
- 15:24We're not working on particle colliders.
- 15:26Yeah.
- 15:26This is for parsing websites and dealing with dates on websites and things like that.
- 15:30This is not for scientific uses and stuff like that.
- 15:33So it's all based on epoch time.
- 15:35And it does the math that way, based on a number of seconds since, I don't know, January 1st,
- 15:401970 or something like that.
- 15:42Yeah.
- 15:42And it doesn't use any localization for any of its time zone algebra.
- 15:45And it works very well.
- 15:46And it allows you to just pass in...
- 15:48It has two methods for importing stuff.
- 15:50It has dot when.
- 15:52And you can pass in there any English, any human form of a date.
- 15:59Okay.
- 15:59And it'll give you back the Maya date time object.
- 16:01That's awesome.
- 16:02Like, give us some examples.
- 16:03Like, a week ago, for example.
- 16:05Because that's something that you see on a website.
- 16:07Yeah.
- 16:07Or you could just, like, the way any human would ever write a date in any way.
- 16:12It'll...
- 16:13Two hours from now.
- 16:14Yeah.
- 16:14Two hours from now works.
- 16:15You could do, like, 2, 4, 3, you know, or 2, 4, 14, something like that.
- 16:19That works January 15th, 2015, stuff like that.
- 16:23And you can parse all these?
- 16:24And then there's dot parse.
- 16:25And dot parse gives you...
- 16:27It will read all known standards for machine parsable dates.
- 16:33And it'll give it to you in the Maya date time object, which is in UTC.
- 16:37And then you can export it from there to a date time object.
- 16:41And then it has methods to import and export from all the major RFCs for all the date time objects.
- 16:47So I'm very proud of this library.
- 16:48I think it's great.
- 16:49And I think everyone should use it.
- 16:50It's awesome.
- 16:51Yeah, yeah.
- 16:51I've definitely checked it out and done some stuff with it.
- 16:54You're right.
- 16:55Those are just surprisingly hard problems.
- 16:57And I don't know why.
- 16:58It took me, like, a surprisingly lot of thought and work to build this library.
- 17:04And it shouldn't have.
- 17:06Like, it took me a good three days of solid work to build the prototype of it.
- 17:11And it...
- 17:12So just...
- 17:13I had the API in my head of what I wanted.
- 17:15And then, like, to actually get it working properly...
- 17:17All variations.
- 17:18...by using the proper APIs and stuff, I had to look up so many Stack Overflow questions and stuff.
- 17:23And that's the pain I'm trying to help people avoid is to ever have to ever do any of that work.
- 17:28You're like, okay, we should solve this once and for all and forever?
- 17:30Precisely.
- 17:31Precisely.
- 17:31Awesome.
- 17:32All right.
- 17:32Well, thanks for that.
- 17:33Absolutely.
- 17:33So I want people to give that a try, Maya.
- 17:35If you ever have to deal with date times, especially if you're parsing websites or dealing with data from another source that has a date time, you should check out Maya.
- 17:42Cool.
- 17:43Yeah, so that sounds really cool.
- 17:45There's two other projects that I know of that kind of in this area, I know they're not necessarily solving the same problem.
- 17:49One is called Arrow.
- 17:50Yes.
- 17:51Are you familiar with Arrow?
- 17:51And then the other is Python DateUtil.
- 17:53Like, can you just maybe say...
- 17:54So Python DateUtil is a dependency of Maya.
- 17:58Maya also uses something called Pendulum, which is similar to Arrow.
- 18:02All right.
- 18:02So it's kind of like this competition in this space, but we're all friends and we're building each other up.
- 18:08So I'm using Pendulum to do some of the...
- 18:11I was doing my own date parsing with another humanize or something.
- 18:15I have like five or six dependencies that do a lot of this stuff.
- 18:19And I just wanted an API that like put all the tools together and works great.
- 18:24So Arrow, I'm not overly familiar.
- 18:26I had to look at the readme to know which one's which off the top of my head.
- 18:28Yeah, I always confuse them myself.
- 18:30They all weren't what I wanted because I really want this UTC is king slash queen like mentality in my head of that.
- 18:40Like it's always your data should always be UTC and that you can import and export to other things.
- 18:47And a couple of them did have that, but it just wasn't as solidified as I wanted it to be.
- 18:52So, okay.
- 18:53So, yeah.
- 18:53Yeah, that's a really cool project.
- 18:55I've already played with it.
- 18:57And I was talking to someone here, David Golden, and he's talking about adding a relatively complicated class to add times ranges.
- 19:07So we may get the ability to do some relatively complicated time range algebra.
- 19:13Right.
- 19:13For calendars, like are there conflicts?
- 19:16Exactly.
- 19:16That's where it's coming from.
- 19:17Yeah.
- 19:17Time conflicts for calendars for like 25 people and stuff like that.
- 19:22That's what he wants to solve.
- 19:23So we'll see if we get there on Monday.
- 19:25That'd be an awesome add-on.
- 19:26So you're going to do that for the sprint?
- 19:27You're going to work on that?
- 19:28Potentially.
- 19:28Yeah.
- 19:28If it's a good fit.
- 19:30Okay.
- 19:30Yeah.
- 19:30Yeah.
- 19:30Yeah.
- 19:31Very nice.
- 19:31This portion of Talk Python To Me is brought to you by CodeChip.
- 19:36Try CodeChip Basic, a free, simple, out-of-the-box, continuous integration service in the cloud.
- 19:42Thousands of customers use CodeChip Basic every day.
- 19:45Its pre-installed CI dependencies make testing your software and deploying it work out-of-the-box.
- 19:50The average setup time for CodeChip Basic is less than three minutes.
- 19:55CodeChip Basic comes with a free plan that grants 100 builds per month, unlimited projects, and
- 20:01unlimited users.
- 20:02Do you run an open source project?
- 20:04Those are always free on CodeChip.
- 20:06And they just improved their Python support.
- 20:08So give CodeChip a try and visit talkpython.fm/CodeChip to learn more and sign up for
- 20:15free.
- 20:15That's talkpython.fm/CodeChip.
- 20:19So another project that you're working on that I think is really nice and has a very,
- 20:24take something kind of overly complicated and make it simple is Records.
- 20:27Yes.
- 20:28I don't think we talked about Records before, did we?
- 20:30I don't remember.
- 20:30I don't believe so.
- 20:30I think I wrote it after we talked last.
- 20:32Yeah.
- 20:33So yeah.
- 20:33Why don't you tell everyone about Records?
- 20:34Actually, someone came into the booth, my booth, and said, hey, tell me about Records.
- 20:38You know, I heard you talking about it.
- 20:39It's really cool.
- 20:40Show me a demo of Records.
- 20:41Oh, cool.
- 20:41Isn't that cool?
- 20:42Cool.
- 20:42Yeah, those guys are fun.
- 20:43That's awesome.
- 20:43So yeah.
- 20:44Tell everyone else about Records.
- 20:45So Records is, so SQLAlchemy is an incredible library for dealing with SQL.
- 20:51And it is really interesting when you work for an organization like I do, the way that we
- 20:56deal with data is that we use tools like Heroku Data Clips.
- 21:02And we use a tool called Looker, which allows you to get access in our data warehouse and
- 21:07do some very advanced queries and get SQL out of it.
- 21:10And I want to be able to take raw SQL that is written, that is trusted by a source like,
- 21:18for example, Looker, which is generated by our business team, BizOps team, and put it
- 21:25into my code.
- 21:26And you can do that with PsychoPG, too, very easily.
- 21:29You can just like, say, execute this SQL.
- 21:32But SQLAlchemy gives you a lot of other benefits, like connection pooling.
- 21:37And it has nice connection drivers.
- 21:41You can figure out what kind of database engine to use on its own, right?
- 21:46Precisely.
- 21:47SQLAlchemy, MySQL, it just figures it out.
- 21:50Yeah, and it has a very nice way of, and I also wanted to get back dictionaries of data.
- 21:56So each row is a dictionary.
- 21:57It's also a tuple as well as a dictionary.
- 22:00It acts as both at the same time.
- 22:01Yes.
- 22:02Like a named tuple, right?
- 22:04It's a named tuple that is also a dictionary.
- 22:06It's kind of both.
- 22:07It's a very cool little thing.
- 22:09Yeah.
- 22:09And so I guess for people, if they haven't used it, it's a little bit like just the dbapi,
- 22:13too.
- 22:14One line of it.
- 22:15Right?
- 22:16You just like...
- 22:16Well, the idea is if you want to use SQLAlchemy and you want to just do raw SQL, you
- 22:21have to Google a lot of stuff.
- 22:23And it's like a good...
- 22:24If you want to do it properly, it's like a good 25, 30, 40 lines of code.
- 22:29Kind of got to break out of the object ORM side of things.
- 22:31Yeah.
- 22:32And then there's some niceties that you want to build into it.
- 22:34And then it ends up being 100, 200 lines of code, 300 lines of code.
- 22:37So I built a library for that.
- 22:39And in addition to that, I also built exporting.
- 22:42So I have another library that's very old called Tablib.
- 22:45Okay.
- 22:45And it gives you tabular data sets that you can export as Excel or as CSV or as a bunch
- 22:54of formats, JSON, YAML.
- 22:55So this supports that as well.
- 22:57So you can take your raw SQL.
- 22:59You can get Excel out of it.
- 23:00You can get TSV.
- 23:02You can get CSV.
- 23:03You can get HTML tables.
- 23:05Yeah.
- 23:06Very, very cool.
- 23:07So it's just basically for taking a report from SQL and sticking it into your code base.
- 23:12And either using it to power your application or to generate a report.
- 23:15And there's a command line tool that comes with it too.
- 23:17So it's very little useful, small little thing.
- 23:20Right.
- 23:20It's a fun little toy.
- 23:21But it's very, very powerful.
- 23:23It's cool.
- 23:23It seems to me like if you just want to connect, ask the database a quick question, like this
- 23:28is a really nice way to do it.
- 23:29Exactly.
- 23:30Exactly.
- 23:30Yeah.
- 23:31And you don't want to use SQLAlchemy directly if you're doing that.
- 23:34Because again, you have to look it up and it's not very intuitive.
- 23:38And if you want to parameterize your queries, it's not standard.
- 23:42It took me a while to figure out how to parameterize queries in a standardized way that works across
- 23:47all query languages.
- 23:48So I had to figure out a lot of stuff to get it to work is what I'm trying to say.
- 23:53So I solved all those problems with records.
- 23:55Nobody wants to be little Bobby Tables.
- 23:57Yes, exactly.
- 23:59Exactly.
- 23:59By the time you put all the correct pieces together, it's a lot of work.
- 24:02Yeah.
- 24:02So exactly.
- 24:03So it's easy if you're going to use PsychoPG2 or something like that to, they have good parameterization
- 24:08in PsychoPG2.
- 24:09I shouldn't say that.
- 24:10Yeah.
- 24:10If you're going to use something like SQLAlchemy or anything like that, if you're going
- 24:13to be using raw SQL, it's really easy to not parameterize properly.
- 24:17One little plus with the string and the variable and it seemed all so innocent.
- 24:21Yeah.
- 24:21So innocent.
- 24:21So innocent.
- 24:22What could possibly go wrong?
- 24:23I just merged that one pull request that I got from that stranger and then suddenly all
- 24:27my bank accounts were empty.
- 24:29It didn't make any sense.
- 24:29I don't know what happened.
- 24:30This world's complicated.
- 24:31So are there other projects you want to talk about or maybe just stuff that inspires you?
- 24:35So interesting things in the Python world right now for me are API Star by Tom Christie.
- 24:40Yeah.
- 24:41So he's here not far from my booth and a little not too far from your booth.
- 24:45And he's doing really cool stuff.
- 24:47He's the Django Rush framework guy.
- 24:48Yes, he is.
- 24:49Yeah.
- 24:49Okay.
- 24:49So he built this thing that is a new API framework for Python 3 only.
- 24:55And it uses type annotations in the first way that I've ever nodded my head in agreement.
- 24:59Whenever I've seen type annotations, I was like, that's the stupidest thing I've ever seen
- 25:03in my life.
- 25:03Why don't want that in my Python?
- 25:04But when I see him using them, I'm like, oh, I get it.
- 25:07That makes sense.
- 25:08Yeah.
- 25:08So I think it's kind of a cool idea.
- 25:11And I used it to throw together a little toy API the other day.
- 25:14And the cool thing about it is that it's not Flask.
- 25:17I love Flask.
- 25:18Flask is incredible.
- 25:19I'm a contributor and maintainer of Flask.
- 25:22Flask is one of my favorite things in the world.
- 25:24But it's just nice to change things up.
- 25:26Yeah.
- 25:27And the really cool thing about it is that it automatically generates documentation for
- 25:30you.
- 25:30And it's interactive documentation.
- 25:32Awesome.
- 25:33So.
- 25:33And it uses the type annotations to do that, among many other crazy uses of type annotations,
- 25:38right?
- 25:38Yeah.
- 25:38It's a really cool project.
- 25:39And it's really early on, but it's getting a lot of hype.
- 25:41So he's going to put in all this work.
- 25:43And I think it's going to soar.
- 25:45It might be like the next Flask for API design, maybe.
- 25:48Yeah.
- 25:49Yeah.
- 25:49It's looking really, really promising.
- 25:50It might be companies hiring API star developers one day.
- 25:53Yeah.
- 25:53You know?
- 25:53Yeah.
- 25:54I can see that.
- 25:55It's nice to be there at the beginning, you know?
- 25:57So I encourage everyone to check it out.
- 25:59Yeah.
- 25:59It is really cool.
- 26:00I was impressed with it as well.
- 26:01I'm going to have him on the show in a few weeks.
- 26:03Yeah.
- 26:03It's also one of those things when I'm using it, it's so different than what I'm used to
- 26:06that I found it a little cumbersome.
- 26:07Yeah.
- 26:08So I'm not actually sure.
- 26:09I'm not endorsing it necessarily.
- 26:10I'm just saying that it's really interesting to me because it's something so different.
- 26:15Here's something new and fresh.
- 26:16Yes.
- 26:16I need that.
- 26:17I think I really get bored with using the same libraries all the time because they're so good,
- 26:23the ones that we have.
- 26:24And it's nice to get a new tool in my box that's like, oh, I could use this for something.
- 26:29Yeah.
- 26:30For sure.
- 26:30And that's a rare thing for me.
- 26:31Yeah.
- 26:32It's really great.
- 26:33And also, I mean, he's already been maintaining Django REST framework.
- 26:36Yeah.
- 26:36So he knows a lot about APIs and it's all about self-described APIs too.
- 26:41So he supports VDN and HAL and all, or is it HAL?
- 26:45I don't know.
- 26:45He supports all the self-described API stuff.
- 26:48So it's all hypermedia friendly and it's very proper REST framework stuff.
- 26:54There's a project.
- 26:56Well, I guess he's going to talk about it, right?
- 26:58Yeah, I guess so.
- 26:58You go give us the preview.
- 26:59Okay.
- 27:00There's a client that comes with it too.
- 27:02And it's called core API.
- 27:03And it's the kind of a compliment to it where any API you write with this, you can consume
- 27:08with this thing called core API.
- 27:10And there's a command line client for it, as well as a JavaScript client for it, as well
- 27:14as a Python client for it.
- 27:15And you automatically get, because they're self-described APIs that describe themselves, you get a fully,
- 27:22like, you don't have to write a client for your API.
- 27:24It's just already done.
- 27:26Oh, wow.
- 27:26And in the docs that he generates, show you how to do it in all three of those languages
- 27:30built in.
- 27:31It's like a really solid piece of work.
- 27:33I'm very impressed.
- 27:34That is super cool.
- 27:36Yeah, the thing that I thought was interesting was, here's a guy who's very committed to
- 27:40Django REST framework, creating a new framework.
- 27:42And that caught my attention.
- 27:43Like, wait, weren't you doing that?
- 27:45You know what I mean?
- 27:46Yeah, yeah, yeah.
- 27:46And it's like, well, he can't start from scratch with Django REST framework.
- 27:51It's built on a long heritage of a way of doing things.
- 27:54And this is like, what if we could start again, Python 3 only right now from scratch?
- 27:58And what if we take Django out of the equation?
- 28:00And that's really important, because Django is not necessarily the best thing to be building
- 28:04APIs on, necessarily.
- 28:06It's not necessary.
- 28:07Right.
- 28:08It's got a lot of stuff to support rich web apps.
- 28:10And you can use Django as a library.
- 28:12So you can import Django into an API Star app if you really want.
- 28:15And then you can just start using your models in it.
- 28:18I mean, there's nothing stopping you.
- 28:19Yeah, yeah.
- 28:20How interesting.
- 28:20All right.
- 28:21What other projects?
- 28:22Projects that I love.
- 28:24Yeah.
- 28:24I'm really in love with DocOpt.
- 28:25I've always loved that.
- 28:26Yeah.
- 28:27DocOpt and Click.
- 28:28There are two command line libraries.
- 28:30I was playing with Click the other day.
- 28:31Click and DocOpt are kind of like matter, antimatter.
- 28:35Yeah, they're very opposites of each other.
- 28:37Exactly.
- 28:38Yeah.
- 28:38Tell us about them.
- 28:39It's amazing.
- 28:40It's the opposite of aug parse.
- 28:42It uses aug parse.
- 28:43It turns out when you type any command in Linux and you do --help and it prints out
- 28:50like the thing with the brackets and all this stuff with the commands.
- 28:53Sometimes it's super complicated with lots of symbols separating things.
- 28:57Yeah.
- 28:57There's all these angular brackets and stuff.
- 29:00And you're just kind of like, okay, I can infer what that means.
- 29:03That's an ANSI standard, it turns out.
- 29:05And so you just write that help string in DocOpt in Python as a string.
- 29:11And then you say, parse my arguments.
- 29:13And it just magically knows exactly what to do.
- 29:17So you don't have to write any parsing code.
- 29:18And it's just amazing.
- 29:20So it's good for small things.
- 29:22Like if you're writing a command line thing that doesn't have any like sub commands, maybe
- 29:26like one or two sub commands, it's okay.
- 29:28If it can fit into a single help printout screen, then DocOpt is great.
- 29:33It's an option, yeah.
- 29:34Click is fantastic and a very engineered piece of project from Armin Roeneker, the guy from
- 29:40Flask and a good friend of mine.
- 29:42And he, again, is very engineered.
- 29:45It's like everything from Armin is in a good way, in a good way.
- 29:51You can dive deep into it.
- 29:53And it is, if you're going to build something that has a lot of structure and something that
- 29:59has a lot of sub commands and something that has...
- 30:02Something like Git, maybe?
- 30:03Yeah, or PipM.
- 30:04PipM uses Click, for example.
- 30:06Because it has, you know, I have like five or six sub commands and they all have different
- 30:11arguments and different defaults.
- 30:12And DocOpt wouldn't be a good fit for that.
- 30:14But Records uses DocOpt, you know, different tools for different tools.
- 30:19Yeah.
- 30:19Different dependencies for different dependencies.
- 30:22Yes, precisely.
- 30:23Precisely.
- 30:24Awesome.
- 30:24Other projects you've been loving lately?
- 30:26This is the things that come to mind off the top of my head.
- 30:29I was talking to the Beware guys that are over here.
- 30:31Yeah.
- 30:31I'll do, I guess, a little bit of evangelism for the project.
- 30:33Cool project.
- 30:34It is a cool project.
- 30:35I knew about it last year, but they've come a long way.
- 30:38So Beware allows you to, in pure Python with a pip installable module that is no C extensions
- 30:45or C dependencies at all.
- 30:46To write native Python with a very CSS inspired graphical representation of, that's how you
- 30:54like manipulate the graphics is with like a CSS style Python thing.
- 30:58You can render Windows forms, Coco for macOS and GTK for Linux and web, single page web apps for the web and Android apps and iOS apps, all from the same code base.
- 31:15And there's no C compilation whatsoever.
- 31:18And the thing that I'm excited about that I just learned about during PyCon was that they've taken that and they've made a project called Briefcase, which allows you to package up your application into an executable distributable, which is something that I used to work with quite a bit.
- 31:33And there's a lot of packages out there that allow you to do that, but they're very cumbersome and they're all very different.
- 31:39They sometimes work.
- 31:40And they, they all, you can always get them to work.
- 31:45But it's a, it's a challenge sometimes.
- 31:47Yeah.
- 31:47Especially if you're using something like PyQT and embedded web kits and it's, it can be very cumbersome.
- 31:54So it's, I'm very impressed with the demo that I got.
- 31:57So I think it's pretty cool looking.
- 31:58And then I might start playing with Briefcase.
- 32:00I'm really.
- 32:01Because I like shipping executable distributables.
- 32:03Yes, exactly.
- 32:04Like that, I feel like that's one of the shortcomings we have is that we don't ship that many.
- 32:09Hey, here's my app.
- 32:09Double click it and look at the amazing stuff it does.
- 32:11As a Python community?
- 32:12Yes, yes.
- 32:13I completely agree with you.
- 32:14Yeah.
- 32:14At the keynote here, we saw like this hockey stick growth of Python and you could see it
- 32:20across other metrics and like Stack Overflow trends and other places.
- 32:22And I just, I think how much steeper would that be if we had a solid desktop UI story?
- 32:27Yeah.
- 32:28You know, I mean, that could just like, people already love it so much.
- 32:30The second you said that, I was like, I could fix that.
- 32:33But I have a policy of, I don't want to build things.
- 32:35I don't want to, that I'm not dog fooding.
- 32:37Yeah.
- 32:38Or I'm not sipping my own champagne.
- 32:39I don't have any graphical user interfaces to build.
- 32:42Yeah.
- 32:43Yeah.
- 32:43Yeah.
- 32:43Yeah.
- 32:43But I would love to, that'd be so much fun.
- 32:45I would love to see that.
- 32:46That camera.
- 32:47I could write the documentation for that.
- 32:49There you go.
- 32:49That's what, it just, it's really a documentation problem.
- 32:52Yeah.
- 32:52Well, those guys have some pretty solid stuff.
- 32:54You just have to say, this is the proper way.
- 32:55And then people do listen to you.
- 32:57It's really cool.
- 32:58Do it this way.
- 33:01Yeah.
- 33:01Awesome.
- 33:02All right.
- 33:03So, other projects top of the, run through your, your high, high love list.
- 33:08High love list.
- 33:08Those are the ones that have come to mind.
- 33:10Flask.
- 33:10Always great.
- 33:11I'm technically a core contributor and I'm going to, I've been running out of things to do in my free time lately.
- 33:17Like I've just been really bored and I've been dying to figure out something to do in open source lately.
- 33:21Cause I've been working on PipEmp and stuff and, and that I've kind of atrophied with like things to do there.
- 33:28Cause it's kind of done.
- 33:29And I have to wait until I make a new decision to make any progress there.
- 33:33Cause it's, it's very stable.
- 33:35Right.
- 33:35That's why you need people to kick it around a bit.
- 33:37And I need more users.
- 33:38Yeah, exactly.
- 33:39It has a nice user base, but I need the masses to come.
- 33:43Well, you're used to a different level of user base.
- 33:45Precisely.
- 33:47Yeah.
- 33:47I only have 10 million users.
- 33:49I don't remember where I was going to go with that,
- 33:51but what was your question again?
- 33:53What, what other projects do you love that you're like, you said you were thinking about contributing to something.
- 33:57Oh yeah.
- 33:58So I'm might make a point to start actually being a real maintainer of flask.
- 34:03I think that would be good.
- 34:04Help triage issues and stuff like that.
- 34:07And I would be proud to say, I did say earlier because I'm planning on doing this, that I am a committer to flask.
- 34:14So I've had the commit bit for like three years, but I've, I've only merged like three pull requests.
- 34:19Sure.
- 34:19Yeah.
- 34:19I've never really done anything with it, but I would be really proud to add that to my resume that I'm like, that I helped maintain one of the most beloved pieces of software ever.
- 34:29In my opinion, I love flask.
- 34:31I think it's just the best.
- 34:32Yeah.
- 34:33I love the simplicity of flask and frameworks, right?
- 34:36One of those things though, where I, as a user, I don't have any complaints.
- 34:41Yeah.
- 34:41So I don't know what to work on.
- 34:43I don't want to do anything to it.
- 34:43Yeah, exactly.
- 34:44And I'm sure if you open the issue tracker, you'd find quite the opposite, but I have as a, I don't have any complaints, so I don't have anything I want to work on.
- 34:51Yeah.
- 34:51I guess.
- 34:52I don't have any ideas because it's one of those things that's written by someone who's a lot smarter than I am.
- 34:57Armin.
- 34:57Well, I think, you know, around a lot of those things, one of the places where it could open up is the whole async await stuff, but, but that's so much the whole whiskey.
- 35:06That's whiskey.
- 35:06Yeah.
- 35:07That's a whole other animal.
- 35:08The whole stack is like not really ready for that.
- 35:10Flask channels.
- 35:12Yeah.
- 35:13Yeah, exactly.
- 35:14Like Django channels.
- 35:15Yeah.
- 35:15Yeah.
- 35:16Yeah.
- 35:16We need Daphne for, Daphne for Flask.
- 35:19Right.
- 35:20So maybe, I mean, maybe that's somewhere that needs some pushing.
- 35:22I'm not actually familiar with all the options out there for that, but.
- 35:24Yeah.
- 35:25I don't know what that would look like.
- 35:26That'd be interesting.
- 35:26It's interesting to think about, but at the same time, it might not be a problem you have, right?
- 35:30Like I find these web apps are actually quite fast already.
- 35:32Yeah.
- 35:33Yeah.
- 35:33If you build things to be scalable, which just means they need to be predictably the
- 35:38same speed.
- 35:39Less stable.
- 35:39And then you really don't have any problems.
- 35:41And I think everything's pretty fine.
- 35:43I don't think we have to really go into some bleeding, cutting edge concurrent worlds if we
- 35:49don't have to.
- 35:50I think it's wise for things that you're consuming, like for requests, for example,
- 35:53we're planning on going to async.
- 35:55You are?
- 35:55Yeah.
- 35:56I was about to ask you, what's the plans for requests?
- 35:57So async is going to make its way in there.
- 35:59So I could like await a request.get, maybe a get async?
- 36:02Yeah, exactly.
- 36:03There would be a new set of calls.
- 36:06Like right now there's request.get, request.post.
- 36:09So there would probably be a request at async.get or something like that.
- 36:13And then you would await on that and it would just work.
- 36:17That sounds like the business.
- 36:18Yeah.
- 36:19Yeah.
- 36:19Are you familiar with, what is it, aiohttp clients?
- 36:22I don't know exactly what.
- 36:23I had Guido walk me through the code once and it seemed relatively straightforward.
- 36:27It seemed like G event, but with explicit instead of the opposite.
- 36:31Nice.
- 36:33So I'm really excited to hear about this async request stuff.
- 36:36Yeah.
- 36:37We're working on it during the sprints.
- 36:39So, well, Corey is working on it during sprints, I should say.
- 36:41There's a project that we depend on called UR Lib 3.
- 36:44And that is something that is being, V2 is being worked on by Corey, one of the core contributors
- 36:52to requests.
- 36:52Uh-huh.
- 36:53And he is going to work on the preliminary async stuff.
- 36:59He's going to get ready.
- 37:01He's like refactoring it, rewriting it.
- 37:03And it's going to be in preparation for adding async to that.
- 37:07And then once we add async to that.
- 37:09And then you're like, all right, we're going to do this.
- 37:11And then we're going to do it.
- 37:11Yeah.
- 37:12And then in maybe six years, we might get to flip those APIs around.
- 37:16So maybe the default in request would be asynchronous.
- 37:20And then there would be async that would be separate.
- 37:23Right.
- 37:24But that would happen in like six years.
- 37:25That really depends on how the community moves and stuff like that.
- 37:28I honestly would be surprised if that's how things move.
- 37:32But we'll see.
- 37:34People find concurrency confusing.
- 37:36They really do.
- 37:37And I am hoping that I can really help bridge the gap with requests to make it be like,
- 37:43this does not have to be scary.
- 37:44This can be exactly what you're used to, except for magically amazing.
- 37:49I'm really excited to hear that.
- 37:52It is challenging.
- 37:53But I was talking to somebody, listening to one of the other podcast Python Bytes that I do.
- 37:58And I'd cover the AIOHCP client stuff.
- 38:01And they said, I'm trying to remember the numbers.
- 38:04It's like, oh, I had this project where we do a lot of scraping or API calls or something.
- 38:09And it would take 16 minutes to run.
- 38:12Yeah.
- 38:12They flipped it to the async version.
- 38:14And it ran in like 30 seconds.
- 38:17And it actually crashed the machine because it was like doing too much.
- 38:20They had to throttle it.
- 38:22Yeah.
- 38:22Yeah.
- 38:22So I mean, just like.
- 38:23It's because people don't understand.
- 38:25I'm not saying they don't understand.
- 38:27But I feel like there's a basic, simple computer science.
- 38:31I'm not a computer science student by any means.
- 38:34But there's like, you know, you have two things that a computer is limited by that your program is limited by.
- 38:38It's IO bandwidth and CPU bandwidth.
- 38:40And if you don't understand those things, it's very easy to.
- 38:44If you do understand those things, you can not use these new async things.
- 38:50And you can get very good performance with just using threads or just using multiprocess or in doing stuff like that.
- 38:58The magic of async is that, you know, it just takes that to this logical extreme where you have these event loops that are just like.
- 39:08Yeah.
- 39:09And I think actually what they were going to, I think they might have run out of memory because they had too much pulled in at once.
- 39:13Yeah.
- 39:14Something like that.
- 39:15But just the like.
- 39:16It opens up a whole new can of worms of things that people don't understand.
- 39:19And that's one of the things that I kind of prefer synchronous programming.
- 39:23Yeah.
- 39:23Myself.
- 39:24Because it's something that is approachable and people understand.
- 39:27And so I think I want to encourage people to understand how to better optimize synchronous code.
- 39:33Yeah.
- 39:34And there's some great things for that.
- 39:35So there's a product like Minald's.
- 39:37Have you seen that?
- 39:37No, I don't think so.
- 39:38It's a WSGI server that you can use with Gunicorn.
- 39:40Okay.
- 39:41And it uses an asynchronous event loop.
- 39:43But you just turn it on.
- 39:45And it just spawns every request.
- 39:48Gets like a new green thread or something like that.
- 39:50And your code just magically is asynchronous.
- 39:52You know, and it's just like, that's how G Event works too.
- 39:55But it's not using monkey patching.
- 39:56Right.
- 39:56And that's the level of async that I like is where it's at like the thread level.
- 40:04Right.
- 40:04I don't want it to be at the code level necessarily.
- 40:07Unless it's something like requests doing it.
- 40:09I don't personally want to be writing code that is dealing with this stuff.
- 40:14I want to be consuming the code that's dealing with that stuff.
- 40:17Right.
- 40:17Yeah.
- 40:17So I think those are solving slightly.
- 40:18Like as a software engineer, I don't think people should have to touch the asyncio APIs.
- 40:25I think that they should be consuming them.
- 40:27Yeah.
- 40:28And it's really interesting.
- 40:29So I mean, on one hand, like any server environment, it's like almost by the time it gets to your code, it should already have taken care of that problem.
- 40:36Precisely.
- 40:37Precisely.
- 40:38Yeah.
- 40:38I mean, if you're on like your one.
- 40:39Unless you're like working for a major company, you know, a company that has some major technical issues.
- 40:46Not issues, but technical problems that they're challenges.
- 40:48Yeah.
- 40:49And they're like, we're going to solve this problem in this really cool way.
- 40:52And then.
- 40:53Your discuss, your Instagram.
- 40:55Yeah.
- 40:55Urban airship or something.
- 40:56Exactly.
- 40:57Yeah.
- 40:57Precisely.
- 40:58Exactly.
- 40:59But most apps don't totally need it.
- 41:01Yeah.
- 41:02So, but that example of 16 minutes to 30 seconds really is like, wow, you could really get a lot out of that.
- 41:08And to see if I could use requests to do that, that would just make me smile.
- 41:11Yeah.
- 41:11Well, you can do things like that today because there's a, there's a library called request futures, which is really great.
- 41:15Okay.
- 41:16And it uses the concurrency.futures module to allow you to spawn off either threads or sub processes or anything else.
- 41:26There's also a G request, which I wrote a very long time ago, which is not very well maintained, but it allows you to use a G event with requests.
- 41:33Okay.
- 41:34So there are ways to do this today.
- 41:35And again, you can do it at that module level.
- 41:37So you just write your synchronous code and you just kind of wrap it in an asynchronous paradigm.
- 41:42You know, use something like Celery and then you can, you, and then you get concurrency out the wazoo.
- 41:47Awesome.
- 41:49Yeah.
- 41:49It's really cool.
- 41:49Yeah.
- 41:50This portion of Talk Python To Me is brought to you by Hired.
- 41:55Hired is the platform for top Python developer jobs.
- 41:58Create your profile and instantly get access to thousands of companies who will compete to work with you.
- 42:03Take it from one of Hired's users who recently got a job and said,
- 42:07I had my first offer within four days and I ended up getting eight offers in total.
- 42:10I've worked with recruiters in the past, but they were pretty hit and miss.
- 42:14I tried LinkedIn, but I found Hired to be the best.
- 42:17I really liked knowing the salary upfront and privacy was also a huge seller for me.
- 42:21Well, that sounds pretty awesome, doesn't it?
- 42:23But wait until you hear about the signing bonus.
- 42:25Everyone who accepts a job from Hired gets a $300 signing bonus.
- 42:28And as Talk Python listeners, it gets even sweeter.
- 42:31Use the link talkpython.fm/Hired and Hired will double the signing bonus to $600.
- 42:37Opportunity is knocking.
- 42:39Visit talkpython.fm/Hired and answer the door.
- 42:43Let's maybe talk a little bit about PyCon.
- 42:45We're sitting here.
- 42:46Yes.
- 42:46In an extremely large room that's actually luckily quite empty right now so we can get some good audio, but it's been very busy.
- 42:52It has.
- 42:53It's been very exciting.
- 42:54What's your takeaway for the week?
- 42:56You had a good time?
- 42:56I've had a fantastic time so far.
- 42:58I'm sad that you're speaking about it retrospectively.
- 43:01It's in the past, right?
- 43:02It's halfway over, I guess, ish, right?
- 43:05Yeah, more or less.
- 43:05And it breaks my heart because it's my favorite time of the year and I feel like I just got here.
- 43:11And I did just get here.
- 43:12Yeah, it was really amazing.
- 43:14Every time I come here, it's just so many great people to meet.
- 43:18And this year I had a booth, so I really got to meet more people.
- 43:21I didn't have to randomly run into them.
- 43:23Yeah, yeah.
- 43:24You have the Heroku booth that you're hanging out at.
- 43:26Yeah.
- 43:27And it's just...
- 43:28For me, PyCon is the one time of year that I have a family at home, of course, but it's really...
- 43:34The Python community is my true family and I get to really be with my family.
- 43:38And I get to do that when I...
- 43:40I don't really go to as many conferences as I used to go to.
- 43:44But PyCon has always been the home, like, coming home conference because you get to see almost every single person.
- 43:50And they're my best friends in the world, you know?
- 43:53And it's utterly fantastic.
- 43:54It's awesome.
- 43:55Yeah, there's a couple of people that I've been working with really closely for a long time but I've never physically seen.
- 44:01My biggest takeaway from PyCon so far has been these fidget spinners.
- 44:05The world has become fidgety.
- 44:07They're solving a fidgeting problem this year.
- 44:09Yeah, I went out to the Saturday market here in Portland and I just got a higher end one.
- 44:13Because there was a booth here at PyCon that was giving out fidget spinners.
- 44:16Tell people what the heck is this fidgety spinner thing.
- 44:19It's something you hold in the center and then you spin it.
- 44:22And then, like, you can rotate it and you feel a centrifugal force and it gives you something to do with your hands.
- 44:27Yeah, I guess I'll try to describe it.
- 44:28Like, imagine a little weighted circular thing with a fixed ball bearing like an axle almost in the middle.
- 44:36Yeah.
- 44:37You spin it really smoothly.
- 44:38Yeah, they're kind of designed, at least the hype on the internet is saying that they're designed for kids with ADD.
- 44:43Okay.
- 44:44And I have ADD.
- 44:45Yeah, okay.
- 44:46And I find it to be very useful.
- 44:47I usually am vaping like an electronic cigarette.
- 44:51Yeah.
- 44:51And that gives me something to do with my hands and I find it very pleasurable on many levels.
- 44:54And I find it difficult to be a PyCon because I can't, like, be vaping when I'm walking around.
- 45:00We're trapped inside, more or less, yeah.
- 45:01Yeah, so I have, like, a nicotine patch on and that helps.
- 45:03But when, as soon as I got one of these, I, like, totally forgot about smoking because it's just giving me something else to do.
- 45:11So, it's, I'm actually really loving it.
- 45:13Yeah.
- 45:13Yeah, fidget spinners.
- 45:14And I think it's going to help me a lot because I work from home and I'm in meetings and I'm usually smoking during the meetings and it's kind of rude.
- 45:20So, I'm going to start, and during my podcast, if you listen to Import This, you'll hear, like, little, this weird puff sound.
- 45:26It's because I'm vaping.
- 45:27So, maybe I'll start fidgeting instead.
- 45:30Yeah, you'll be fidgeting.
- 45:31And those things are dead silent because they're, like, smooth ball bearings, so.
- 45:34Yeah, yeah.
- 45:34Do you want to try it?
- 45:35Yeah, let me check this out.
- 45:36Yeah.
- 45:36All right.
- 45:36Well, this is high-end.
- 45:38Yeah, that one's really cool.
- 45:39Wow.
- 45:39It was $25, that one was.
- 45:41This one was free.
- 45:42And then this one was $15 I bought from a kid.
- 45:46They set up a little shop downtown and the kids were selling them.
- 45:50Kids don't do ice cream stands and lemonade stands?
- 45:53No, they're selling spinners.
- 45:54That's awesome.
- 45:55They raise money for research for their autistic brother.
- 45:58Wow, that is actually super cool.
- 45:59Yeah, it was a great story.
- 46:00I had to buy one.
- 46:01I don't need three of them, but I, you know, I can't say no to that.
- 46:06Yeah, that's right.
- 46:07So, did you go check out the keynotes?
- 46:09No, I do the hallway track at PyCon.
- 46:11Yeah.
- 46:11So, I make a point to not go to almost any talks.
- 46:14I went to, Corey Benfield did a talk on requests under the hood and I went to support him at
- 46:19his talk.
- 46:19But that's the only talk I've been to so far.
- 46:21And there's a really great talk at the end of the day tomorrow on NES video games and hacking
- 46:27them with Python.
- 46:27Yeah, that's got a lot of...
- 46:28So, I'm probably going to try to make it to that one.
- 46:31Yeah, I mean, people should check out, what is it, youtube.com slash PyCon 2017.
- 46:36It's already, videos are already showing up there.
- 46:40Oh, really?
- 46:40Yeah, yeah.
- 46:41There's like, I don't know about the talks yesterday, but the tutorials are up.
- 46:44Yeah, and they have, they're transcribed live.
- 46:47Yeah, it's really amazing.
- 46:48These guys do a great job putting that on.
- 46:50I'm really impressed with the accessibility of this conference.
- 46:52I've seen people here with wheelchairs, which is, I don't, I've never noticed that before.
- 46:56I'm sure it's been a thing.
- 46:57But they also have teleprompters, not teleprompters, but what's the opposite of a teleprompter?
- 47:02Telescribe?
- 47:03Yeah, like a live transcriptionist type thing, whatever.
- 47:06Yeah, like you have in court.
- 47:07Yes, exactly.
- 47:08But for the videos during the talks and even the questions that are being asked are being transcribed.
- 47:14And I very, it's just, I love this conference.
- 47:17It's a great conference.
- 47:18Yeah.
- 47:18And I go to a lot of conferences and PyCon is by far my favorite.
- 47:21That's cool.
- 47:21All right.
- 47:22So you've been walking around, like I have been.
- 47:24I'm not been going to, I went to the Jake VanderPlas' keynote on why Python is popular
- 47:29in science and it was actually brilliant.
- 47:31I talked to him about that yesterday afterwards.
- 47:33It's inspiring.
- 47:34Was it really?
- 47:35So the short takeaway is, like he said, like, look, Python is a mosaic of people using it
- 47:41for different things and they're coming in from different angles.
- 47:44The way, like, an astronomer might pull up some data and, like, play and iterate with
- 47:49it is very different than, like, you and I might write a web app where we're going to
- 47:52very structured.
- 47:53Yeah, yeah.
- 47:53And it's like a static thing that we build up over an architecture.
- 47:56And just, like, talking to people from different backgrounds who use the same tools in different
- 48:01ways gives you a really interesting perspective on life.
- 48:03Oh, it does.
- 48:04It does.
- 48:04Yeah.
- 48:04And Python gives us this common ground to build upon.
- 48:07You can meet people who work on satellites and who work on web apps and who hack and who...
- 48:13Yeah.
- 48:13It's amazing.
- 48:14And you're all, like, family to each other because you just speak the same language.
- 48:18Yeah, it's amazing.
- 48:19Last night I went to dinner with some of the guys from PyCharm and a bunch of people from
- 48:23the Data for Democracy group.
- 48:25A bunch of data scientists that are doing, like, volunteer work for democracy and freedom
- 48:30around the world.
- 48:30Yeah, it's just ridiculous.
- 48:32I love this place.
- 48:34I truly always regret not staying longer because I'm staying for only one day at the sprints.
- 48:38Yeah.
- 48:39And I always wish I'd stay longer because I really wish PyCon was all year round.
- 48:43I just wish this was my life because it really is like coming home.
- 48:46It's really nice.
- 48:48Yeah, I totally recommend the...
- 48:49If anyone is listening and hasn't come to PyCon, I want you to know that my first PyCon,
- 48:54I paid for myself.
- 48:55I didn't have an employer paying for me to go and I wasn't making much money at the time.
- 49:00It was a very large expense, but they do have financial aid available.
- 49:04I probably should have applied at the time.
- 49:06It was worth every penny.
- 49:08It totally changed my life.
- 49:09And I had been doing Python for, like, quite a while at that point.
- 49:12And it was a big deal for me to go to my first PyCon and I can't recommend it more.
- 49:16That's awesome.
- 49:17I definitely want to second that.
- 49:18And as far as tech conferences go, this is pretty affordable for the size and scale.
- 49:23Like, a lot of, like, OzCon.
- 49:25Oh, yeah.
- 49:25I looked at that.
- 49:25It's like $1,500.
- 49:26Conferences are extremely expensive.
- 49:28This is a very approachable and doable conference.
- 49:30It's like $300 or something.
- 49:32Yeah, but when you add up the hotel costs and the flights and it's, you know, if you're not making, you know, a really good developer salary, then it's, you know, it's a lot of money.
- 49:41If you can't drive in from, like, some four-hour radius, then it starts to really get intense.
- 49:46Yeah.
- 49:46Yeah, especially the hotel costs.
- 49:47But they have financial aid available, too.
- 49:49So if there's any reason that finances are a reason that you can't come to PyCon, apply.
- 49:54And they'll, like, give you a free ticket.
- 49:55It would be cool for somebody to set up some kind of, like, web app before these events.
- 50:00So people who are, like, looking to room share and, like, save money.
- 50:04Yeah, yeah, yeah.
- 50:04They could, like, kind of be, like, find your PyCon roommate.
- 50:08Forgot about that.
- 50:09Wouldn't that be fun?
- 50:10That'd be a fun project to set up.
- 50:11Wouldn't that be a fun project?
- 50:12Well, I know in years past that was a thing.
- 50:14Okay.
- 50:14Because I remember the year I went myself, there was, like, a mailing list of people trying to find room shares.
- 50:19I'm not sure.
- 50:19It must still be a thing.
- 50:21Yeah, probably.
- 50:22I assume.
- 50:22But maybe not.
- 50:24I don't know.
- 50:24It'd be cool to make something like that.
- 50:26I assure you it did exist.
- 50:27Yeah.
- 50:27Awesome.
- 50:28All right.
- 50:29So, yeah, definitely if you guys are out there listening and you haven't come to PyCon, you should come.
- 50:33But you should get your tickets straight away or you won't be able to come.
- 50:35Yeah, it sells out.
- 50:36And it's cheaper the earlier you buy them, too.
- 50:38Absolutely.
- 50:39Yeah.
- 50:39All right.
- 50:40Kenneth, thanks for being on the show, man.
- 50:41Always a pleasure.
- 50:42I'm a huge fan of the show.
- 50:43And I want to really thank you for all the great advice you give all these developers.
- 50:47And I listen to you when I'm taking baths all the time.
- 50:51Oh, thank you so much.
- 50:52That is awesome.
- 50:53You're the only one I still listen to.
- 50:56I don't listen to podcasts often enough to be caught up on them, but you're always the one I pull up to listen to.
- 51:01Wow.
- 51:02So, I listen to you on the way here, actually.
- 51:03How cool.
- 51:04Awesome.
- 51:04Yeah.
- 51:05So, really quick before we go, tell people about your podcast.
- 51:08Oh, I have a Python podcast.
- 51:09It's called Import This.
- 51:10If you Google Import This, Kenneth writes, you'll find it.
- 51:13It's on SoundCloud.
- 51:15And I do very long interviews with Python friends of mine.
- 51:20And we just catch up and talk about Python.
- 51:22And actually, we talk about things that are unrelated to Python often, like their lives and stuff like that.
- 51:28And I just put it.
- 51:28It's very unfiltered, uncandid.
- 51:31It's a raw, natural conversation.
- 51:33Yeah.
- 51:33There's no editing or anything like that.
- 51:35I mean, it's produced, but it's not.
- 51:37I just hit record, basically.
- 51:38Awesome.
- 51:39So, it's a great little thing.
- 51:40And some people really like the longer format podcasts.
- 51:43So, it's one of those.
- 51:44If you need something on your commute, you should check it out.
- 51:46Awesome.
- 51:47And I'll definitely be sure to link to it in the show notes of people and just click on it and go there.
- 51:50Yeah, it'd be awesome.
- 51:51All right.
- 51:52Thanks again for being on the show.
- 51:53Yeah, definitely.
- 51:53This has been another episode of Talk Python To Me.
- 51:58Today's guest has been Kenneth Wright.
- 52:00And this episode has been brought to you by CodeShip and Hired.
- 52:03Do you have software?
- 52:05Would you like to know if it has bugs before you deploy it?
- 52:09Then jump over to talkpython.fm/code ship and set up a free CodeShip basic account,
- 52:14ship tested software.
- 52:16Hired wants to help you find your next big thing.
- 52:19Visit talkpython.fm/hired to get five or more offers with salary and equity presented
- 52:25right up front and a special listener signing bonus of $600.
- 52:28Are you or your colleagues trying to learn Python?
- 52:31Well, be sure to visit training.talkpython.fm.
- 52:34We now have year-long course bundles and a couple of new classes released just this week.
- 52:40Have a look around.
- 52:41I'm sure you'll find a class you'll enjoy.
- 52:43Be sure to subscribe to the show.
- 52:45Open your favorite podcatcher and search for Python.
- 52:47We should be right at the top.
- 52:49You can also find the iTunes feed at /itunes, Google Play feed at /play, and direct
- 52:54RSS feed at /rss on talkpython.fm.
- 52:58Our theme music is Developers, Developers, Developers by Corey Smith, who goes by Smix.
- 53:03Corey just recently started selling his tracks on iTunes, so I recommend you check it out at
- 53:07talkpython.fm/music.
- 53:09You can browse his tracks he has for sale on iTunes and listen to the full-length version
- 53:14of the theme song.
- 53:16This is your host, Michael Kennedy.
- 53:17Thanks so much for listening.
- 53:18I really appreciate it.
- 53:19Smix, let's get out of here.
- 53:21Outro Music.
- 53:43*outro music*
- 53:44Thank you.