Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book


Transcript #65: Speed of your import statements affecting performance?

Return to episode page view on github
Recorded on Wednesday, Feb 7, 2018.

00:00 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.

00:04 This is episode 65, recorded February 7th, 2018.

00:08 I'm Michael Kennedy.

00:09 And I'm Brian Ackett.

00:10 And we got a bunch of cool stuff.

00:13 I really am excited to share a couple of these things with you.

00:15 And I'm excited to have Rollbar as a sponsor.

00:18 So you probably heard about Rollbar from other episodes.

00:21 If you want to check them out, we got a special offer at pythonbytes.fm/rollbar.

00:25 Tell you more about that later.

00:26 I kind of want to know about some charts.

00:29 I have got like this just...

00:31 Have you ever seen the test output on Jenkins?

00:35 If you have testing?

00:36 No, I haven't played with Jenkins.

00:37 Okay.

00:38 Well, so in Jenkins builds, there's this thing where you can, after you run your tests,

00:42 you can have it display your passed and failed tests in this little graph.

00:47 It's just a little chart.

00:48 It's an area chart.

00:49 I wanted one of those, but I wanted something that would show like five of those charts, a whole bunch of them.

00:55 So it doesn't do it automatically.

00:57 I probably could have hunted into Jenkins or something, but I wanted to build my own thing.

01:02 So I want to do it in Flask.

01:04 And I've been trying to figure this out.

01:06 And there was a great tutorial by...

01:09 This is going to be a little story anyway.

01:11 But there was this great tutorial by the Matt McKay from Fullstack that showed how to do this,

01:17 almost how to do this in Boca or Bokeh.

01:20 Yeah.

01:20 Very nice.

01:21 That's a cool project too.

01:22 Yeah.

01:22 But Bokeh, the current version of Bokeh dropped the charting feature.

01:26 That's not helpful.

01:28 But there goes your solution you just found.

01:30 Yeah.

01:31 So I'm trying to do it in...

01:32 And I gave up and asked Twitter.

01:34 And what came back was one of these options was Pygal, P-Y-G-A-L, which ends up very...

01:41 It's very simple, but I can...

01:43 Within 20 minutes, I had a Flask app running with these charts up.

01:47 So it's not as hugely featured as some of the other graphing applications, but it's very cool.

01:54 And it also can export SVG.

01:56 So these are small.

01:57 It's pretty small also when you're displaying these.

02:00 That's cool.

02:01 And the SVGs can have basically infinite, very high levels of sort of zoomability, right?

02:08 Because they're scalable, right?

02:10 That's their first name.

02:12 That's the S.

02:13 They also do PMGs, like you said.

02:14 That's cool.

02:15 And they have a bunch of great looking charts.

02:16 Like, these are really nice.

02:18 So you can do like bar charts or Py or the radar ones, all sorts of good stuff.

02:22 So I still want to get something like bouquet or something like that to work so that I can

02:26 make them interactive because these aren't interactive things.

02:30 You build them and just display them.

02:32 But for my needs right now, that works.

02:35 And it's very nice.

02:36 Yeah, very nice.

02:37 And kudos to the people writing the documentation because they have documentation on how to...

02:42 Pretty much they have it in Django, Flask, and pretty much any HTML that you

02:46 want to throw this in, how to do that.

02:48 Oh, yeah.

02:49 That's super cool.

02:50 And they have nice pictures, which is always really powerful when you're talking about graphs

02:55 or UI or things like this.

02:56 Yeah.

02:57 You can just admire the picture.

02:58 You go, okay, I want this.

02:59 Now I'll pay attention.

02:59 Really nice.

03:01 So a lot of people send us messages and they ask for advice on like a sort of career path

03:06 or I'm thinking about this technology or how do I get started in programming or, you know,

03:11 something like that.

03:12 And there was this really interesting post over on Reddit under learn programming.

03:18 And so it's not technically a Python thing, but a bunch of Python people are hanging out

03:22 there.

03:22 So that's kind of cool.

03:24 And the idea was this guy, he gets a guy who wrote me.

03:28 Anyway, person posted it, sent a message and said, hey, look, I'm 31 days into a self-study

03:34 program on Python and I'm loving every minute of it.

03:36 A couple of questions.

03:37 Could you all fill this out just so we can share our experiences?

03:41 Oh, interesting.

03:42 Isn't that cool?

