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. This episode is recorded on May 2nd, 2017 and is brought to you by Rollbar. I'm Michael Kennedy and I'm Brian Okken and we're here to bring you a bunch of Python news but this time it's a little different. Normally we're broadcasting from two secret locations in Portland, Oregon but this time Brian you're dialing from slightly farther - Yeah, I'm just south, what, southeast of Munich today.

00:33 - Right on, well, welcome to Europe.

00:35 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, but he wrote it for a group called Robotics and Beyond, and it's a STEM educational space, which really looks cool.

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

01:05 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, you're just really getting started, haven't done much.

01:19 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 you're telling the computer how to do steps.

01:33 And you know, it's hard for me to put my head back in the space of new to programming, but I think this is, it looks like something that might be good for, I don't know what age group, but it'd be good.

01:48 - Yeah, well, we're gonna talk about a lot of different age groups, but way to go, Doug, that's awesome.

01:53 it's really hard to 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." And then look at somebody else's and it just clicks.

02:22 Like this one uses turtle graphics and stuff.

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

02:30 - Oh yeah, very cool.

02:32 Nice.

02:33 All right, that's a great one.

02:34 So check that out.

02:34 If people ask you for how to get started programming, right, maybe kids, 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 Phil Guo.

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, there's a lot of, "Hey, you're a young kid.

03:08 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." said, like so many of these resources are focused on the young, you know, teenage to early twenties group starting their career.

03:26 But you know, how much do we really know about people who are 65 to 80, 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:41 Wow.

03:42 I think that's cool.

03:43 It is really cool.

03:44 I was I guess I wouldn't expect people in from in the like I guess you've listed 60 to 85 was that the age group of the respondents? That was the age group of the respondents yeah if you were outside of that age range mostly younger then you were sort of not included right like it was really focused on people who are basically either about to retire or who were retired and it looked at a couple of different aspects like why are they interested in learning a program what What challenges do they have that they share with everyone who's learning a program?

04:18 What's a variable?

04:19 Ah, what's a pointer?

04:20 Right?

04:21 Everybody suffers that, but there's also specific challenges for that age group.

04:25 And then also, just what are they using to learn and some of the lessons on how maybe we can make the whole environment better for those guys as well.

04:34 >>TYLER: I think that's great.

04:35 >>DANIEL: Yeah, I do too.

04:36 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:43 Some of them just said, "Look, I'm now retiring and I've always wanted to learn to program.

04:47 Maybe I did something technical, maybe I was a scientist, but I never really got around to really learning to programming." That might be one reason.

04:55 Another was connecting with grandchildren.

04:57 A lot of these folks have children who are maybe taking this robotics and beyond type course and they're like, "Hey, I would love to do that with my grandchild, but I got to learn Python myself." 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:36 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 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:54 There's a lot of cool stuff, a lot of cool times with like the the MicroPython 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:41 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:50 But you can just, and I've got the, I put just the few lines of code you need in our show notes, but it's just, you go to a directory you want, and you type pip download in some package, and it downloads that package and all of its dependencies, and doesn't install it.

07:06 just stores the wheels in that directory.

07:09 Yeah, that's super cool.

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

07:15 And it's really quick.

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

07:21 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:29 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 --noindex and 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:44 And this includes like version numbers.

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

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

07:52 Nice.

07:53 Do you know if I can, can I give it like a requirements TXT and say download that?

07:58 Download the results that I suspect you can, right?

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

08:05 Probably.

08:06 work with requirements files.

08:08 - Nice, okay, 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 wanna take some packages with you, right?

08:19 - Yes. - That's awesome.

08:20 Okay, so that's a really, really cool tip there.

08:23 I know there's the DevPi and the actual local proper PyPI servers that you can set up and just point at the URL, but I didn't know about this local download option, so this is great.

08:33 And that the all those other little PyPI 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, this definitely like everybody has a directory.

08:48 So they can do it.

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

08:52 That's cool.

08:53 All right, 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:01 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:07 Basically all you have to do is pip install rollbar, maybe include a line or two in the config or set up for your Python web app.

09:15 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 gonna have a booth at PyCon.

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

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

09:27 So yeah, I'm gonna have to go get a rollbar sticker for them.

09:30 Yeah, definitely get a rollbar sticker.

09:32 a roll bar shirt.

09:33 I don't know what kind of swag they're, they're bringing into the show, but they want to make sure you know there's a booth at role with for robot 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:46 Awesome.

09:47 Awesome.

09:48 Yeah.

09:49 So just check them out rollbar.com slash Python bites, 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 But you know what would be cool?

10:01 Is if we could have increment and decrement operators in Python.

10:06 I mean, 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:12 - Yeah.

10:13 - 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:19 - Certainly the language was created after, 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.

10:31 One of the challenges of plus plus and minus minus and those types of things is a lot of languages that support them support two variations, like plus plus variable and variable plus plus.

10:43 It's always like, "Okay, well, that increments it and then returns the incremented value versus returns the original value and then increment." It's confusing.

10:51 Why is increment confusing?

10:54 I suspect, Kuita 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 if it's an L value and R value.

11:06 So, yes, all those things.

