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


Transcript #24: I have a local PyPI server and so do you!

Return to episode page view on github
Recorded on Tuesday, May 2, 2017.

00:00 Hello and welcome to Python Bytes. It's episode 24 and we are going to deliver Python news and headlines directly to your earbuds.

00:09 This episode is recorded on May 2nd, 2017 and is brought to you by Rollbar.

00:15 I'm Michael Kennedy.

00:16 And I'm Brian Okken.

00:17 And we're here to bring you a bunch of Python news, but this time it's a little different.

00:22 Normally we're broadcasting from two secret locations in Portland, Oregon, but this time, Brian, you're dialing from slightly farther away.

00:30 Yeah, I'm just south, what, southeast of Munich today.

00:33 Right on. Well, welcome to Europe. Let's start with learning Python out of Munich.

00:38 Yeah, so this is one of the, I think a listener of the show contacted us, said he wrote a learning Python series,

00:47 but he wrote it for a group called Robotics and Beyond.

00:52 And it's a STEM educational space, which really looks cool.

00:57 But he's, I think it looks like a nice tutorial and he's publishing it on Dan Bader's site, dbader.org.

01:04 And the first in the series is, let's program with Python statements, variables, and loops.

01:11 And I think he's coming at it from a space of, if you, yeah, just really getting started, haven't done much.

01:18 And I like, he's even talking about, goes through, even what is programming.

01:24 He's assuming people haven't done programming before.

01:27 So talking about how it's telling people how to, how you're telling the computer how to do steps.

01:33 And, and, and, you know, it's, it's hard for me to put my head back in the space of new to programming.

01:39 But I think this is, it looks like a, something that might be good for, I don't know what age group, but it'd be good.

01:48 Yeah. Well, we're going to talk about a lot of different age groups, but way to go, Doug.

01:52 That's awesome.

01:52 It's really hard to, you know, get rid of the curse of knowledge, right?

01:56 Once you've learned a thing, it's really hard to see it with fresh eyes and understand the challenges and stuff.

02:00 So that's really cool.

02:02 And don't you wish something like robotics and beyond existed when you were a kid?

02:07 Yeah, I do.

02:08 And one of the things that I like also about having lots of different people tackle the new to programming space is that everybody learns differently.

02:17 So you might look at one series and go, man, I just don't get it.

02:20 And then look at somebody else's and it just clicks like this.

02:23 This one uses turtle graphics and stuff.

02:25 I haven't seen people use turtle graphics very much recently, but so that's kind of fun.

02:30 Oh yeah.

02:31 Very cool.

02:31 Nice.

02:33 All right.

02:33 That's a great one.

02:34 So check that out.

02:34 If people ask you for how to get started programming, right?

02:37 Maybe kids.

02:38 There's a lot of good options.

02:39 Here's one more.

02:40 So speaking of learning to program, I picked one that is an actual academic paper, but I felt it was pretty interesting.

02:49 This is done by Philip Guau.

02:50 I've had him on Talk Python a few times.

02:52 In this one, he's talking about helping older adults learn to become programmers or become more proficient in programming.

03:02 Like what you were just talking about.

03:03 There's a lot of, hey, you're a young kid.

03:07 You want to get started with robots and programming and here's how you do it and we'll get you going to launch your career and stuff.

03:14 But Philip said like so many of these resources are focused on the young teenage to early 20s group starting their career.

03:26 But, you know, how much do we really know about people who are 60 to 85 years old who are just learning to program?

03:35 So he actually wrote a proper academic paper and did a bunch of research on those guys.

03:42 Wow.

03:42 I think that's cool.

03:43 It is really cool.

03:44 The age group, I guess I wouldn't expect people from in the like, I guess you've listed 60 to 85.

03:52 Was that the age group of the respondents?

03:53 That was the age group of the respondents.

03:55 Yeah.

03:55 If you were outside of that age range, mostly younger, then you were sort of not included.

04:01 Right.

04:02 Like it was really focused on people who were basically either about to retire or who were retired.

04:08 And it looked at a couple of different aspects.

04:10 Like why are they interested in learning a program?

