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


Transcript #53: Getting started with devpi and Git Virtual FS

Return to episode page view on github
Recorded on Tuesday, Nov 21, 2017.

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

00:05 This is episode 53, recorded November 21st, 2017.

00:10 I'm Michael Kennedy.

00:11 And I'm Brian Okken.

00:12 And we got a ton of cool things we picked for you today.

00:14 Well, six plus a few more, but it feels like a lot of good stuff to share with you guys.

00:18 So I'm looking forward to it. How about you, Brian?

00:20 I'm really looking forward to it. Yeah.

00:22 Yeah, definitely.

00:23 So before we get into that, let's say thank you, Rollbar.

00:25 If you think there are errors lurking in your app and you want to get notified right away, go to pythonbytes.fm/rollbar and check it out.

00:33 Tell you more about that right now.

00:34 I want to know your philosophy on line length.

00:37 Are you a strictly 79 or less sort of person, Brian?

00:40 - I'm trying to do the 79 thing, but it's really short.

00:43 So we do like 120 in my work group at work.

00:47 - You guys what, use like 44 inch like TV, HDTVs for like your monitors or what?

00:52 - It's still pretty good to have like, I like a little bit shorter so that you can put a whole bunch of, you can do side-by-side diffs easier and stuff.

01:00 >> Yeah, for sure.

01:00 >> But 79 is really tight.

01:02 >> It is tight.

01:03 >> How about you? What do you use?

01:04 >> I guess I do stick to 79 pretty much.

01:07 If the editor says, "Hey, this one's too long, you should reformat it according to pip8." I guess I do, but I feel like it has a tendency to put pressure on you to make bad decisions.

01:17 For example, if you have an expression involving, like say five variables and a string, like you're say formatting a string.

01:24 And it would encourage you to have those variables super short and nondescriptive so they fit within 79.

01:30 But if they're long and descriptive, that might be 100.

01:32 Right, and so I feel like there's this pressure, but I guess I succumb to it anyway.

01:36 - Things that I share on GitHub or something, I try to keep it to 79, but I don't know if it's a good idea or not.

01:43 Mostly because I do testing and stuff, people will run a flake eight over my code and say, "Hey dude, how come your code doesn't--

01:49 - Exactly, you failed the build.

01:51 - "Isn't clean." So there's a there's an article from Jake Vander Plaats. He's the The astronomer guy that was a did Picon talk to the keynote Yeah, he did a keynote there and I think else who did another talk, but yeah, it was it's great He's up at University of Washington doing all sorts of cool astronomy stuff so what he have to say about line lengths because of the switch of Twitter between 140 and 280 that they've done he was intrigued by looking at the statistics and did an exploration of line lengths in Python packages and He did it Like a Jupyter notebook type article so that you can kind of follow through all of his stuff and and mostly looking at numpy SciPy pandas I can't learn matplotlib and astropy So I didn't know about astropy, but that makes sense because I'm not an astronomer. Yeah, how often do you analyze?

02:43 Telescopic images with machine learning so far zero times Yeah, but it's kind of a neat look at basically I wouldn't know how to do this right off the bat I mean it but it's pretty simple to write a little bit of code to import a bunch of modules and Check out the line lengths and examine that and graph it and plot it and clean it up It's a pretty cool article and then also just sort of looking at it It looks like most of them, they follow a distribution, a--

03:13 - Normal distribution?

03:14 - It's not exactly normal, but it's--

03:16 - An abnormal distribution?

03:17 - An abnormal, a log normal distribution, that's it.

03:20 - Oh, wow, okay.

03:22 - That's a little bit more statistics than I understand, but it's sort of normal, I guess.

03:27 But it follows a log normal distribution, and except for there's an artificial bump near the right side, the 80 character side, because many of these packages are trying to hit 80 or less.

03:41 But there's an argument there for, you don't really need it because code naturally fits anyway.

03:48 It's a cool look at it.

03:50 I was thinking about using the code within this to take a look at our code at work to see where our line links are at work.

03:58 - Yeah, that'd be an interesting analysis to like run some PEP8 style metrics across like your organization.

04:05 - Yeah.

