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

« Return to show page

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

Recorded on Tuesday, May 2, 2017.

00:00 KENNEDY: Hello and welcome to Python Bytes. It’s Episode #24 and we are going to deliver Python news and headlines directly to earbuds. This episode was recorded on May 2, 2017 and is brought to you by Rollbar. I'm Michael Kennedy.

00:00 OKKEN: I'm Brian Okken.

00:00 We're here to bring you a bunch of Python news, but this time it's little different. Normally, we’re broadcasting from two secret locations in Portland, Oregon. But this time, Brian, you're dialing from slightly further away.

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

00:00 Alright. Well, welcome to Europe. Let's start with Learning Python out of Munich.

00:00 Yes, so this is one of the, I think, a listener of the show contacted us and 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. I think it looks like a nice tutorial He is publishing it on Dan Baders’ site, and the first in the series is “Let's Program with Python: Statements, Variables and Loops”. I think he's coming at it from a space of, just really getting started/haven't done much. He's even goes through, ‘What is programming?’ assuming people haven't done programming before. It's telling people how you're telling the computer how to do steps. It's hard for me to put my head back in the space of “new to programming” but I think this looks like something that might be good for – I don't know what age group – but it would be good.

00:00 Yeah, well, we can talk about a lot of different age groups. Way to go, Doug. That's awesome. It's really hard to you don't get rid of the curse of knowledge once you've learned a thing, it's really hard to see it with fresh eyes and understand the challenges and stuff. But that's really cool. Don't you wish something like Robotics and Beyond existed when you were a kid?

00:00 Yeah, I do. 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. 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. This one uses Turtle Graphics and stuff. I haven't seen people use Turtle Graphics very much recently, so that's kind of fun.

00:00 Oh, yeah, very cool. Nice. That's great one, so check that out. If people ask you for how to get started programming, right, maybe kids, the there's a lot of good options here. Here’s one more.

00:00 speaking of learning to program, I picked one that is an actual academic paper but I felt it was pretty interesting. This was done by Philip Guo. I've had him on Talk Python a few times. In this one he's talking about helping older adults learn to become programmers or become more proficient in programming. So, like what you were just talking about, there's a lot of, ‘Hey, you're a young kid. Do you want to get started with robots and programming? Here's how you do it. We’ll get you going to watch your career and stuff.’ But Philip said that so many of these resources are focused on the young, teenage to early-20s group, starting their careers. But how much do we really know about people who are sixty to eighty-five years old, who are just learning to program? He actually wrote a proper academic paper and did a bunch of research on those guys.

00:00 Wow, I think that's cool.

00:00 It is really cool.

00:00 The age group, I guess, I wouldn't expect people with from the age group you've listed. Sixty to eighty-five, was that the age group of the respondents?

00:00 That was the age group of the respondents, yeah. If you were outside of that age range, or mostly younger, than you were sort of not included. It was really focused on people who are basically either about to retire or who were retired. It looked at a couple of different aspects like, why are they interested in learning a program? What challenges do they have that they share with everyone that is learning a program? Like, ‘What's a variable? What's a pointer?’ Everybody suffers that, but there's also specific challenges for that age group. Also, what are they using to learn, and some of the lessons on how we can make the whole environment better for those guys, as well.

00:00 I think that's great.

00:00 Yeah, I do too. I think it's interesting to look at what some of the reasons why people in this age group were learning to program. Some of them just said, ‘Look, I'm now retiring and I've always wanted to learn to program. Maybe I did something technical, like maybe I was a scientist, but I never really got around to learning programming.’ That might be one reason. Another was connected with grandchildren. 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, right?’ Another big opportunity here is, there is a pretty big gap between people who can do programming and people who are teaching kids. So, people in this age group also have a lot of time, if they’re retired, to maybe donate an hour or two a week at some place mentoring or something like that. Maybe they could fill in, 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? Something like that. As well as just keeping mentally active and pursuing hobbies. Like, their hobby is airplanes and they are going to create something that works with airplanes somehow.

00:00 I could see probably the maker space getting into that and people trying to program Raspberry Pi and stuff like that.

00:00 Yeah, absolutely. There’s a lot of cool stuff, a lot of cool tie-ins with like the MicroPython-type stuff, as well. So, if you are interested in this, check this out. I’m also planning on doing a full, proper Talk Python episode with Philip in a few weeks, so we'll catch up on that and go deeper on that show.

00:00 Okay, great.