03:42 So what were you doing before you began self-study and programming?

03:45 So it's for people who are doing self-study and what made you want to study programming on

03:50 your own?

03:50 How did you get started?

03:52 How long did it take for you to feel confident enough in your skills and knowledge to think

03:56 that you could be employed?

03:57 What else did you do besides self-study that helped you?

04:01 And what are you, what's next?

04:03 And this thread just blew up on Reddit and there's all these really interesting conversations.

04:09 And so anyone out there who is sort of in the early stages of self-study, maybe they're

04:13 doing a hundred days of code type thing, or they're in a bootcamp or they're taking, you

04:18 know, online courses.

04:19 I know a few places have good ones of those.

04:21 I think going through here and reading this, it would be really, really valuable to sort of

04:28 have that shared experience.

04:29 Isn't that cool?

04:29 Oh, that's great.

04:30 Yes.

04:31 So there's another story that's linked from there.

04:33 So this one doesn't technically count as an item, but people might also find it interesting

04:37 as a thread to keep following is someone said, oh, this, there are people who are like 30,

04:43 40, like, hey, I'm learning to code in my forties.

04:45 And you guys are really inspiring me to realize this is actually possible.

04:49 It's not too late for me, you know?

04:51 So there's this article called stories from 300 developers who got their first tech job in

04:55 their thirties, forties, and fifties linked from there.

04:58 That's cool.

04:59 I got to go read that.

05:00 Yeah.

05:01 And I think that might be real helpful to some folks as well.

05:03 So if you're in this space and you want some shared experiences and to connect with some

05:08 people, check out this thread we're linking to because I think it's helpful.

05:10 On that topic of learning, actually, there's a couple episodes of Test and Code that'll be

05:16 good.

05:16 I just did one recently about extended learning through universities, which I hadn't considered

05:22 before.

05:23 And then also there's upcoming, I'm talking with Stephanie Hurlbert on talking with mentors

05:30 and opening yourself up to be a mentor as well.

05:32 Yeah.

05:33 Yeah.

05:33 Very cool.

05:33 I'm looking forward to checking those out.

05:35 This is one of those well-planned, awesome transitions.

05:37 Amazing.

05:38 So one of the things that you probably don't care about when you're getting started is how

05:42 fast your imports run.

05:43 You probably don't know what an import is at the beginning.

05:46 Exactly.

05:46 But import, how long it takes to import your different modules is part of the painful startup

05:53 process of any Python application.

05:55 And I didn't really know how to debug that, actually.

05:58 I never really thought of it before.

05:59 But in Python 3.7 coming up, there will be a, there is a dash X import time that allows

06:07 you to, there's a flag that you can run that allows you to investigate and profile all of

06:14 the time for importing different libraries, which sounds really cool, actually.

06:19 Yeah, that is really, really quite cool.

06:22 And so you can just basically run it and it'll tell you this library took that long to import.

06:28 This other library took that long to import and so on.

06:31 And I didn't realize how long some of these actually took to load.

06:34 And like any optimization, it's probably never where you really think it's going to be.

06:38 It's probably someplace else.

06:40 So having it profiled is great.

06:42 And, you know, sometimes you just have to import things, but some, some parts of your system

06:47 may have too many imports initially and they could be possibly delayed till later.

06:53 Yeah, you could definitely possibly do it conditionally, right?

06:55 If you only know in certain circumstances that code is going to run.

07:00 So you could maybe somehow delay the import until you actually need it.

07:04 So a lot of, a lot of cool things, right?

07:06 Like, let's say you've got a, like an editor application or something, you'd, all of the

07:10 stuff that you'd need to, I don't know, like convert your format.

07:14 So that for saving, you don't really need that all the time.

07:17 You could load it when you, when somebody's trying to save.

07:19 Right.

07:20 Wait, wait for him, hit the command as control us, something like that.

07:23 That's right.

07:23 Yeah.

07:23 Yeah.

07:23 So very, very cool.

07:24 And so this is a feature of Python 3.7 on this is like in the new fancy version.

07:29 Yeah, it's a new fancy version, but I, I mean, everybody's probably, if you've got a, an application

07:34 working in 3.6 right now, you probably thinking about making sure that it's going to work in

07:39 3.7 by now.

07:40 And you can probably use the 3.7 to optimize current code anyway.

07:44 Right.

07:45 Because you want data classes and why not be able to time your imports while you're at it?