04:06 to do. Some enterprising listener out there should build like a little package we can all drop in and do cool stuff like that with. Yeah, and at the end of the article he does ask, he's curious about what different popular packages where they fit into the line length distribution match. So that'd be neat. Right, in other languages like how does this compare to say JavaScript versus C++ versus Python? Things like that. Also interesting to know, but I don't have those answers, so they're open questions for now. So it's a good day, yet another good day for modern Python and you know sort of the the sun continues to set on legacy Python this time around very you know you mentioned this package just previously NumPy. Yeah there's some interesting news with NumPy. Yeah so NumPy is dropping support for legacy Python and they say you know we know that the Python core developers are dropping support for Python 2 in 2020. It's still an open question on the day. I like that guy who voted for the keynote of PyCon 2020 as the official end date. But who knows what day it is, it hasn't been officially announced. But they say basically, this requirement to continue supporting Python 2 makes it harder and harder to advance NumPy. And so they're going to drop it.

05:19 I think that's great. I can see that.

05:21 It's such an important library and you know data science is definitely moving towards Python 3 and so their plans are December 31st 2018 Up until then they're going to support Python 2 and Python 3 100% and that's not very far away What is that like 41 days? No, that's 41 days in a year So a little bit of time on that one and then January 2019 all new features will be Python 3 only.

05:49 And then the year after that, I guess, when Python 2 support goes out, it probably goes out of here as well.

05:54 It isn't just a spiteful thing.

05:56 They've got real reasons to do it because the increased burden of trying to be Python 2 compatible is unreasonable.

06:04 Yeah, definitely means it's like there's features that are not in NumPy because it works on Python 2.

06:09 Right, so it's time to say thank you, but goodbye to Python 2, they say, which is, I think, great.

06:15 Speaking of data science, One thing I've tried to learn a lot, but haven't done a great job of is pandas.

06:21 Actually, pandas and like kind of the whole data science tool chain, it's something I'm curious about, but I'm not sure how to go about it.

06:28 So I really liked this article from Ted Petrou about how to learn pandas and how to go about it.

06:35 His opinion, of course, but it seems like a really pretty reasonable thing.

06:40 He was recommending some of the learning, reading the documentation and reading about pandas and how it works, but then also kind of jumping back and forth and using it for small projects.

06:53 And that, I guess, with any tool, that makes sense.

06:57 But there is some, he gives a little bit more, I guess, more details of how to do that so that you can jump back and forth and know what to learn first.

07:06 - Yeah, I think one of the challenges that I have learning pandas, I can sort of do a few things with it, but not a lot, is I don't really have a project to use it on.

07:14 Like I just kind of poke at it and go, "Oh, okay, it does this cool stuff." But you know, like I just haven't done like data science-y things or financial analysis things.

07:23 So he talks about things like, "Here's some Jupyter notebooks.

07:25 "Here's some Kaggle kernels and data sets "in the form of, these are data sets "in the form of Jupyter notebooks." So some concrete ways to play with it, not just, you know, fire it up and poke at the API.

07:36 - Yeah, or maybe go back to that Jake article and examine your line lengths.

07:42 - Exactly, there's an example.

07:43 - And then one of the things I thought was a nice ending is when you think you have it fairly well, go a little bit further, and then start answering some questions on Stack Overflow and kind of measure yourself against the other things that people are running into problems with.

07:59 I think that's a cool idea.

08:00 - That is a cool idea, and the people on Stack Overflow will let you know if you're wrong.

08:03 (laughing)

08:05 - Yeah, definitely.

08:05 It's one of the nice and not nice things about the internet is the best way to find out whether you're right about something is to post the wrong answer.

08:13 - Yeah, people don't really hold back on you too often, do they?

08:16 - Yeah, no, no, you get that right away.

08:18 - Yeah, if you have a thick skin or if you're willing to grow a thick skin, then that's actually a great way to do it, yeah.

08:23 Reddit would probably also work too.

08:25 - Also, I'm sure the data science people are similar, but the Python community as a whole is fairly gentle with people.

08:33 They'll tell you you're wrong, but they'll be nice about it and probably use more words than you've written to explain something, to explain why you're wrong about it.

08:42 - Yeah, maybe they'll have a good explanation of your misunderstanding and you can connect some more dots, right?

08:47 - I depend on that a lot.

08:48 (laughing)

08:49 - Nice.

08:50 All right, before we get to the next one, which is some more social coding stuff, just wanna say thank you to Rollbar.

08:57 If you have a web application and it's running on the internet, it's probably crashing at some point, and it would be great to know about that.

09:04 Like, how often do you go back and read logs?

09:06 Like, do you go and read logs at your work very often, Brian?

09:09 Actually, more than I want to.

09:10 Yes.

09:11 I'm in a manager role, so I get to tell other people to do it.

