Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
This is episode 170, recorded February 19th, 2020. I am Brian Okken.
And I'm Michael Kennedy.
And this episode is brought to you by DigitalOcean. They've got something cool we're going to share
with you a little later. But first, tell me about whatever you're going to tell me about first.
I want to kick things off by building a picture for you. A picture of something awesome and yet
something fairly complex. The Python visualization space. I don't know how you feel about it,
but whenever I think, oh my gosh, I gotta go make some cool pictures and do neat things with Python,
I'm like, matplotlib, bokeh, py, py plot, what else should I learn? All these other things.
And then if I want to do this graph, there's a lot of stuff out there. So Price and Daniel sent across
a website, a resource for anyone who feels like me and says, ah, there's like kind of an
overwhelming sense of all the things happening. And this is called PyViz at pyviz.org.
And basically, the idea with PyViz is they've categorized and mind mapped all the things around
Python data visualization and they've grouped it into different stuff. So the way they describe it
is they say it's an open platform for helping users decide on the best open source Python data
visualization tools for their purpose with links, overviews, comparisons, examples, and tutorials.
That's cool.
Yeah, sounds good, right? So they have different sections that you can go check out. Overview of all
the packages, which is like a nice visual graph relationship thing. High level overview of the
tools, a live table comparing maturity, popularity, and support. Also a special focus on building
dashboards that are like interactive web things that people can interact with for scientific
visualization for rendering embedded three-dimensional objects. And like I said, some tutorials and
examples. Also some of the examples talking about like, if you have this kind of data, here's how
you visualize it. What do you think?
Yeah, I like it that the subset is still a lot of work if you know what you want to do and you still
have to try to figure out what you want to do with it. But at least it's broken it down into
just a handful of things that you have to figure out.
Yeah, absolutely. Well, it doesn't entirely alleviate the challenge of this. But like,
for example, if you go to the overview section, you can see there's three main sections, JavaScript,
matplotlib, and OpenGL. And that might sound like, I thought this was Python. What's up? Like these are,
I'm going to work with Python and get the outcome as a JavaScript thing on a web page or something I can
get into matplotlib or something I can get into like an OpenGL window for interaction and whatnot.
So yeah, there's a bunch of stuff here that you can work with. But I think it's interesting to see the
relationships as well.
Well, we had a visualization thing that we used at work that we had originally done a JavaScript side one.
And I think that we're going to switch and go back to a matplotlib side, mostly because it's whether or not it's
happening on the front end or the back end. That's a division that we have to make, made that decision.
But you know, it's only software, you can change it.
That's right. It's not concrete.
Yeah, just get another intern.
Indeed, indeed. All right. Well, I definitely am going to make use of this site if I've got some
visualization to do. And yeah, there's a couple of things I'm really would like to up the sort of
reporting exploration game for both the course side of things, understanding what users are up to,
but also for the podcasts, right? So we can understand how our listeners are listening a
little bit better. So I'll see what I can do around that for us. It might involve one of these.
Yeah, that'd be cool. I'm intrigued by the breakdown of some of the dashboard ones.
Yeah. Would you say that that project's awesome that I was thinking about?
I think so. Yeah. It's probably going to be an awesome project.
What else is awesome?
Oh, well, Zen is awesome. I actually like a lot of these. I have to admit it,
I like the awesome sites, the collections, awesome collections of different things,
usually thrown up on GitHub. And this one's also on GitHub.
They're usually more concrete, though. They're more like awesome async servers in Python or awesome
web frameworks.
Right. But we want to be a little reflective here. We've got a rabbit hole of Zen with
the awesome Zen of Python. Yeah, I was trying to make a bad pun of a rabbit hole lot of Zen.
So anyway, so the Zen of Python is a thing. So you import this and you see it. And we've covered,
I think, at least one article talking about that. But somebody put together a collection of articles
and video and talks and some other things about the Zen of Python, because people have thought about
it and written about it. And I like it. A couple of things I wanted to point out. Al Swigert has a
nice one that's a Zen of Python explained. It's a really quick reference. If you're new and are
curious about the Zen of Python and you read it and you don't quite get what the heck that is,
I think that he did a good start. I'll probably get his name wrong. But Moshe Zetka has a meditations on
the Zen of Python, which is probably a longer couple paragraphs per item, a little bit longer,
but I like his take on it as well. And one of the things I just learned recently is that there's a
reference to the increment and decrement operator within the Zen of Python, or not the increment and
decrement, but post decrement and pre decrement from C is like something that trips up C people.
There's actually a joke embedded in the Zen of Python about that.
How nice. Yeah, if it has to be an interview question about what incrementing a variable does,
it might be too complicated.
Yeah.
What happens if you test if, you know, plus plus X of this thing or whatever, right? Like that's,
yeah, not good. So although I do wish Python had a X plus plus, you know, sometimes I could go.
Yeah. Just an easy increment or decrement operator would be good, but we don't need two.
No, that's right.
I got to admit, I read in the, now we're getting down the C world in a for loop. It's recommended
that you do a pre-increment because there's a little bit of savings on complex objects to do
pre-increment, but give me a break. It's I plus plus at the end of a for loop. I always do that.
Yeah, it is. Definitely is. So I'm glad Python doesn't even have a for loop.
We have for loops, just not the same.
Yeah.
For I equals zero.
Yeah. Pretty sweet. Yeah. No, this is a cool art, the cool find here. I like this.
The Xenopython is something that's frequently spoken about, but it's very terse and there's
not a lot of explanation about it. So, you know, it's like one of those things I remember being
new going, Oh, the Xenopython. How cool. What does it mean? You know what I mean? Like,
could I get an example for each line, please? It would be nice. You know?
Yeah. I'm also including a link. I think it's important to read the Xenopython as a joke
and here's why. And it talks about a few aspects of it as to basically don't take it too seriously. And
Python is a language that you're really not supposed to take too seriously. Yes, it's serious. We can get
a lot of work done, but don't get freaked out on stuff.
It's named after Monty Python after all. Come on. Yeah, exactly. Lighten up people.
You know what else is awesome? Kubernetes. Kubernetes and DigitalOcean.
And DigitalOcean, yes. Yep. So there is an enormous amount of material on the web about
Kubernetes available both online and in print. So the DigitalOcean community realized that it's a
little, you know, you might have trouble figuring it all out, even though there's a lot of information.
So they developed a Kubernetes for full stack developers course to provide a thorough,
well-maintained and approachable reference set of tutorials for anyone who would like to start
learning about Kubernetes. And if that wasn't cool enough, they also realized that some people don't
want to take courses. They want to read about it. So they compiled the course curriculum into an ebook
to make it available for more people. So you can see that if you go to pythonbytes.fm
slash do dash kube and you can download the book and visit the course. And as always, you can visit
pythonbytes.fm/digital ocean to get a hundred dollar credit for new users to build something awesome.
I think we should just keep rolling things that are awesome. Yeah. Yeah.
So Matt Harrison inadvertently recommended this next item to us.
Really?
I mean, like very indirectly, but he did. So he posted on Twitter how he is absolutely loving
jupitext. J-U-P-Y-T-E-X, jupitext. And I didn't even see it on Twitter. No, Twitter emailed
me a summary of popular tweets, which said Matt Harrison liked this. So thank you, Matt.
Interesting. Okay.
Okay. So Jupyter Notebooks are awesome. They're super cool for exploring data and they're really
powerful for people who are doing like more exploration rather than writing software, right?
You can run the first bits. They might take a while, but then you can slice and dice stuff
to visualize it and explore it as much as you want. However, they're not all the way awesome
because if I put one of those things into say GitHub and you were to check it out and I were
to be messing with running it and that was getting like live data. So non-deterministic results and
you did the same and then we both put it back. It keeps like those results and stuff. And it's not
very friendly in Git, right? Another thing that would be nice would be sometimes you want to
explore stuff in Jupyter, but then productize it, turn it into like a script of its natural language,
right? It supports a bunch of languages now. It would be nice to be able to go. And here's the one we run
where the comment, the text becomes comments or whatever. So basically that's what JupyterText
does. It will take Jupyter notebooks and turn them into markdown documents or Python scripts.
Wow.
And then you put those in source control or whatever, right? You can work with those.
So you could then export it out and work with it in like PyCharm or something like that. You also get
meaningful diffs of what changed when you look at the differences of those. So this thing's really cool.
You can export the Jupyter notebooks in all these different script languages. Currently it supports,
ready for this. Julia, Python, R, Bash, Scheme, Clojure, MATLAB, Octave, which is the open source
MATLAB, C++, UKDB+, IDL, TypeScript, JavaScript, Scala, Rust, PowerShell, C#, F Sharp, and my favorite
behind Python, robot framework.
Nice.
I just want to work in the robot framework. What language did you know? I know, robot. Oh, really?
Cool.
Yeah. Anyway, people who are working in Jupyter notebooks, this looks super helpful. And
Matt, thanks for having a popular tweet that got emailed to me.
Yeah. So can you do Scheme in Jupyter?
You must be able to.
You must be able to. I did Scheme as my CS101 course.
Yeah, me too.
And I did a couple of CS courses.
And I'm not a fan of all the close parentheses, to be honest. I'm like, what a crazy language
this is. But yeah, apparently you can.
Nice.
I guess I would rather do that over like, rather than through like an X term or whatever.
But yeah, apparently you can.
Nice.
Pretty cool. Anyway, so if you work on the Jupyter notebooks and you want to be able to export
them in these cool ways and do other stuff as well, check that out.
Well, one of the things I want to talk about is stuff that we iterate over.
Okay.
This is a failed attempt as a transition.
So a great article called a tour of Python iter tools and iter tools is one of those things
that you kind of, it's so cool, but you kind of blast past it when you learn it. And you,
when you're learning Python, it's a little bit, a little bit more advanced than you want,
but this is cool stuff. This article is by Martin Heinz and he's just kind of briefly
describes what handful of the different tools within iter tools and a library called more iter
iter tools does. And all of these are around iterables and iterating over things.
And you wouldn't think right off the bat that you could do so much, but I'm going to highlight
a few of these, not all of them for iter tools. He talks about compress, accumulate cycle and T.
And I had not been familiar with cycle and T, but they're pretty cool. So iterables,
some of them that they like they're empty once you go over it once and T allows you to make
multiple references to one interval. That's pretty neat. And cycle is so cool. It allows you to like,
so you, if you iterate over like say a set or a list of items, you can just iterate through it once,
but cycle allows you to just keep going over and over and over again. It's like a never ending
repeating iterable. And, the little example in the document or in this article that shows you how to
easily iterate through characters to make a never ending spinner on a command line. So it's kind of
fun.
Oh yeah. That's cool. Yeah. You just put the, the different ones and a list and then you just cycle
it.
Yeah. The note is that like for things like games and stuff like that, if you iterate through,
through different players, you might have to do that. But there's a lot of cases where I want to,
like maybe zip through a couple of lists, but I, it's really just a site. One of the lists is a
cycle. You can kind of do that. It's cool. More iter tools has a whole bunch of things like he's
highlighting different things that are different ways to chop up your iterations. Like there's a
divide that just divides it into different sub iterables.
Like paging almost, right? Like process them 25 at a time or something.
Yeah. So there's a whole bunch of different ones. Like in partition is like, if you have a,
an expression to that can be mapped to true or false on any of your elements, it'll split the,
the interval into two intervals based on that predicate, which is pretty cool.
A side effect that I never knew about. So if you want to add another, another function
that gets called with each element during iteration, wow, this is cool. I think that's neat.
I don't know what to use it for, but I'm going to come up with a use. There's a bucketizing to be
able to do a bunch of buckets, map reduce, just a whole bunch of neat things. And I think this is a
good, if you think you, you've like sunk your teeth into Python and you want to like take it to the next
level, this is a good article to, to learn iter tools.
This is a super interesting and iter tools is definitely one of those things where you feel like
I'm always surprised that there's extra stuff. Collections as well. You know,
it's just like, wow, there's also that thing. Why did I not ever use that thing? You know,
there's some things about programming that I know some people say they'll, when they come to a problem
and they need a solution for it, then they'll look up. That's how they learn new things. But you're
right with collections and iter tools, you don't know to look it up because you don't know there's
a solution there. So these are good things to like skim through so that you just have seen them once.
So that later when you run into a problem, you're like, oh, there's a thing in iter tools that I can
use for this. Yeah. I know that that's true even before I look, but I don't know what it is.
I just know if I go dive around in there, it's probably something I can use at some point.
Yeah, that's a cool one. And it's nice to see it put together and highlighted like that.
I just really want to talk about this next one. Okay. Okay. All right. So this next one is called
JustPy. And the idea is I want to create a web application that allows me to do single page
app, cool, interactive, front end framework type stuff that I would do with something like say Vue.js,
but I don't want to write JavaScript. So it's pretty interesting. It's a web framework that lives on a
server. So you put it on, you know, your standard, it actually supports async stuff. So you'd put it on
like a async server, like Starlette or something like that, or UVicorn. And then you express how the pages
are supposed to look in Python. And it creates the JavaScript that's going to make that happen. And then
you're going to create, I guess, web sockets or some form of back and forth back to the server to run your
Python code as people interact with it. Okay. Using effectively like Ajax type of interaction. So yeah,
it lets you create these front end and, you know, sort of full stack web apps with no front end programming.
And the way it works is like I said, it has no front end back end distinction. All the programming is
done on the back end, allowing a simpler, more productive way and more Pythonic way to
create a web app, but it intercepts the relevant events on the front end and sends them back to
the back end to be processed, either talking to a database or just like having the Python logic there.
Neat. Yeah. It's a really, really different take. And it's been getting a lot of traction.
My personal thought on it, the verdict's a little bit out. I'm not sure how I feel about it,
but I definitely think it's interesting and people should check it out to see what they think about it.
It's really based on like classes and components. So you can create these components,
which then can be put onto the page. So like here's a login component or like a
component that displays a list of podcast episodes or whatever. You can put those in different places
and you can create these custom components and they can either be just straight Python where you
create kind of the DOM in Python. That's part of the, if it was more HTML based, I'd be happier,
but it does also support HTML components that then work with it and even has like interactive
charts and grids. So that's pretty cool.
Yeah. I see what you're saying. It's kind of neat, but also if you don't want to learn HTML and
JavaScript, learn this instead.
Yes, exactly. It's kind of like that. It's like too much avoiding HTML. I think it's awesome that the
logic of it is in Python and this, this no distinction stuff is really cool about the front and back end.
I just wish I would design the site in HTML and CSS and then plug in the liveness through this, not as much of the content definition.
That said, Quasar, I suspect many listeners are not familiar with the Quasar library, but the Quasar library is a cool library that's got all sorts of stuff built on top of Vue.js.
So their little slogan is build high performance Vue.js user interfaces in record time.
So you can see they've got like, think of kind of like what Bootstrap did for web design is kind of doing that for Vue.js, right?
You get some like cool stuff going on there. And the reason I randomly diverted sideways and started talking about Vue.js and Quasar is because JustPy is built on libraries that you would know.
So Starlette and UVicorn for the server side, but Vue.js for the front end, that means the Quasar library automatically plugs in its components and functionalities into JustPy.
So that gives it like actually a huge boost. Like, oh, there's already this really cool library that just plugs into it.
Oh, nice. Okay.
That gives it a boost. But yeah, I wish you could define more stuff in HTML and then bring it. Now you can say like, here's an HTML page. I'm going to import it and like work with it. But it's not, it doesn't seem to be my first reading that that's like the natural way to go.
Yeah. Okay.
But nonetheless, I love that this exists. It looks really interesting and people should check it out.
Nice.
Nice. I wonder what the maintenance story like is around it though.
Yeah. I'm curious. So we want to talk about maintenance and I'm not sure why this article is titled modularity for maintenance.
So modularity for maintenance, it's a bunch of automation tools that you can use to help maintain your open source projects.
And it's really terse with links, but it's got continuous integration and talks and linting tools and type checking and dependencies and security scanning and using code coverage and formatting help and releasing and all these automation tools that help you, which is actually, it's really cool to have all these listed down in one place.
And I like that. If you've done all this for a bunch of projects and then you start a new project or maybe you split one project into two projects, just the overhead of making, setting all that stuff up again for another project is in itself a lot of work.
So he's hoping for somebody to make so that you can save some time. But all of us also, I never really thought about all of these time-saving things you actually end up having to set up again for each project.
Are they actually saving you time?
Yeah, right.
It depends. It depends how long you use the project. Probably they are, but yeah.
Probably. But I guess it is interesting to think about the extra overhead and you have to have some of these require login credentials and stuff that you have to set up.
But actually, I really like all this list and I kind of want to go take one of my projects and see if I can make sure I'm hitting all of these things.
Yeah, it's super cool. And I just last night used Cookie Cutter, the new Python package template from Cookie Cutter to create a Python package that I'm working on.
So yeah, this is super real. I'm like, oh, I bet there's a Cookie Cutter thing to set up like the setup file just right and integrate talks and whatnot. And yeah, let's hit it with that.
Where was this new Cookie Cutter thing?
It's not super new. If you go to Cookie Cutter, there's like a place called, a park called Pantry Full of Cookies or something like that. Let me go. I'll pull up it really quick.
Under the documentation on cookiecutter.readthedocs, there's a pantry full of cookie cutters. And then the first four are for making packages.
So there's Audrey's ultimate Python package project template creator thing. There's a minimal package for pip installable projects and a couple of others. The one I used was the second one, I believe.
No, third one. I don't know. I can't remember anymore. And it was on a different computer, so I can't get to the history of it.
Okay.
But yeah, anyway, these are really cool because basically it sets it up. I used the one that was the minimal, PyPackage minimal. It automatically sets it up to work with pytest.
And it has the setup Py all generated based on what you tell it and stuff like that. It's pretty cool.
Okay. Well, okay. If it's not using Flit, I don't know if it's really minimal.
But the thing is, it doesn't have all these things that Glyph's talking about, right? It does have Travis CI integration in there.
But there's a lot of things that it could be added, and it's pretty neat. Somebody could fork that and then make it.
Yeah, I definitely think so. So, yeah, hopefully.
Yeah. Nice. All right. Well, I guess that's it, huh? What else we got? What do you want to let people know about?
Here's a quick one. Not really big enough to warrant a whole topic, but I noticed Sentry is helping to fund some open source projects.
They got some money from somebody else. They decided to match it and pass it along.
And they're going to help fund Black, PyPI, pytest, StructLog, and a Rust tool called Gimli.
Cool.
And that's pretty neat. I like the... Actually, I haven't played with StructLog too much. I've played with it a little bit, but all the others I use all the time.
Oh, yeah. Very nice. Yeah. Sentry, a nice open source-based company. Funding open source. Pretty nice.
The circle of life. Except for Sentry's not eating any of these, but other than that.
Nice. Okay.
Thanks. All right. A couple of quick announcements on my end. Just launched a new course, Python for Absolute Beginners.
So this is like, hey, I didn't take CS at college. What the heck is all this stuff about when people talk about memory allocation and variables and data structures, but actually really getting started with Python.
So that's a super fun one. People can check that out. Build a lot of games, but learn a lot of Python.
And then also related on Talk Python training, started streaming a couple of our latest courses where possible, including this one I just announced, is high DPI.
So almost 4K streams, and it's like night and day. It's so awesome to sit there and look at the screen and go, that is like as if I'm looking at a real monitor.
Just back in time.
So anyway, I'm trying that out. Hopefully, so far it's been working well for people, but if for some reason it doesn't, people can send me a note.
Here's an interesting one that comes from Anthony Sotili.
Amazon Web Services has decided to no longer publish AWS CLI, their package, AWS CLI, to PyPI, pulling a 700 million download package off of PyPI.
Think of all the bandwidth they're saving.
That's weird.
So this is not their Python library, potentially.
This is the CLI tool that people who don't even do Python would use.
Right.
It's just implemented in there.
So it's not a huge deal.
It's not like a giant, oh my gosh, what's happening to the world sort of thing.
But it's also strange.
So what's more strange is I'm linking to Anthony Sotili's Twitter thread that talks about this, but then that links over to GitHub where there's more conversation.
On one hand, it makes sense, right?
Like, why use pip to distribute a library that is not specifically for Python developers?
But the other bit is, well, the replacement's an unversioned zip file of script.
So I don't know which is better.
It's a little bit funky.
And then finally, people might have noticed some weirdness with the podcast.
I don't know what has gone on, but something happened.
I think it was at Apple.
On Talk Python, it all of a sudden started showing four episodes, some from three or four years ago, as the latest.
And you might say, well, maybe something changed in the database and the dates got wrong or the number.
Like, we changed nothing.
Didn't change the RSS feed generator.
We didn't change the data.
It just all of a sudden started going crazy.
And my theory is they've put some kind of limit on the size because we were shipping like 2.5 megs of XML for each request, especially for Python bytes because the show notes are large.
And I think it just went like, no, but its response to no was just to do something really weird.
So on Python bytes, we now are showing just the last half year because the alternative was to have things massively broken in the RSS and the podcast players.
So if you want the older ones, they're still available on the website.
We're not doing anything like that.
But this was the fix that I had to put in to get things to work again on the teams.
I don't know what happened.
I think it's a fair tradeoff.
Yeah, I do too.
And also, like, it means stuff refreshes faster for people.
They're not pulling 2.5 megs, like, all day long with their podcast players.
I don't mind on the web server, but for them, they might mind.
Yeah.
They don't pull it all unless they download every episode or something, right?
Well, it's constantly pulling that 2.5 megs over and over and over, right?
Like, if you pull up the tail of the web server, it's just going toom, toom, toom against that over and over and over.
Then it pulls the actual episodes it finds that are different.
Oh, right.
Okay.
Got it.
Yeah.
But it's hitting the full-on RSS.
So now the RSS speed is like 250K, which is still pretty big, but it's not 2.5 megs.
Oh, yeah.
Sounds smaller.
Are you a fan of physics, Einstein, relatively?
I like gravity.
It's good.
Yeah.
And you're also a fan of software quality.
Yep.
As most software people should be, I suspect.
But did you know that E equals MC squared is-
I have heard that on t-shirts before.
It's a statement about programming, really.
I didn't realize Einstein was into this, but it's about, like, testing and code quality and bug rates and whatnot.
How?
Because E equals MC squared is errors equals more code squared.
So as you add code, the errors increase at the square of the amount of code, basically.
And that seems not totally untrue.
Yeah, that's funny.
But yeah, you're right.
It's sort of kind of true.
Yeah.
I'm not sure if it's the square or it's, like, 1.5 or maybe it's, like-
It's definitely nonlinear, though.
You know, some polynomial, but it's nonlinear and it grows.
Yeah, for sure.
Yeah.
For sure.
Anyway, E equals MC squared.
That's the joke for the week.
First law of software quality, E equals MC squared.
Nice.
I like it.
Awesome.
All right.
Yeah.
Thanks.
Bye.
Thank you for listening to Python Bytes.
Follow the show on Twitter 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.
This is Brian Okken, and on behalf of myself and Michael Kennedy, thank you for listening
and sharing this podcast with your friends and colleagues.