00:00 next up I've got something that we talked about, I can’t even remember what episode; I was looking for a good way to have a local PyPI server just so you can sort of not have to go out on to PyPI all the time. Especially on the plane trip when I was flying over here, I knew I wouldn't have an internet connection, so I wanted to make sure I had a cache of all of the packages I needed while I was programming on the plane. 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. I've got the just the few lines of code you need in our show notes. It's just, you go to a directory you want, and you type pip download and and it downloads that package and all of its dependencies, and doesn't install it. It just stores the wheels in that directory.

00:00 Yeah, that's super cool. So, you can basically create an offline version of PyPI.

00:00 And it's really quick. You can even list multiple packages on the line. I just I knew like, the ten or twelve that I needed and didn't know what their dependencies were, and just filled up a directory in like ten minutes or less. Then I was ready to go. 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. Then the rest is the same, you just give it a package.

00:00 includes version numbers, so you can you can have multiple versions in there, as well. Just wanted to share that with everybody.

00:00 Do you know if I can give it like, a requirements txt and say, ‘Download that’? Will it download the results of that? I suspect you can, right? Probably pip download -r requirements.txt, I bet.

00:00 Probably. I don't usually work with requirements files.

00:00 Nice.

00:00 this is a cool thing. So, if you maybe were going to be stuck on an airplane and trains and other places for like, eighteen hours straight, you might want to take packages with you, right?

00:00 Yes.

00:00 That's awesome. So, that's a really cool tip there. I know there's like 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. This is great.

00:00 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. I don't know what I'm doing wrong, but this is easy.

00:00 Yeah, definitely. Everybody has a directory, so they can do it. (Laughing) You don't have to have the right infrastructure to run it. It’s cool.

00:00 before we get on to the next item which is about adding features to the Python language itself, I wanted to say thanks, Rollbar.

00:00 guys hear me talk about Rollbar a lot, you know that I use Rollbar on my web site and I really like Rollbar. 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 and it is tracking all these errors and sending reports and notifications with lots of details, any time it happens. So, these guys are going to have a booth at PyCon. They're going to be just like us, Brian. We're all going to have booths at PyCon.

00:00 Yeah. I'm going to have to get a Rollbar sticker.

00:00 Yeah, definitely get a Rollbar sticker, maybe a Rollbar shirt. I don't know what kind of swag they are bringing to the show, but they want to make sure that you know there's a booth for Rollbar at PyCon. Drop by and they’ll give you a demo and give you some kind of swag to go with it.

00:00 Awesome.

00:00 So, just check them out. Get the boot strap plan for free, which is a hundred thousand events and one hundred and eighty days of retention. Hopefully, you don't use up that many errors, but if you do they got you covered.

00:00 So, you know what would be cool? If we could have increment and decrement operators in Python. We can do (plus equals one) +=1, but think of all the characters we’re wasting there. What if we could just do (plus plus) ++. Do you know why Python doesn't have increment and decrement operators? I have a theory but I don't actually know.

00:00 I don't know? Do you?

00:00 Certainly, the language was created after C and C++, so it's not like it wasn't known as a possibility. I suspect it was to keep it more explicit. You know one of the challenges of (plus plus) ++ and (minus minus) - - and those types of things is that a lot of languages that support them support like two variations, + variable and variable ++. It's always like, ‘Okay, well, that increments it, then returns the incremented value versus returns original value… It's kind of confusing. Like, why is like increment confusing? I suspect GUI does just like it simple.

00:00 It's also like, in C++, it matters which side the assignment operator is on to, if it's an L value or an R value.

00:00 Yes, all these things. So, it doesn't have one, but friend of the show, Anthony Shaw said, ‘Let's see what it would be like if we tried to add one.’ I think this is cool because 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. Basically, he writes an article that adds ++ and -- to see Python.

00:00 I like where he’s going with it and also teaching people how to do this. It’s kind of neat.

00:00 It certainly takes some of the mystery of like, ‘How would you even start out of this?’ He says, ‘Look, there's basically five or six levels.’ You're going to start by doing a pep to get agreement on what the language features going to be. Then there's a grammar file that describes what the statements in Python are. 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. So, there's this grammar file they all share. He talks about how to add them and it turns out it's like, super easy to add these new things. Then there's the lexer that parses it. Lexer that goes through and turns it to tokens. In the parser take the tokens to abstract syntax trees and then there's a compiler actually compiles it to instructions.

00:00 goes for all the steps and shows you how it works and even has his attempt to add this feature to Python itself, out on GitHub if you want to check it out. He's got a working version with ++.

00:00 That’s pretty cool. Maybe we could get him to add begin and end to blocks. (Laughing)

00:00 Hopefully, no. And curly braces, we all love the curly braces. No, just kidding.

00:00 that's awesome.

00:00 thing that you brought up that I like is colorful. I think so many of the apps we create in Python are terminal level or CLI-type apps. People really could do more to make them pretty, right?