07:48 Yeah.

07:48 Nice.

07:50 Yeah.

07:50 So this just came out in beta last week and we already talked about that.

07:54 So here's one more thing you can do.

07:57 If you've got some library that's taken a while to basically import, I think that article

08:02 that you mentioned that, you know, John, the conclusion, it says the, so I can reduce my

08:08 time for pip and --version from 800 milliseconds to 500 milliseconds.

08:12 That still sounds like a long time, but that's actually, you know, that's 60%, 30%, depending

08:19 on which angle you measure it.

08:20 And not quite, but, but it's a big improvement.

08:23 And it's down into the, the pieces where it makes it less noticeable from people.

08:27 Yeah.

08:28 Quite cool.

08:28 All right.

08:30 So before we move on the next one, let me tell you about roll bar.

08:33 So roll bar is the thing you integrate into your web applications, whether you're using Django,

08:38 Flask, Pyramid, super easy to integrate.

08:42 Basically to integrate it into Pyramid, you just put a few things in your config file and

08:46 that's it.

08:47 I don't even think you have to touch your code unless you want to directly interact with the

08:51 roll bar API, which you often don't have to do.

08:54 And you can even get it for JavaScript and some other frameworks as well.

08:58 And it'll basically be there when your app is running.

09:01 Anytime there's an error, it'll capture all the details of stack trace, the URL, all the

09:06 request and response values, even the user who is logged in potentially, it'll send that

09:12 off and give you notification over in Slack or email or all sorts of places.

09:17 So you want to make sure you're not missing errors in your web app.

09:20 And if you're not monitoring it, I bet you there are errors in your web app somewhere you don't

09:24 know about.

09:24 Check them out at pythonbytes.fm/roll bar.

09:28 Brian, speaking of web apps, this one we're going to talk about now is it's not the kind

09:34 of web app you might have originally thought of.

09:36 I didn't mention it there in that roll bar ad.

09:38 Anpilar?

09:39 I'm really sure about the pronunciation.

09:41 You want to take a shot at it?

09:43 Anpilar?

09:44 I don't know.

09:44 It's kind of fun to try.

09:46 It's fun to try.

09:47 And I think the an is kind of like Angular.

09:49 The py, obviously, Python.

09:52 The lar, what a great thing to put it in a word.

09:55 But what it is, is it's a web framework for building front end, rich client spa type applications.

10:03 So it's a Python framework.

10:05 You write in it.

10:07 It runs on the client side in the browser.

10:10 Isn't that interesting?

10:11 Yeah.

10:11 So it says basically create web apps with the elegance, simplicity, and full power of Python.

10:17 And you get these sort of reusable components.

10:19 It's very much like AngularJS in that regard that has like a routing engine.

10:23 So you don't actually navigate, but you move around the different views of the app.

10:27 You write all the stuff in Python.

10:29 It's pretty interesting.

10:31 So it's got a reactive programming model.

10:34 It has promises, standard Python formatting, reusable components, the scope styling, integrated

10:40 routing engine.

10:41 That's the navigation stuff I was talking about.

10:43 So it's pretty cool, actually.

10:47 I don't know what the underlying technology is for making the Python run.

10:51 If they've built their own thing, if they're using something like Brython or Sculpt or something

10:55 else.

10:55 But yeah, it's pretty amazing.

10:57 It sounds like it'd be fun to play with.

10:59 Yeah, it's definitely fun to play with.

11:00 The one caveat is if you're going to embed Python compiled JavaScript in a JavaScript file and

11:09 download it, that JavaScript file may be bigger than standard JavaScript file sizes.

11:15 So I checked in, I think the minified version is 3.6 megs, which is...

11:20 A little large.

11:22 It depends on your use case.

11:24 So imagine this.

11:25 On one hand, if you're building a really high traffic website, people use it for mobile or low

11:32 speed connections, it's totally unacceptable to put your front end in this.

11:36 However, if what you're doing is you're building Electron.js apps, you're building Ionic and

11:44 Cordova apps, these sort of offline, like here are my files, run them as if it was a web

11:49 app.

11:49 It doesn't matter if the thing is big, right?

11:51 It just starts up off the local disk anyway.

11:53 Yeah, that's true.

11:54 That's a great use case.

11:55 Right.

11:56 Like VS Code, for example, is Electron.js.

11:59 Ionic is a bunch of cool stuff.