11:08 And so it doesn't have one.

11:10 But friend of the show, Anthony Shaw said, let's see what it would 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 by step what it is you need to do to add a new feature to the Python language.

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

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

11:34 It's kind of neat.

11:35 Yeah, it certainly takes some of the mystery of like, well, how would you even start out of this?

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

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

11:48 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 PyPy and other implementations, you want those to stay consistent.

12:04 There's this grammar file they all share.

12:05 It talks about how to add them.

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

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

12:14 Lexer that goes through and, sorry, turns it into tokens.

12:16 the parser takes the tokens to abstract syntax trees and then there's a compiler actually compiles it to instructions. So he goes through all the steps and shows you how it works and even has his attempt to add this feature to Python itself on GitHub if you want to check it out. So he's got a working version with plus plus.

12:35 That's pretty cool. Maybe we could get him to add begin and end to blocks.

12:42 Hopefully, he's no.

12:45 And curly braces, we all love the curly braces.

12:47 No, just kidding.

12:48 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 apps.

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

13:04 >> Yeah, 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:12 And working with terminal colors is often not very fun.

13:17 But this Colorful project has actually got a syntax that's pretty darn readable.

13:23 And once you've figured out what colors and what syntax, what different parts of your command line interface you want different colors, I don't think you're going to really have to care, like really muck with it too much using Colorful.

13:37 And it even has things like piping colors to strings and like different plus and and operators that that makes sense with colors.

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

13:48 Yeah, that's cool.

13:49 I do as well.

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

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

13:59 The fact that you can use hexadecimal so you can just, you know, hash FAA for gray or whatever, 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, okay.

14:19 That's neat.

14:20 - Yeah, yeah, 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 know, it's just painful to say like, okay, well, I'm gonna take this like enumerated text 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, I wonder if it's built, I haven't actually tried it.

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

14:42 >> Yeah, we'll have to look inside.

14:43 >> Anyway.

14:43 >> Speaking of packages, everybody who works on making a Python package, they want to add a nice bit of bling, make it fancy looking, right?

14:51 >> Yeah, all the extra little blips and stuff.

14:54 >> Yeah, so there's a lot of things that make a package look professional or not professional, but there's 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 I don't think it's overly prescriptive, but it does talk about a few things that you can do that are pretty sweet.

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

15:18 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 AppBear or whatever, right?

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

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

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

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

15:50 It's unless there's some weird requirement about like it really has to be set up in some bizarre way that it can't be installed there from there.

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

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

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

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

16:10 This thing supports these versions of Python, it's tests are currently passing or not passing, it has this level of code coverage, all those things, right?

16:18 Yeah.

16:19 And one of the things that this highlights for that, I guess I always knew, but I don't think about it very much is all these different services for open source projects.

16:28 They're free.

16:29 Yeah.

16:30 Every one of those.

16:31 free for them to run it, but that's cool that all that stuff's just there for open source projects.

16:36 Yeah, it's really great. Like, Read the Docs is free. They do have ads on there. I'm not sure how targeted the ads are. They're pretty relevant to Python developers. But I do think it's a challenge. I know the Read the Docs guys are doing interesting and creative things to fund it. But it's, you know, it's non trivial to run it for free for the world. Yeah. And CI.

16:58 Well, they I had talked with Josh Calderon from Travis. And since they, they started out as a like open source stuff to start with, and they, they were doing it in their, their hobby time.

17:12 And in the commercial side is now they're, how they're doing it full time, and they have jobs.

17:17 And, and the reason why they maintain the free for open sources, because they got their careers from open source, and they want to give back. So that's really cool. So if I had like a private GitHub repo, I'd have to pay to get CI on it, but if I have a public one, it's free, something like that?

17:33 Yeah, they have an enterprise driver CI so that you can use for closed repos or private repos.

17:40 Yeah, private ones.

17:41 So what I thought was cool about this is none of those things are hard, none of those things are major, but they all make it, it shows that you care about what you're building, so you're more likely to get contributors, people are more likely to drop 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, I'd probably spend an hour or so trying to figure out each little bit.

17:59 - Yeah, there's little tips at each one, which is cool.

18:02 All right, 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, I'm doing management training, so maybe I'll finally learn how to become a manager after doing it for many years.

18:15 But the-- - Nice.

18:17 - But I was working furiously on the book on the plane trip over, and we're still barely on time still barely on target for a beta for PyCon.

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

18:31 - I can't believe it. - There's not a lot of time.

18:32 - There's not very much time. - I know.

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

18:36 - It's gonna be so fun though.

18:37 - Yeah. - Yeah.

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

18:40 - Not a lot of time.

18:42 - It's gonna be tons of fun.

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

18:49 - And how about you?

18:50 Anything up with you?

18:51 - Not too much.

18:52 Just thinking about PyCon makes me think I got to get a bunch of stuff ready for the conference or a booth and things like that.

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

19:00 Yeah, I can't wait.

19:03 Thank you for listening to Python Bytes.

19:05 Follow the show on Twitter via @pythonbytes.

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

19:11 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:19 We're always on the lookout for sharing something cool.

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

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

Back to show page