04:13 What challenges do they have that they share with everyone who's learning a program?

04:17 Like what's a variable?

04:18 Ah, what's a pointer, right?

04:19 Like everybody suffers that.

04:20 But there's also specific challenges for that age group.

04:24 And then also, you know, just what are they using to learn?

04:29 And some of the lessons on how maybe we can make the whole environment better for those guys as well.

04:34 I think that's great.

04:35 Yeah, I do too.

04:35 So I think it's interesting to look at what some of the reasons why people in this age group were learning to program.

04:42 Some of them just said like, look, I'm now retiring and I've always wanted to learn to program.

04:47 And maybe I did something technical.

04:48 Like maybe I was a scientist, but I never really got around to really learning to programming.

04:52 So that might be one reason.

04:55 Another was connecting with grandchildren.

04:56 So a lot of these folks have children who are maybe taking this robotics and beyond type course.

05:03 And they're like, hey, I would love to do that with my grandchild.

05:05 But let me, I got to learn Python myself, right?

05:07 Another big opportunity here is there's a pretty big gap between people can do programming and people are teaching kids.

05:14 And so people in this age group also have a lot of time if they're retired to maybe donate, you know, an hour or two a week at some place mentoring or something like that.

05:25 So maybe they could fill in this, like sort of help teachers at high schools and middle schools with actually teaching programming and not just like the coding class teaches HTML, right?

05:34 Something like that.

05:35 As well as like just keeping mentally active and pursuing hobbies, right?

05:40 Like their hobby is airplanes and they are going to create something that works with airplanes somehow.

05:45 Yeah, I think, and then I could see probably the maker space getting into that and people trying to program Raspberry Pis and stuff like that.

05:52 Yeah, absolutely.

05:53 Absolutely.

05:53 There's a lot of cool stuff, a lot of cool times with like the micro Python type of stuff as well.

05:59 So if you're interested in this, check this out.

06:02 I'm also planning on doing a full proper Talk Python episode with Philip in a few weeks.

06:07 So we'll catch up on that and go deeper on that show.

06:09 Okay, great.

06:10 Hey, so next up, I've got something that I've been, we talked about, I can't even remember what episode.

06:16 I was looking for a good way to have a local PyPI server just like so you can sort of not have to go out onto PyPI all the time.

06:28 And especially on the plane trip when I was flying over here, I knew I wouldn't have an internet connection.

06:33 So I wanted to make sure I had a cache of all of the packages I needed for while I was programming on the plane.

06:40 And I don't know when this crept in, but there's, pip has download now and I don't think it used to always have that.

06:49 But you can just, and I've got the, I put just the few lines of code you need in our show notes.

06:56 But it's just, you go to a directory you want and you type pip download and some package and it downloads that package and all of its dependencies and doesn't install it.

07:06 It just stores the wheels in that directory.

07:09 Yeah, that's super cool.

07:10 So you can, you can basically create an offline version of PyPI.

07:15 And it just, it's really quick.

07:17 You can even list multiple packages on the line.

07:20 I just, I knew like the 10 or 12 that I needed and didn't know what their dependencies were and just filled up a directory in like 10 minutes or less.

07:28 And then I was ready to go.

07:30 And then you just have to use the, when you're doing the install, you do the --no index and --find links and point it to your directory.

07:40 And then the rest is the same.

07:42 You just give it a package.

07:43 And this includes like version numbers.

07:45 So you can, you can have multiple versions in there as well.

07:48 So anyway, just wanted to share that with everybody.

07:51 Nice.

07:52 Do you know if I can, can I give it like a requirements TXT and say, download that, you know, download the results that I suspect you can, right?

08:00 Probably pip download dash r requirements, you know, dot TXT, I bet.

08:04 Probably.

08:05 I don't usually work with requirements files, so.

08:07 Nice.

08:08 Okay.

08:08 This is a cool thing.

08:09 So if you maybe were going to be stuck on an airplane and trains and other places for like 18 hours straight, you might want to take some packages with you, right?

08:18 Yes.

08:20 That's awesome.

08:20 Okay.

08:21 So that's a really, really cool tip there.