12:01 And in that circumstance, like you just, who cares if, you know, your uncompressed shipping

12:06 size is another three megs.

12:07 It's already a hundred megs.

12:08 Like what's a hundred versus a hundred three?

12:10 Nobody cares.

12:10 Right.

12:11 Something like that.

12:11 So for those situations where it's kind of this offline rich client web experience, it's

12:18 cool.

12:18 I like it.

12:19 Oh, that's cool.

12:19 That's a good idea.

12:20 Yeah.

12:20 So there's some nice ways to play around with it.

12:22 They got some little demo apps.

12:23 So like down the bottom, there's like a little grid of buttons, like eight or 10 or something.

12:28 You can click around there and play with it a bit.

12:30 So yeah, it's pretty cool.

12:32 If you want to give this a try and your use case makes a lot of sense, right?

12:36 Like it's somehow getting that JavaScript there is not a big problem.

12:40 Definitely check it out.

12:42 It's cool.

12:42 The other thing to point out is WebAssembly is coming.

12:45 WebAssembly is going to be pretty sweet.

12:47 If somebody can get a really nice version of Python in WebAssembly, that may make a big

12:54 difference on a lot of fronts.

12:55 Do you know WebAssembly?

12:56 I do not.

12:57 So WebAssembly basically is a new standard for the browsers.

13:02 I think it's already partially supported where instead of shipping JavaScript, you ship binary

13:07 executable equivalents, right?

13:10 So you've got the problem of running.

13:14 You download a text version of a big thing and then you parse it.

13:18 You do all the sort of runtime stuff to get it executable.

13:21 And then you execute it, right?

13:23 You get into like bytecode or whatever JavaScript does.

13:25 So I think WebAssembly is more or less like we're going to get it to that last pre-processed

13:31 step of what JavaScript would do.

13:33 And we'll give it to you as a binary thing, sort of like shipping PYC files in Python.

13:37 I think it actually has more effect.

13:39 So it should be a lot smaller because it's small and tokenized and stuff, but it should

13:42 also start up quicker.

13:43 So who knows?

13:44 Maybe WebAssembly makes this better for somebody sneaking JavaScript or Python through the JavaScript

13:50 straw.

13:51 random binaries off of any website on the internet.

13:54 What could go wrong?

13:55 I think it's only the equivalent of running JavaScript.

13:57 It's not like fully executing data.

14:00 So I think it's no worse than JavaScript, but yeah.

14:04 Okay.

14:05 I don't know more than that.

14:06 We'll have to keep track.

14:07 I think we should round out this entire, the rest of this episode on just Python 3 stuff.

14:11 What do you think?

14:12 I don't think on this podcast we've pushed the migration to Python 3 enough.

14:16 No, we have talked about how bad legacy Python is.

14:19 Go ahead.

14:21 Yeah.

14:21 You go first on this Python thing.

14:22 And this is actually just a little GitHub repo that is called Migrating to Python 3 with

14:29 Pleasure, a short guide on features of Python 3 for data scientists.

14:33 And it's a pretty quick read, but it's pretty thorough and actually gets pretty exciting.

14:39 It starts off with a quick tutorial with examples of how to use Pathlib so that you can easily,

14:48 if people haven't played with it yet, you can, you know, define paths as just like these little, just strings with division marks like you would

14:55 in a browser.

14:56 It's kind of crazy, right?

14:58 Pathlib.

14:58 It's like you put the slashes outside the strings and it, the division operator becomes like

15:04 OS.path.join type of things.

15:06 Yeah, definitely.

15:07 Yeah.

15:07 Yeah.

15:07 Yeah.

15:07 Definitely.

15:07 And it's, but it works great and it makes your code really readable.

15:10 So there's that.

15:11 And then it goes on to talk about type hinting and how cool it works with thing editors like

15:16 PyCharm and stuff to help you see what you're doing.

15:19 Then one of the things that I did not, hadn't heard of before I came about a few things in

15:24 here is the, how to enforce, types at runtime.

15:29 I didn't know you could do that, but there's a, there's a package called enforce that you

15:33 can, put a decorator on a particular function and it'll throw an error.

15:38 If somebody tries to put it past in the wrong type.

15:41 I had never heard about that either.

15:42 That is really awesome.

15:43 I don't know if I necessarily want it all the time, but it could be fun to turn on, especially