09:14 Here's a problem in the log. Go fix that. Yeah.

09:16 But you don't want to have to depend on reading that, right?

09:19 If you could avoid it and just get the notifications right away, that'd be awesome.

09:21 So, Rollbar actually, I normally talk about in the context of Python, and that's totally true, but it actually supports 26 languages and frameworks.

09:29 So, Python, obviously, Flask, Django, Pyramid, etc.

09:32 but node.net, it even has a Flash plugin and client-side JavaScript.

09:38 So, totally cool, like whatever you're using, you can use Rollbar, it's awesome.

09:41 And they have this thing called people tracking.

09:43 So, for example, on like my training site, people are logged in, and if there's a crash, I can emit a little thing that will tell Rollbar, this is the user that had this error.

09:53 So, not only do I know what the error was, I can actually go back and send that person a message, say, "I ran into a crash, and here's how I fixed it." Like, "Whoa, I didn't even tell you what happened." That's kind of creepy, but awesome.

10:02 So anyway, if you want to be creepy and awesome, check out pythonbytes.fm/rollbar and solve the problem before your users even tell you about them.

10:10 All right.

10:11 So one of the things that came out recently was an announcement from Microsoft and GitHub.

10:18 I'm not sure what the order of, but this sort of came out, but it started, I think it started at Microsoft and they want to use Git.

10:27 Okay, so everybody wants to use Git because Git is awesome.

10:30 But the problem is, they actually have some pretty large projects.

10:34 And it turns out they tried to use Git, and it was basically unusable for some of their projects at Microsoft.

10:40 So, Brian, you're probably thinking, Git was built for Linux, and Linux is a huge project, right?

10:45 Yeah.

10:46 So, what's up with these Microsoft people?

10:48 They must be doing it wrong.

10:49 And I kind of actually thought that when I read this first as well.

10:51 But it turns out, if you look at the Linux kernel, it's like 640 megs of data in the source code repository in Git.

11:01 That's big, right? That's quite big.

11:03 But it turns out that if you look at like the Visual Studio tools, those are three gigabytes, which is five times bigger than Linux.

11:11 And they're trying to use it for that.

11:12 And that was kind of a little sketchy.

11:14 But then they wanted to use it for Windows.

11:16 And apparently the repository for Windows is 270 gigabytes or 421 times larger than Linux.

11:24 - Wow, no wonder it's slower.

11:25 - That's a little bit bigger.

11:26 And there's 4,000 people committing to it like all day as their job, right?

11:30 So it's got a lot of contention as well.

11:33 And so what they've done in the announcement is Microsoft and GitHub team up to create a Git virtual file system.

11:41 And the GitHub part is mostly to make this work on other platforms, macOS and Linux and things like that.

11:48 So what they did is they said, "Look, the problem is we literally have like, I don't know how many million, thousands, maybe millions of files when we do a checkout.

11:58 So when did a regular Git checkout, it would take 12 hours to clone the repository, three hours to do just a straight checkout of a branch, eight minutes to ask Git status, and 30 minutes to commit one file.

12:12 So it was pretty broken.

12:14 And they said the reason it's broken primarily is there's all these files, and generally you're only working with a little sub part of them.

12:21 So what they did is they created a virtual file system that understands Git repositories, and it only checks out like a metadata list, like a directory listing.

12:29 - Wow, cool.

12:30 - And then if you interact with it, it basically will create those files by getting them from the server on demand.

12:36 And it doesn't have to be like some plugin, it's like at the file system level.

12:39 So if I open up like command prompt, or I open up some editor, I just type like GCC, and it has to touch like 10 files, like that will automatically get them from Git if they weren't there.

12:50 Isn't that crazy?

12:51 - That sounds a lot like ClearCase before ClearCase started to suck.

12:54 - Yeah, exactly.

12:55 So they built this for Windows and they got really good success.

12:59 They said instead of 12 hours to clone it, it takes 90 seconds.

13:02 Instead of eight minutes to do a git status, it takes three seconds.

13:05 Instead of 30 minutes to do git commit, it takes eight seconds.

13:08 And so they've actually been pushing about half of these changes back upstream into Git.

13:14 And they've been working with the Git developers to make this a general thing, not a Microsoft thing, which I think is pretty noble.

13:20 That's definitely like a new Microsoft, not the old Steve Ballmer Microsoft.

13:24 - Is it just for GitHub or can we use it with other Git?

13:28 - This is just purely for Git.

