- Podcasts
- Python Bytes
- #68 Python notebooks galore!
About this episodeTopics covered in this episode: dumb-pypi Requests-HTML: HTML Parsing for Humans A phone number proxy Notebooks galore part 1: Datalore…
- dumb-pypi
- Requests-HTML: HTML Parsing for Humans
- A phone number proxy
- Notebooks galore part 1: Datalore
- bellybutton
- Notebooks galore part 2
- Extras
- Joke
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
#68 Python notebooks galore!
Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds. It's episode 68, recorded February 28th, 2018. I'm Michael Kennedy. And I'm Brian Okken. And we have yet another bundle of amazing stuff to share with you. I'm super excited about the ones I got. How about you, Brian?
I'm really excited. I had to kick some out because I had too many things to cover. I think I changed my list four times this week because I'm like, oh, this is a great list. Oh, no, this one's more important. This is even better. It's awesome. Yeah. Yeah. So before we get to it, I just want to say thanks to DigitalOcean for sponsoring this episode.
So there's a lot of local. So you can have your own repository. So there's a bunch of different ways you can set up your own server so that you can serve your own packages. Like if you've got a team or something that you've got proprietary code that you don't want to share with others on normal PyPI, you can have your own.
But you have to have a server running. And there's a lot of the generation of the server code is tied to it. So there's like a flask version and there's various versions. This one is just a flat file creator. So this package, Dumb PyPI, will just take a directory full of wheels or zipped packages and create a directory that you can just stick on any server and have it be served up for an index.
And for instance, I've got a... So it doesn't do any caching. It doesn't go through to PyPI and grab things that it's missing. So you have to manually do that yourself. But if we combine this with what we learned in episode 24 that you can just do pip download easily and download your own files somewhere.
This combined, I'm using this at work now to create a really simple PyPI server behind our firewall that doesn't have... I don't have to give it permission to talk to the outside world. It's just a bunch of files. So... It's actually really cool. So you could even put it up on like Amazon S3 or somewhere like that, right?
Right. And actually, there is an example on... I think that is the example on the website or the package website. GitHub site does have an S3 example. It's like super fast and slick and it doesn't do anything like updates or anything. You have to rebuild everything yourself. But if you're going to...
And then pulling in test packages and different packages. That stuff just... I don't want it to update all the time. I want it to... I want it to grab certain versions that I know are there. So something like this is perfect. Yeah. It looks really cool. I think it needs a better name than dumb PyPI.
So when I looked at this, I thought, oh, is this maybe like a replacement for beautiful soup or something like that? Like in some kind of extension to requests. But in fact, it actually depends upon beautiful soup. Right. So what it is, it's a library that like puts a different API on top of combining requests plus beautiful soup, plus something called py query, which lets you run jQuery style CSS selectors.
So it does a bunch of cool stuff. Some of the notable features are it has full JavaScript support, which I'm taking to mean that it will parse and execute the JavaScript necessary. So if I hit like an AngularJS page, instead of just seeing curly brackets everywhere, there's data that would have gone in there, which is a big deal in web scraping.
Because if you just use straight up request plus beautiful soup, you just get the markup where those bits would execute when it does, right? Yeah. The CSS selectors, XPath selectors mocked user agents. So it pretends to be a real browser. So people don't know that you're trying to scrape their sites, which is kind of interesting.
It uses connection pooling and cookie persistence. So you can like log in and then go do a bunch of stuff at a site. And you can do it without reconnecting every time. So that's pretty cool. Yeah, and it keeps the session open and tying requests with, I mean, that's what people often did anyway is a request plus beautiful soup.
And tying it in with one API is great. And actually, I like the idea anyway of somebody saying, hey, these tools are great, but I wish the API was different. So just write another package that uses others and write a better API then. Yeah, it's a little like Flask, what Flask did, but for requests and parsing.
Yeah, not bad, right? Cool. So what's up with this phony number thing? You got some like prank calls to make? This was awesome. So Twilio does their Twilio blog where people can write for them. And I think we've talked about it before. They do a pretty cool program where they give you an editor even to help you out with it.
But this article is basically a, and you don't have to do a Twilio project, but this is a Twilio project. This is a phone number proxy. So the idea is you imagine a situation like, for instance, you've got a, I don't know, a meetup or some temporary event. And you want people to be able to text you because you're not going to be around your computer all the time.
You want to be able to people, people to be able to text you and you want to text back, but you don't want to give out your phone number. Well, this project gives you a little proxy so that you can set it up with Flask and set up a server with Twilio and have give out a temporary phone number and have it be attached to your phone.
And I'm going to definitely have to try this out because it looks fun. Yeah, that looks really, really cool. And I think that program they have is awesome. One of the challenges of getting started blogging is nobody knows about you. Nobody, like you'll put all this effort into writing this thing and you'll put it out there and your 10 friends who are willing to follow your tech stuff off of Facebook glanced at it, right?
And so here's a way to like appear on a major, major blog and highlight what you're doing and maybe jumpstart your other tech stuff, right? Like you could link back to your blog or something like this. Having somebody work with you to polish it up a little bit. Is a good idea. Often when you just tap your friends for that sort of help, they'll just tell you, oh, it looks great.
Go ahead and put it up. Yeah, yeah. Very cool. Very cool. But this project is also pretty neat. It does encourage you to do some of the paid part of Twilio. But I think for something like this, it's a good idea. Yeah, very nice. Good article. All right. Before we get to the next, let me just tell you about DigitalOcean.
They're doing some really amazing stuff. So the thing I'd like to highlight is they just upgraded all of their things and left the price the same. And they, by upgraded, I mean doubled all the stuff at least. So for example, you go to DigitalOcean and get a Linux server with all variety of Linux machines, Linux distributions, with four gigs of RAM, two CPUs, 80 gigs of SSD for $20 a month.
Like that's insane. Right? That is a crazy thing. And that used to cost $40. And they just said, nope, that's now $20. And it comes with four terabytes of free traffic. If I were to just transfer that over S3, which is $0.09 a gigabyte, just that bandwidth would be $368 at S3. That's included in your $20 server.
So really, really awesome stuff. Check them out over at do.co slash Python. And you know, check out what they're doing. Help support the show. Everybody's getting good stuff. So thanks to DigitalOcean for that. All right. I kind of want to just go on a Jupyter-like notebook rant for a while, Brian, because the news around this stuff is just coming in fast and furious.
But I see how powerful it is for people who are exploring data and being more iterative with their code. And in the last couple of weeks, they've got a lot more options. They've been in the news a lot right now. So I'll start with one for this one. And then we'll do another one in the final segment.
It has this intelligent editor, just like JetBrains has. Like, you know, IntelliJ plus PyCharm has with all of the like the cool autocomplete and IntelliSense. It comes like pre-installed with a bunch of stuff that you need, like Matplotlib and so on. It has collaboration. So you can log in and kind of like do Google Docs style, work on it together.
I don't know how real-time it is. Like, do you actually see every character going in? Or do you, you know, do you have to refresh it? Does it automatically refresh? I'm not entirely sure the level of collaboration, but there's some real-time multiple people working on the same notebook type of collaboration.
It basically saves it and tags it so you can get it back. Things like that. Oh, that's great. Pretty cool. The JetBrains, like the diff viewer for version control is really great. So that, building that in here is cool. Yeah, they've got some really cool stuff. And finally, this might be pretty big for some folks, depending on what you're doing.
And you have to rerun the entire thing. If you're changing your model, it only reruns the parts that have changed, that depend upon something you've changed. Oh, that's awesome. Yeah, it's pretty cool, right? So if your computation takes two minutes, but this little part's really quick because it uses mostly finished data, that's a really big deal, I think.
Yeah. So anyway, data lore, it seems like it's in beta. I don't know what it costs, if there's a free thing or whatever. But it's a Jupyter Notebook-like hosted service from JetBrains, which I thought was pretty cool and worth talking about. Yeah. Neat. Nice. I have no idea how to get started on this next one.
I'm just going to say the name, Belly Button. Belly Button, yes. For personal lint. What's up with us? So, yeah, I think it's a play on words around, like, linters and where lint usually shows up. So we have things like pylint and flake 8, which in PyCode style, which used to be called Pep8, that I use all the time and love.
And one of the examples that I thought was great was, let's say you've got a library with some functions that you decide that your team uses, but you decided some of them are dumb and deprecate them. Yeah, or maybe there's a better way to do things. You can add some of these rules to Belly Button to say, hey, this code here, you need to change it this way.
And actually give exact examples of how somebody should change it. And I think that's a really cool idea. Yeah, awesome. Belly Button. I wanted to bring that up. Yeah, it sounds really cool. These linters are really great. And I typically think of them in the context of, like, continuous integration and sort of team-wide things.
But, yeah, here's a cool way to sort of make your own overrides and whatnot. Yeah, and any time where you've got, like, a coding style within your team, if you can automate it and take the person out of it and take that out of your code reviews, it helps with team dynamics to just have the computer say, hey, change this code instead of having your coworkers keep telling you to change your code.
I don't want to keep opening up the discussion. So, just, you know, do it. Nice. Manager speak. That's right. Cool. All right. You ready for Notebooks Galore Part 2? Oh, more notebook news. Yay. Yes. So, our friend, our friend of the show, Daniel Schorstein, posted something on Reddit, some news that has to do with free hosted notebooks in Azure, right?
This would be, like, pretty much a direct competitor to Datalore, right? So, they are now supporting Python 3.6 Jupyter Notebooks in Azure. And there's a nice conversation over on Reddit about that. And you go over and read more about it and so on. So, they have, basically, if you just drop in on notebooks.azure.com, then off you go.
You can go work with it right there. And that's, like, straight up Jupyter Notebooks, I believe. That's pretty cool, right? Free, in the cloud, powered by Jupyter. Like, I'm telling you, this is, like, a space that is just, like, so blowing up right now. Yeah. We better pay attention to it more if people are fighting over it.
Exactly. There's big companies fighting over it. So, speaking of big companies that want to fight over it, have you heard of Co-Laboratory? No. A great word, though. It is. So, this comes from a research, the research group at Google, colab.research.google.com. And people, this has been around for a little while, and people have been kind of dissing on it a little bit because it had been just Python 2.
However, it is now Python supporting, not legacy Python, but modern Python. So, that's really cool. And since the time that I took this note to talk to you about it today, and today, they now have also launched GPU support. So, you go to your notebook, and you say, I want to do some machine learning.
But it also enables you to use text editors, terminals, data file viewers, and, like, all sorts of other stuff that's not just in the notebook. So, you could, like, SSH in and do stuff behind the scenes or something to this effect, right? So, they've got some cool pictures. Like, they have – it's almost like this crazy web IDE.
So, you've got, like, your files on the left. You've got your standard notebook with graphs in the middle. And then on the right, you might have, like, a map, a couple of JSON files, and a CSV in, like, an Excel thing all in the same window. Okay. Well, that's neat. Yeah. And you can build, like, extensions and plugins.
So, like, that CSV thing, it's probably, like, a JupyterLab extension. Nice. So, yet another really cool thing going on there. And I guess the final piece, a tip, maybe from the very first one from this segment is, Daniel said, one thing that can happen is when you log into, say, like, the Azure notebook, some of their dependencies are a little bit old, like Pandas or Matplotlib or something like that.
He shows you how to import pip and then execute pip inside your notebook to force it to upgrade the dependencies in your project. Oh, okay. And it's good that you put – you're going to put the snippet in our notes. Yeah, the snippet is in there. But you can basically – it shows you how to, from code, run pip to upgrade stuff, which I think is interesting and useful outside of just notebooks.
But it happens to be, like, if you don't get a remote into them, to the servers, you still want to upgrade stuff. It's pretty helpful. Yeah, nice. Cool. All right. Whew. That's a lot of notebook news. We'll probably have more next week. Probably. Probably. It's really cool, though, to see so much innovation and creativity around this stuff.
So it's kind of a paradox of choice problem going on. Like, if I wanted to get started, what the heck would I do? But there's a bunch of good options here. Definitely. Awesome. All right. You got anything extra you want to let everyone know about this week? Just that maybe I should spend more time paying attention to Jupyter.
But other than that, no. Yeah, Jupyter is pretty cool. Jupyter Labs is exciting. Collaboratory is exciting. Notebooks on Azure is exciting. Data lore is exciting. Yeah, I'll have to pay more attention as well. Do you have any news? No news. Well, when this episode goes out, there's a very good chance that I'll be at PyCon Slovakia.
Thank you for listening to Python Bytes. Follow the show on Twitter via at Python Bytes. That's Python Bytes as in B-Y-T-E-S. And get the full show notes at pythonbytes.fm. If you have a news item you want featured, just visit pythonbytes.fm and send it our way. We're always on the lookout for sharing something cool.