15:49 if you're like doing a refactoring or you're like doing some major upgrades.

15:53 You're like, all right, let's turn this on and just see if it's doing what we think it's

15:57 doing.

15:57 Right.

15:58 Yeah.

15:58 Especially during like a testing phase or something.

16:00 It'd be fun.

16:01 Yeah.

16:01 And then this kind of hurt my head.

16:03 There was a, some function annotations for units.

16:07 There's a example is how AstroPy does it.

16:10 And it's, things like you can attach to variables like units, like, like kilograms

16:16 or something like that, which that just seems cool.

16:20 I got to play with that a little bit more.

16:22 Oh, it looks like, which one is it?

16:25 There's a library.

16:25 I think it's called pint.

16:26 Oh, right.

16:27 Yeah.

16:27 Like, right.

16:28 That lets you like multiply, say like, you know, this thing time a foot, that thing times an

16:34 inch and then add them together.

16:35 Yeah.

16:36 Yeah.

16:36 That's it.

16:37 And this looks like a little bit of the same type of story, but you might multiply by like

16:43 a kilogram or a degree and sort of the physicist, astrophysicist equivalent of that.

16:47 That's cool.

16:48 Like in their example, they show, dividing a meter in speeds in, I don't know what it is,

16:54 but, coming up with like, terahertz.

16:57 We didn't start with terahertz.

16:58 You started with something else.

16:59 Okay.

17:00 Now I'm, I'm just making up words now, I think.

17:02 So pretty cool.

17:04 Pretty cool.

17:05 You also have a matrix multiplication in there.

17:07 Yeah.

17:07 Yeah.

17:07 Matrix, which I don't use a lot, but it's very cool for people that need matrix multiplication.

17:11 Matrix multiplication is interesting.

17:13 It's one of these things.

17:14 It was, it's held up as one of the best examples of the whole PEP process and bringing a new feature

17:21 into the language.

17:22 So the, from the time the PEP was proposed until it was, done, it was like eight days.

17:28 Wow.

17:28 And it has to do with like how well the people who proposed the idea had like already done

17:33 like sort of market research amongst all the scientific computation people.

17:37 And, they had a really clear vision and a strong sort of displayed need.

17:42 And so it's really interesting that that's in here as well.

17:44 And globbing with star star, which is, something I hadn't used since, Oh, one of the Z shell does that.

17:52 So like you can, do recursive subdirectories with, two asterisks and, that's kind

17:59 of neat.

17:59 And then went through a whole bunch of other stuff like f-strings and floating division

18:03 now is real, real division now.

18:05 And the rest of it is things that if you've been living Python three for a while, you just

18:11 kind of take this stuff for granted.

18:12 But, it's a very, a fairly complete list of, it'd be good if you're in a science community

18:18 and you're trying to convince somebody to switch to Python three, this article would be a

18:22 good one.

18:22 Yeah, definitely a good one.

18:23 It sounds really interesting.

18:25 Like it really brings up, these are the benefits that you get from making this move rather than

18:30 just the stick of it's going to be expired or, you know, go out of maintenance in 2020.

18:36 It's like, you know, here's all the good stuff that you're missing that you don't even know

18:39 you're missing.

18:39 Yeah.

18:40 And it includes, I didn't even list it, but it includes like a dictionary ordering and

18:45 stuff, which, I love that.

18:47 Right.

18:48 Yeah.

18:48 That is really, really nice.

18:49 I think enforce might be the big news out of that.

18:52 That's I hadn't even heard of that.

18:53 That's pretty cool.

18:54 Yeah.

18:54 I'm definitely going to go play with that tomorrow.

18:56 So that's neat.

18:57 Cool.

18:57 So let's talk about moving to Python three.

18:59 Okay.

19:00 So I want to give you the new topic.

19:02 Exactly.

19:03 I want to give you something like this, but from a web development perspective, it's pretty

19:08 interesting.

19:08 There's this place called ticket EA.com ticket.

19:12 Yeah.

19:12 I don't know.

19:13 Ticket EA.com.

19:14 That's what I'm going to go with.

19:15 And they said how we migrated ticket EA.com to Python three in two weeks.

19:20 Wow.

19:20 So it's apparently a pretty big project that they have running.

19:24 It runs their whole sort of fulfillment e-commerce type thing and so on.

19:27 And you'll hear the word Aphrodite.

19:29 That's kind of their, their code name word for their project.