13:29 So they're pushing this back to the Git developers, not for GitHub.

13:34 But where GitHub comes into this is GitHub, they have, maybe they have this problem for projects hosted on GitHub, but people are already using those projects on GitHub.

13:43 So it's probably okay, but they're trying to sell enterprise GitHub, which is like a box you put in your company to run those things.

13:51 And these enterprise projects can be like huge, like this Windows problem.

13:54 And so GitHub is trying to basically expand this to Linux and macOS so that they can make that part of their enterprise story.

14:02 - That'd be cool.

14:03 I'd like to have it be part of the GitLab experience as well, that'd be good.

14:07 - Yeah, absolutely.

14:09 Yeah, so hopefully this makes it back into Git proper and then the OS support can come from Microsoft and GitHub, that'd be awesome.

14:15 - Yeah, this is pretty cool actually.

14:17 - Yeah, keep an eye on this.

14:18 - Yeah, yeah, we'll see where it goes.

14:19 But they've already got demos and stuff working for Microsoft Windows.

14:22 And there's actually a 10 minute little video like as they work through this stuff, you can check it out, it's really short.

14:27 I'd link that as well.

14:28 Speaking of downloading stuff from servers and getting your libraries all put together.

14:32 - I don't know if I'm just dense or what, but the multiple times I've tried to set up a DevPi server for caching PyPI stuff locally, and mostly I need to do this partly because of setting up a, you know, if you want to do a laptop setup, so for while you're on the plane or something, but also behind a firewall so I can have my build server not have to go outside the firewall and stuff like that.

14:58 I'd like to have a local one.

14:59 And I ran across this article.

15:01 I haven't actually gone through it.

15:02 I was going to do that this morning, but it looks pretty good from Stefan Scherfke that's getting started with DevPi.

15:09 And it walks through, basically, he had the same thing.

15:13 You needed to set it up a local server again, couldn't remember how to do it.

15:18 The documentation is okay, but it still has some issues.

15:22 And so it just sort of walks through the whole thing and shows you how to do it in at least one use case, which is pretty close to what I think most people need, which is mostly mirroring the packages from PyPI that your company actually uses.

15:37 Not everything, just the stuff you're using.

15:40 And then also being able to store own local things there. Yeah, that's a great combination. I think the caching bit is really nice. Like you can just point at this thing and it'll just pass through and get the ones from the full PyPI, right? And then you can tell it to refresh it occasionally and stuff. And then you you know also just push up your own local ones so that you can share your own stuff around. I think that's a really great thing that probably not too many organizations are doing. If you have different teams working on different packages, like you can actually publish it to like your company through these things, which is pretty awesome. We also have a PyPI whitelist. So that might be really positive given some of the recent security scares we've had there, right, depending on how paranoid you are. Part of the article is talking about user management. For me, I'd probably set up things for all my local dev team plus the build to be able to get things.

16:35 But he was having it locked down to just the build server being able to do it, which is an interesting idea as well.

16:42 Nice. So the last thing I want to cover this week is what I think a lot of people who are developers or work for a company building a product that are kind of new to it, sort of a technical company, maybe miss, which is the whole marketing side of software.

17:01 Right? Like the hardest thing about making something successful, if it's a web app, or it's a regular app, or it's a SaaS thing, or whatever, is not building it.

17:10 Building it may be challenging, but that is not the hardest thing. The hardest thing is getting people to notice it in a busy world, and getting the word out. The whole marketing side of stuff that most of us developers are not super good at.

17:21 So there's this GitHub repository called Marketing for Engineers.

17:26 And it's a curated collection of marketing articles and tools to grow your product.

17:30 - That's nice.

17:31 - Yeah, isn't that cool?

17:32 So these guys, they created some kind of iOS app and they're like, "It took us almost two years "to learn how to market our project.

17:38 "It was painful." So we're trying to help that.

17:40 So they said, "Look, we're gonna come up "with a bunch of resources that are, "to help you solve practical marketing tasks, "such as finding beta users, "growing your first user base, "advertising your product without a budget, "all those different things." So they have a whole bunch of different areas that if you're new to this, you can really learn a lot from, like how to market on social media, where are the right places, how to leverage Quora, how to leverage product hunt, and business models, all kinds of stuff.

18:08 So I thought that might be useful.

18:10 There's about 4,000 people who have started on GitHub.

18:13 They probably also thought it was useful.

18:15 - It's a huge list.

18:16 - Yeah, it's massive.