08:23 I know there's the, like the dev pie and the actual local proper pipe AI servers that you can set up and just point at the URL, but I didn't know about this, this local download option.

08:33 So this is great.

08:33 And that the, all those other little pipe AI servers, I know that the setup says that they're really easy, but I haven't been able to get it to work for me.

08:41 So I don't know what I'm doing wrong, but anyway, so this is easy.

08:45 Yeah.

08:46 This definitely like everybody has a directory, so they can do it.

08:49 You don't have to have the right infrastructure around it.

08:52 That's cool.

08:52 All right.

08:53 Before we get onto the next item, which is about adding features to the Python language itself, I want to just say thanks to Rollbar.

09:00 You guys have heard me talk about Rollbar a lot.

09:02 You know that I use Rollbar on my websites and really, really like Rollbar.

09:06 Basically, all you have to do is pip install Rollbar, maybe include a line or two in the config or setup for your Python web app, and it's tracking all these errors and sending you reports and notifications with lots of details anytime it happens.

09:21 So these guys are going to have a booth at PyCon.

09:23 They're going to be just like us, Brian.

09:25 We're all going to have booths at PyCon.

09:26 Yeah.

09:27 I'm going to have to go get a Rollbar sticker for them.

09:30 Yeah.

09:30 Definitely get a Rollbar sticker, maybe a Rollbar shirt.

09:33 I don't know what kind of swag they're bringing to the show, but they want to make sure that you know there's a booth for Rollbar at PyCon.

09:41 And so drop by and they'll give you a demo and give you some kind of swag to go with it.

09:45 Awesome.

09:45 Awesome.

09:46 Yeah.

09:46 So just check them out.

09:47 Rollbar.com slash Python bytes.

09:49 Get the bootstrap plan for free, which is 100,000 events and 180 days of retention.

09:54 And hopefully you don't use up that many errors.

09:57 But if you do, they got you covered.

09:58 All right.

09:59 So you know what would be cool is if we could have increment and decrement operators in Python.

10:05 We can do plus equals one, but think of all the characters we're wasting there.

10:10 What if we could just do plus plus?

10:11 Yeah.

10:12 Do you know why Python doesn't have increment and decrement operators?

10:15 I have a theory, but I don't actually know.

10:17 I don't know why.

10:18 Do you?

10:18 Certainly the language was created after.

10:21 No, I mean, it was created after C and C++, right?

10:24 So it's not like it wasn't known as a possibility.

10:27 I suspect it was to keep it more explicit, right?

10:30 You know, one of the challenges of plus plus and minus minus and those types of things is

10:36 a lot of languages that support them support like two variations, like plus plus variable

10:41 and variable plus plus.

10:42 And it's always like, okay, well, what that increments it and then returns the incremented

10:47 value versus returns original value and then increment is just like, it's kind of confusing.

10:51 Like why is like increment confusing?

10:53 And so I suspect Coeta is just like, all right, just simple.

10:57 It's also like, like in C++, it matters which side of the assignment operator it's on to.

11:02 If it's an L value and R value.

11:05 So yes, all those things.

11:07 And so it doesn't have one, but friend of the show, Anthony Shaw said, let's see what it would

11:14 be like if we tried to add one.

11:16 And I think this is cool because it actually, his article on Medium takes you through step

11:21 by step what it is you need to do to add a new feature to the Python language.

11:25 So basically he writes an article that adds plus plus and minus minus to CPython.

11:29 I like the, where he's going with it and also teaching people how to do this.

11:34 It's kind of neat.

11:35 Yeah.

11:35 It certainly takes some of the mystery of like, well, how would you even start out of

11:39 this?

11:39 So he says, look, there's basically five or six levels.

11:42 So you're going to start by doing a PEP to get agreement on what the language feature is

11:47 going to be.

11:47 Then there's a grammar file that describes what the statements in Python are.

11:53 You don't want to just cram it into CPython, the execution engine, because things like

11:59 PyPy and other implementations, you want those to stay consistent.

12:03 So there's this grammar file they all share.

12:05 It talks about how to add them.

12:07 And it turns out it's like super easy to add these, these new things.

12:11 Then there's the Lexer that parses it.