19:33 So they do a bunch of stuff with Docker and their first step was to just say, okay, we're

19:38 going to change the Aphrodite's base Docker image to Python colon 3.6 slim from, I don't

19:45 know, what's it?

19:46 Two seven fat.

19:47 I don't know.

19:47 Something like this.

19:48 And they said when they did that, you know, they just tried to run their tests and a bunch

19:52 of stuff went crazy.

19:53 Like outdated libraries didn't work.

19:55 Base string had to be moved to string.

19:57 URL parse had to move to URL.

19:59 Lib dot URL pars, other stuff like that.

20:02 Right.

20:03 So said, all right.

20:04 Well, the first thing we're going to do is going to run two to three.

20:06 Right.

20:07 So this is the utility that can manually fix some of those things.

20:10 So like every time you see base string, that's STR.

20:12 Now we're just going to do that for example.

20:14 Right.

20:15 So they ran that against it.

20:16 And they also look for patterns like, hey, we're using map reduce or map type functions

20:22 and so on, or filtering functions plus lambdas to make it work.

20:25 And these could really just be list comprehensions.

20:27 Right.

20:27 So they kind of upgraded the, they took better advantage of like the new language features

20:32 that were then available to them.

20:34 So that's pretty cool.

20:35 And then they said, okay, well, that's the low hanging fruit.

20:38 Now what?

20:39 And they had to run their tests, you know, sort of find some more problems.

20:44 They took the opportunity to upgrade, at least get ready to upgrade to Django too, because

20:49 they are running on Django.

20:50 So that's cool.

20:51 They said a couple of lessons we learned code coverage was 75% or 70%, you know, the more

20:58 tests, the better.

20:59 It's good to keep the Python three branch up to date with the master branch until you switch.

21:04 That's one way of doing it.

21:05 Like remember the Instagram keynote at PyCon 2017.

21:08 Yeah.

21:09 That is a whole nother level of upgrading to Python three, right?

21:12 They upgraded all of Instagram to Python three without branching, which is,

21:20 yeah, at all.

21:21 That's, that's crazy.

21:22 And they were checking in all the time.

21:24 So that's another level you can check out that as well.

21:26 But this is, I suspect this is more common that you kind of branch.

21:29 You're like, are we going to try to keep these going?

21:31 It's a good story to see somebody doing it the other way.

21:34 Yeah, for sure.

21:34 And so they, they ran flake eight against all the stuff to make sure they're, everything

21:38 was working right.

21:39 So I don't know.

21:40 They said they about, they had to modify around 200 files to make flake eight happy again with

21:45 Python three, but yeah, all good.

21:47 And then the final thing I thought was really cool is they're running on Google app engine.

21:50 I don't do, I don't do anything with Google app engine, but one of the features that these

21:54 platforms as a service have, that's really pretty cool.

21:57 It's something called traffic splitting.

21:58 So there's basically like a little slider and you say, this version of the app is going to

22:04 get 60% of the traffic.

22:05 This version of the app is going to get 40% of the traffic.

22:08 And you can add in different versions.

22:09 So you can say, well, let's just send like 1% of our traffic over towards these new versions

22:15 and see what happens.

22:16 So you don't completely take the site down.

22:19 You just may break it for a very small group.

22:22 And you could even do that.

22:24 I think by like IP address and stuff.

22:26 So you say only the people that work here get the new version.

22:29 People on the outside, they get the old version and slowly migrated along.

22:33 And so they call these canary releases, which I think is actually a pretty cool way to think

22:37 of it.

22:37 So there's, there's some neat lessons in here.

22:39 This is, but I didn't know Google app engine did that.

22:43 That's neat.

22:43 Yeah, I didn't either, but I definitely like it a little bit better now.

22:47 That's cool.

22:47 I mean, I don't dislike it, but that's definitely a feature that would draw me into it.

22:51 All right.

22:51 So I think, I think these are really interesting.

22:53 Yours was on data science.

22:54 Mine is a sort of web story and they both are compelling sort of for moving to Python 3.

23:00 Things that you get and the steps to get there.

23:02 Definitely.

23:02 And we'll keep pounding on it until Python 2.7 is gone.

23:05 That's right.

23:06 We will see legacy Python fade away.

23:09 So you have a webcast coming up, don't you?

23:11 Yeah, we brought it up last week, but I just wanted to remind people that I'm doing a webcast on pytest and PyCharm with