18:17 - Yeah, one of the things on there that I saw, it's near the top, is doing things that don't scale, which I love that advice.

18:25 - Yeah, I do, I like that as well, yeah.

18:26 Definitely do things that don't scale.

18:28 As I was writing the pytest book, I tried to help out as many people as possible on the Slack channel.

18:35 And even if it meant, a couple times I just asked people, hey, are you available?

18:40 Can I just call you on the phone?

18:41 I just talked to people about their issues with pytest and with testing.

18:45 Now, clearly you can't do that on a huge scale, but when you don't have any end users at all yet, it's pretty easy.

18:51 - Yeah, for sure.

18:52 And the behavior creates super advocates for you, and it also lets you realize some of the challenges.

18:57 So like maybe in the final version of your book, it reflects some of those challenges that that one person had, but maybe there's a thousand or more people who actually have it.

19:06 They didn't call you because they just read your book, 'cause you've already got it, right?

19:09 - I love this, because a lot of us nerds didn't become nerds because we really like talking with people.

19:15 - I used to laugh at the people in business school.

19:16 Now I'm kind of like, huh, they probably know something, don't they?

19:18 - Yeah.

19:19 - Oh, those guys don't know calculus like nothing.

19:23 Oh, uh-huh, I see how it's going for them.

19:25 All right, anyway.

19:26 - Awesome, so that's it for this week.

19:28 Those are tons of fun things.

19:30 Thanks for sharing them, Brian.

19:31 You have one more bit of crazy, sort of American-flavored shopping madness around Python for us, right?

19:38 - Yeah, I guess I forget that, yeah, there's plenty of listeners outside of America, but one of the traditions we have is a Black Friday sale, which has spilled over into online things as well.

19:50 So starting the day after Thanksgiving, usually, but we're doing it, I think, a little early here, Maybe not.

19:57 If anybody doesn't know, I wrote a book.

19:59 I've been talking about it for a year, so you probably do.

20:01 But the Python Testing with pytest is through Pragmatic, and Pragmatic has a book sale going on the 22nd through December 1st, and you get 40% off all e-books.

20:13 - That is awesome, yeah, so get in there and get it.

20:15 The reviews are awesome for that book.

20:17 Is this a global thing, even though it's the sort of terminology and date is US-inspired?

20:22 Can people all over the world come and get it for 40% off, whatever it is?

20:25 - Yeah, to get the discount, just use coupon code TurkeySale2017.

20:31 - Awesome, all right, well, go and get that book.

20:34 You've been on the shelf.

20:36 Fans, have you been on the shelf?

20:37 - One more thing that just came up.

20:39 I had somebody, somebody actually from the Testing Slack channel again, asked me if I could mention PyCon Colombia.

20:47 So tickets are available.

20:49 They're gonna have their first Columbia PyCon in Medellin in February 9, 10, and 11 of 2018.

20:56 So we'll put a link in, but it's pretty easy to find.

21:00 So that'll be fun.

21:01 - Yeah, awesome.

21:02 Check it out if you're down in South America.

21:04 It could be a good time.

21:05 Or if you wanna go visit there, right?

21:06 - How about you?

21:07 Do you have any news to share with us?

21:08 - I have no news.

21:09 There's no news for me.

21:10 (laughing)

21:12 I'm actually working on some stuff.

21:13 I don't wanna announce it yet, but absolutely got some cool things I'm working on.

21:17 Always trying to juggle too much, which is kind of the curse of my personality, but it's fun.

21:22 You're doing a lot of cool stuff though.

21:23 I can't wait to see.

21:24 Oh. - Yeah, thanks.

21:25 - Back on the PyCon Columbia thing, they have a really cool logo.

21:29 So if anybody's going to that, if you could snag me a T-shirt, that would be cool.

21:33 - Yeah, order the T-shirt.

21:34 They come with a logo.

21:35 (laughing)

21:37 - Well, thanks for talking to me this year.

21:38 - You bet.

21:39 Great to chat with you, Brian.

21:40 And everyone as well, thank you for listening.

21:43 See you later.

21:43 Thank you for listening to Python Bytes.

21:47 Follow the show on Twitter via @PythonBytes.

21:49 That's Python Bytes as in B-Y-T-E-S.

21:53 And get the full show notes at pythonbytes.fm.

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

22:00 We're always on the lookout for sharing something cool.

22:03 On behalf of myself and Brian Aukin, this is Michael Kennedy.

22:07 Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page