12:13 Lexer that goes through and sorry, turns it to tokens.

12:16 Then the parser takes the tokens to abstract syntax trees.

12:19 And then there's a compiler actually compiles it to instructions.

12:22 So he goes through all the steps and shows you how it works.

12:25 And even has his attempt to add this feature to Python itself out on GitHub, if you want

12:31 to check it out.

12:32 So he's got a working version with plus plus.

12:35 That's pretty cool.

12:36 Maybe we could get him to add begin and end to blocks.

12:41 Hopefully he's no.

12:44 And curly braces.

12:45 We all love the curly braces.

12:47 No, just kidding.

12:47 Okay, so that's awesome.

12:49 Another thing that you brought up that I like is colorful, right?

12:54 So I think so many of the apps that we create in Python are sort of terminal level or CLI type

13:00 apps.

13:01 So people really could do more to make them pretty, right?

13:03 Yeah.

13:04 So I've been working a lot with pytest lately.

13:07 And one of the great benefits of it is the color in the terminal window.

13:11 And working with terminal colors isn't, this is often not very fun.

13:16 But this colorful project is actually got a syntax that's pretty darn readable.

13:22 And once you've figured out what colors and what syntax, what different parts of your interface,

13:29 your command line interface, you want different colors.

13:31 I don't think you're going to really have to care, like really muck with it too much using colorful.

13:36 And it even has things like piping colors to strings and like different plus and and operators

13:44 that make sense with colors.

13:46 And I like what they're going doing with this.

13:48 Yeah, that's cool.

13:49 I do as well.

13:50 And the couple of things that really stood out is nice to me.

13:53 One is the syntax is pretty straightforward on how you use it.

13:58 The fact that you can use hexadecimal.

14:01 So you can just, you know, hash F-A-F-A-F-A for gray or whatever, right?

14:06 You can take sort of web colors and plug them in, which is really cool.

14:11 And they even have themes, like you can set up general themes.

14:14 You can use context managers.

14:16 So in a width block, you can set a color, things like that.

14:18 Yeah.

14:18 Okay.

14:19 That's neat.

14:20 Yeah.

14:20 Yeah.

14:20 Pretty sweet.

14:21 I might start using it.

14:22 I've looked at Colorama and some of the other ones and they're fine, but it's like, I don't

14:28 know, it's just painful to say like, okay, well, I'm going to take this like enumerated text

14:32 value and concatenate it with my string to make it a color.

14:35 And I think colorful is a little nicer.

14:37 Yeah.

14:38 I wonder if it's built.

14:38 I haven't actually tried it.

14:39 I wonder if it's built on top of Colorama.

14:41 Yeah.

14:42 We'll have to look inside.

14:43 Anyway.

14:44 Speaking of packages, everybody who works on making a Python package, they want to add

14:48 a nice bit of bling, make it fancy looking, right?

14:51 Yeah.

14:51 All the extra little blips and stuff.

14:53 Yeah.

14:54 So there's a lot of things that make a package look professional or not professional, but there's

15:02 this article called five steps to add the bling factor to your Python package.

15:06 And I thought it was pretty cool.

15:08 I mean, it's certainly not exhaustive.

15:10 And it's not, I don't think it's overly prescriptive, but it does talk about a few things that you

15:14 can do that are pretty sweet.

15:16 So I'll just run through the five steps real quick.

15:17 So step one, you can host your documentation on read the docs.

15:21 That's nice, right?

15:22 Proper documentation somewhere with search and all that kind of stuff.

15:26 Set up continuous integration with Travis CI or maybe AppVeer or whatever, right?

15:32 But if you're going to set it up, some kind of continuous integration.

15:35 And if you're going to run unit tests, you probably want to know what your code coverage

15:41 is.

15:41 So you can show your code coverage with code cov.

15:44 Obviously, if you're going to have a package, if it doesn't live on PyPI, it's almost not real,

15:50 right?

15:50 Unless there's some weird requirement about like it really has to be set up in some bizarre

15:56 way that it can't be installed there from there.

16:00 It really should be on PyPI, which is great.

16:02 So add it up there and it talks about how to do it.