23:19 the PyCharm guys that's coming up on February 22nd.

23:23 So we'll leave a link in the show notes and go register.

23:26 Hope to see everybody there.

23:28 Yeah, they should definitely go register for it.

23:29 There's a couple reasons.

23:30 One, Brian's going to be there.

23:32 It'll be awesome.

23:32 Two, it's free.

23:34 So you'll get what you pay for, for sure.

23:36 I promise you that.

23:37 Unless you count your time, then I don't know.

23:40 And then you also potentially, if you can't make it, you'll get the recording notification.

23:44 If you register and you don't show up, then you'll get a message say, you didn't show up, but hey, you still get it.

23:49 People should check out.

23:50 There's a whole bunch of old webinars there.

23:52 And it's not just about trying to push PyCharm stuff.

23:56 It's just people in the community showing some interesting things to do.

24:00 So it's a good thing that they're doing.

24:03 I had this project that I wanted to play with.

24:05 Not so much to build in the app, but to play with the foundational bits of the app.

24:10 So I have a program that sort of demonstrates using cookie cutter from an API mode.

24:17 So cookie cutter, normally you type cookie cutter space, some template name, and then stuff happens.

24:23 And then you have a project, like a starter project, a scaffold type thing for all sorts of various things.

24:29 So there's also an API for cookie cutter.

24:32 And so you can put like fancy front ends, or if you've got any kind of application that needs to generate like a sub project,

24:39 that's going to be messed with by somebody else.

24:41 If you're doing like developer tools or you're building something for your company,

24:44 you're like, we're always going to start this way.

24:46 So here's the CLI and it asks you the questions.

24:48 And then boom, you've got this kind of standard starter app that's integrated into your infrastructure.

24:53 So these are all good uses.

24:56 So I said, all right, well, I want to play with this project called GUI.

24:58 And we talked about GUI a while ago, G-O-O-E-Y.

25:01 And so I took my little cookie cutter app that would work with all the pyramid-based cookie cutter templates

25:08 and put a friendly front end on the front of that.

25:12 And then I put a GUI on top of that CLI app.

25:15 Nice.

25:16 Yeah.

25:16 So it's really fun.

25:17 And it really took like 20 minutes to get it 99% working more on that a sec.

25:23 So I put a link to the GitHub repository that has that up there.

25:27 So people can download it.

25:28 You just clone it, create a virtual environment, pip install dash R, the requirements file,

25:34 and then you can just run the program.

25:35 And you have a really sweet GUI.

25:37 And it's based on WX Python Phoenix and GUI.

25:40 It's quite cool.

25:41 The one little hangup is I'm having a problem getting it to run if I package it.

25:48 So I could literally hand out a .app or .exe.

25:51 There's some kind of hangup, and I think it's a bug with GUI.

25:54 I can't tell entirely, but maybe by the time you hear this, I have it figured out.

25:57 But we'll see.

25:58 All right.

25:59 Either way, it's a great example.

26:00 You know, if you can forget the packaging, it's actually an awesome example of a really simple Python GUI app that looks professional.

26:06 If you can forget packaging, Python is awesome.

26:08 That's a good thing.

26:10 The packaging works fine.

26:11 GUI works fine.

26:12 A packaged GUI app sometimes works fine.

26:15 Yeah, okay.

26:15 It's the intersection of all these things that are cool.

26:19 There's a small bruise on the shininess of it.

26:24 But it's all good.

26:25 It's all good.

26:25 So check that out.

26:26 There's tons of people working on all these features to make it even more seamless in the future.

26:31 Yeah, absolutely.

26:32 Absolutely.

26:32 Well, good job.

26:33 Cool.

26:33 Thanks so much.

26:34 Brian, thanks for sharing everything with all of our listeners and with me.

26:38 Thank you.

26:38 And we'll talk to you next week.

26:40 You bet.

26:40 Bye.

26:42 Thank you for listening to Python Bytes.

26:43 Follow the show on Twitter via at Python Bytes.

26:46 That's Python Bytes as in B-Y-T-E-S.

26:49 And get the full show notes at pythonbytes.fm.

26:52 If you have a news item you want featured, just visit pythonbytes.fm and send it our way.

26:57 We're always on the lookout for sharing something cool.

26:59 On behalf of myself and Brian Okken, this is Michael Kennedy.

27:03 Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page