00:00 Yeah, so I've been working a lot with Pytest lately and one of the great benefits of it is the color in the terminal window. Working with terminal colors is often not very fun, but this colorful project has actually got a syntax that's pretty darn readable. Once you've figured out what colors and what different parts of your command line interface you want different colors, I don't think you're going to have to muck with it too much using colorful. It even has things like piping colors to strings and different + and & operators that make sense with colors. I like what they're doing with this.

00:00 Yeah, that's cool. I do, as well. A couple of things that really stood out as nice to me, one is the syntax is pretty straightforward on how you use it. The fact that you can use hexadecimal, so you can just (hash) - fa fa fa for a grey or whatever. You can you can take sort of web colors and plug them in, which is really cool. They even have themes, like you can set up general themes. You can use context managers, so in a with block you can set a color, things like that.

00:00 That’s neat.

00:00 Yeah, pretty sweet. I might start using it. I've looked at Colorama and some of the other ones, and they’re fine but, I don't know. It’s painful to say, ‘Take this enumerated text value and concatenated with my string to make it a color.’ I think colorful is a little nicer.

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

00:00 We’ll have to look inside.

00:00 of packages, everybody who works on making a Python package, they want to add a nice bit of bling. Make it fancy looking, right?

00:00 Yeah, all the extra little blips and stuff.

00:00 Yeah, so there's a lot of things that make a package look professional or not professional. There's this article called, “Five Steps to Add the Bling Factor to your Python Package” and I thought it was pretty cool. It’s certainly not exhaustive. I don’t think it's overly prescriptive, but it does talk about a few things that you can do that are pretty sweet.

00:00 just run through the five steps real quick. Step one, you can host your documentation on readthedocs. That's nice, right? Proper documentation in somewhere with search and all that kind of stuff. Set up continuous integration with Travis Ci or maybe AppVeyor or whatever. But if you're going to set it up, some kind of continuous integration. If you're going to run unit test, you probably want to know what your code coverage is, so you can show your code coverage with Codecov. Obviously, if you're going to have a package, if it doesn't live on PyPI, it’s almost not real. 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 from there, it really should be on PyPI. Add it up there and it talks about how to do it. It is surprisingly easy to get your package onto PyPI.

00:00 if you have all these things, you would have badges, right? This thing supports these versions of Python. Its tests are currently passing or not passing. It has this little code coverage. All those things, right?

00:00 Yeah. One of the things that this highlights, that I guess I always knew but I don't think about it very much, is all these different services for open source projects, they're free.

00:00 Yeah. Everyone of those.

00:00 But it's not free for them to run it, but that's cool that all that stuff is just there for open source projects.

00:00 Yeah, it is really great. Readthedocs is free. They do have ads on there. I'm not sure how targeted the ads are, they're pretty relevant to Python developers. I do think it's a challenge. I know they readthedocs guys are doing interesting and crave things to fund it, but it's non-trivial to run it for free for the world.

00:00 I had talked with Josh Kalderimis from Travis Ci. They started out as open source stuff to start with. They were doing it in their hobby time and the commercial side is now how they're doing it full time and they have jobs. The reason why they maintain the free for open sources because they got their careers from open source and they want to give back.

00:00 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 its free?

00:00 Yeah, they have an enterprise drive with Ci that you can use for private repos.

00:00 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 adopt your package, things like that.

00:00 It’s 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.

00:00 Yeah, there's little tips for each one, which is cool.

00:00 well that's our news for the week, Brian. Anything besides the fact you're just tooling around Germany?

00:00 Well, I’m doing management training, so maybe I'll finally learn how to become a manager after doing it for many years. But I was working furiously on the book, on the plane trip over. We’re still barely on target for a beta for PyCon.

00:00 I just looked. PyCon is two weeks away. I cannot believe it.

00:00 There’s not very much time. I still have to order stickers.

00:00 It’s gonna be so fun, though. You’ve still got time, but not a lot of time.

00:00 Not a lot of time.

00:00 It's going to be tons of fun. I'm looking forward to meeting a bunch of listeners there and hanging out with you and everyone else.

00:00 How about you? Anything up with you?

00:00 Not too much. Just thinking about PyCon makes me think I gotta get a bunch of stuff ready for the conference, for our booth and things like that. Yeah, it should be a lot of fun.

00:00 Yeah, I can't wait.

00:00 Thank you for listening to Python Bytes. Follow the show on Twitter via @pythonbytes and get the full show notes at If you have a news item you want featured, just visit and send it our way. We’re always on the lookout for sharing something cool. On behalf of myself and Brian Okken, this is Michael Kennedy. Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page