16:04 It's surprisingly easy to get your package onto PyPI.

16:06 And finally, if you have all these things, you want to have badges, right?

16:10 This thing supports these versions of Python.

16:12 Its tests are currently passing or not passing.

16:15 It has this level of code coverage, all those things, right?

16:18 Yeah.

16:18 And one of the things that this highlights for that, I guess I always knew, but I don't think

16:23 about it very much is all these different services for open source projects.

16:28 They're free.

16:29 Yeah.

16:29 Every one of those.

16:30 Yeah.

16:30 Yeah.

16:30 But I mean, it's not free for them to run it, but that's cool that all that stuff's just

16:34 there for open source projects.

16:36 Yeah.

16:37 It's really great.

16:37 Like, read the docs is free.

16:40 They do have ads on there.

16:42 I'm not sure how targeted the ads are.

16:44 They're pretty relevant to Python developers, but I do think it's a challenge.

16:48 I know the read the docs guys are doing interesting and creative things to fund it, but it's,

16:52 you know, it's non-trivial to run it for free for the world.

16:56 Yeah.

16:56 How about Travis CI?

16:58 Well, they, I had talked with Josh Calderamis from Travis.

17:03 And since they started out as a, like, open source stuff to start with, and they were

17:10 doing it in their hobby time, and the commercial side is now how they're doing it full time,

17:16 and they have jobs.

17:17 And the reason why they maintain the free for open source is because they got their careers

17:23 from open source and they want to give back.

17:24 Oh, that's really cool.

17:26 So if I had, like, a private GitHub repo, I'd have to pay to get CI on it, but if I have a

17:31 public one, it's free?

17:32 Something like that?

17:33 Yeah.

17:33 They have an enterprise Travis CI so that you, that you can use for closed repos or private,

17:38 not private repos.

17:39 Yeah.

17:40 Private ones.

17:40 Mm-hmm.

17:40 So what I thought was cool about this is none of those things are hard.

17:43 None of those things are major, but they're all make it, it shows that you care about what

17:47 you're building.

17:48 So you're more likely to get contributors.

17:49 People are more likely to adopt your package, things like that.

17:52 Also nice to have all these together because I can imagine if I wanted to do any of these,

17:56 I'd probably spend an hour or so trying to figure out each little bit.

17:59 Yeah.

18:00 There's little tips at each one, which is cool.

18:01 Yeah.

18:02 All right.

18:02 Well, that's our news for the week, Brian.

18:04 Anything besides the fact that you're just tooling around Germany?

18:07 Well, I think they had, they were, I'm doing management training, so maybe I'll finally learn

18:12 how to become a manager after doing it for many years.

18:14 But the, but I was working on the, working furiously on the book on the, on the plane trip over.

18:21 And we're still on, still barely on target for a beta for PyCon.

18:28 So.

18:28 I just looked, PyCon is two weeks away.

18:30 I can't believe it.

18:32 There's not very much time.

18:33 I know.

18:34 Anyway, I still have to order stickers.

18:35 It's going to be so fun though.

18:37 Yeah.

18:37 Yeah.

18:38 You still got time, but not a lot of time.

18:40 Not a lot of time.

18:41 It's going to be tons of fun.

18:43 So I'm looking forward to, to meeting a bunch of the listeners there and hanging out with you

18:48 and everyone else.

18:49 And how about you?

18:50 Anything up with you?

18:51 Not, not too much.

18:52 Just thinking about PyCon makes me think I got to get a bunch of stuff ready for, for

18:56 the conference or a booth and things like that.

18:58 So yeah, it should be a lot of fun.

19:00 Yeah.

19:01 I can't wait.

19:02 Thank you for listening to Python Bytes.

19:05 Follow the show on Twitter via at Python Bytes.

19:07 That's Python Bytes as in B-Y-T-E-S.

19:10 And get the full show notes at Pythonbytes.fm.

19:14 If you have a news item you want featured, just visit Pythonbytes.fm and send it our way.

19:18 We're always on the lookout for sharing something cool.

19:21 On behalf of myself and Brian Okken, this is Michael Kennedy.

19:24 Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page