Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to
your earbuds. This is episode 127, recorded April 24th, 2019. I'm Michael Kennedy.
And I'm Brian Okken.
And we have a special guest this week as well, Kenneth Reitz. Welcome to the show, man.
Hi, thanks for having me.
It's great to have you here. I wonder if requests will come up as a topic during the show. What do
you think?
Request three might.
The future of requests. How exciting. Awesome. Well, thanks for being here. It's great to have
you here. Before we get any further, I want to say thank you to Datadog for sponsoring this show.
Check them out at pythonbytes.fm/Datadog. More on why they're cool later. Brian, I feel like
WebAssembly, Rust, all these things are just, there's so many cool things going on around it.
And that's something you found for us to start off with, right?
Yeah, I saw this from a cool, actually a Twitter post from Mara Boss. I think it's Boss, B-O-S.
And it's an extension to Rust that's an inline Python. So if you're a Rust person and you need a
Python in there, you can just inline it as a, I think it's as a macro or something. I'm not a Rust
person, so I'm not sure how this works. But you can inline Python code, including things like
embedding a map potlib call to pop up a window. So it's pretty neat. I don't really have much more
to say about it other than neat. You can run Python within Rust.
I think that's pretty awesome. Yeah, quite cool.
I wrote something like this week, actually, for Bash in Python. So you can do inline Bash in Python.
So it seems to be a trend. People want to embed other languages in other languages.
That's cool. Can people get to your Bash thing? Is that a public thing?
Yeah, it's just import Bash or pip install Bash.
That's pretty cool. There's a lot of interesting interplays here. Brian, have I talked about
WASMR, as in WebAssembly-mer, before on the show?
I'm not sure.
I think that's going to have to be a topic. So there's all sorts of cool interplays between
Rust and Python these days. And like Rust, obviously, is big for generating WebAssembly.
So there's now a project called WASMR, which lets you... I think I talked about it last week.
I did, yeah. So lets you basically run WebAssembly in Python. And this is kind of like
the opposite.
Oh, really?
It's an interesting way. Yeah, yeah. So kind of like Node.js is the platform for running JavaScript
outside of the browser. Like WASMR kind of does similar stuff. It lets you take any WebAssembly
thing and run it in your Python code. You basically import the functions from it,
and then you call them in straight Python.
So do you have to do reflecting, where you know what the structure of the code looks like
when you import it?
I don't know. I doubt it gives you any help. But the way you interact with it looks like
Python. You don't have to do anything special beyond an import statement.
Okay, so you don't have to write C or anything?
Like a load statement. No, nothing like that. It's pretty much straight Python.
This is really cool, Brian. Yeah, I like this. Very nice find. Cool. All right, Kenneth,
what's your next one? You want to tell us about the future with your back from the past
microphone? Yeah, sure. I wanted to announce that request three is underway right now. We're doing
a development cycle at the moment. And I wanted to announce just some information about that,
basically. So request two, which is the thing that you know and love, is going to go into CVE
only mode, which is basically been for a long time. That's kind of the way things have been for
a couple years now. Does that mean like security fixes only or security fixes and bug fixes?
It means that if there's a CVE, like if there's a true security vulnerability, we'll fix that as soon
as possible. And if there's a, you know, any security conscious bugs that will will address those as
well. But you know, things like people suggest UI changes a lot. And it's just not going to happen
at this point. It's going to happen in request three, if you're going to awesome. So what's the story
of the request three? What do you guys what are the major features? Yeah, so the major features are
there's going to have async and await keywords. So you're going to be able to do asynchronous calls,
we're ripping out URL of three, which is unfortunate, because there's different approaches on how the
future of the project could unfold. And it's this needs to start happening now. So we're just taking
action and making our own library for making these low level requests. And we'll see how far along we
get with that. But there's we don't see any blockers that we can foresee at this point. So we'll have a new
core, if you will. And it'll be as a new namespace request three. So everything that you know,
that depends on requests, this is going to have backwards incompatible changes. But it'll be under
a new namespace. So you won't have to worry about that. You can have both installed at the same time.
Nice. And it's modern Python only, right?
Yeah, it's only Python three, six. And it has type annotations and all the public functions. So your
IDEs can get some nice code completion and stuff like that. I'm pretty excited about it. So that I
don't want to take up too much time now. So I guess we got to keep moving.
Well, we do. But I'm pretty excited. So I have one more question. So why three, six and not three,
five? Like three, five is fine for async and await. Did you do like different type annotations? Or
what was the three, six? Maybe f-strings?
Okay, F, yes. Right on. Brian, I still owe you a sticker.
They're really useful when you're writing a low level library or something that deals with a lot of
URLs. It's really nice to have f-strings.
Yeah, that's pretty cool.
I don't find it acceptable to use three, five. Like if you have three, six, even three, six doesn't seem to
be acceptable. I'd like to, it's going to be documented as three, seven only because like,
if you're going to be on latest Python, you might as well be on latest, latest Python.
Yeah. Yeah.
Right on. And by the time that that comes out, three, seven will definitely be easy, easy.
What's the timeframe?
Yeah. I think it'll secretly work at three, six and secretly work at three, seven, but I'll just say it works at three, eight.
I love it. Brian, you excited?
Yeah. I actually, I think, I think that'll be fun.
Yeah. I'm thinking of also ripping out the, the dot get keyword. That's the thing I'm torn about at the moment. Like the request dot get that everyone uses.
What would it, what it's going to force everyone to use session.
Oh, interesting. Okay. So you create a session and then you call get on the session, right?
Yeah. So it would be, it's called HTTP session now. So it'd be HTTP dot request is what I want people to do, but I'm still playing with the idea. So I'm, it might be not changed. We'll see.
Yeah. You could face some backlash, but yeah, it sounds good.
I'm willing to take it.
You got some tough skin. You've been on the internet for a while, right?
Yeah. Let's not go down that path. All right. So maybe you could even say that you've been in some flame wars.
So the next item I have is called PyFlame and PyFlame is pretty cool. Like if you want to know how the performance of your program or a certain library is going, you can generate what's called a flame graph for Python.
And what's really nice about this is it's super low overhead enough that you can even run it in production without like hurting your program.
So you could say, Oh, there's something going wrong with the website. Let me log in and attach, you know, PyFlame to it and see what's happening.
And then just break loose and go analyze that rather than, you know, try to simulate what's happening. So I think that's pretty cool.
We actually use this on the PIPAM team at one point to determine what, where our slow points were in, like how fast our boot up time is.
Yeah. And was it useful?
It was very useful. It shows you every single call in your stack and just shows you a graph over time of how much time was spent on each call and all the sub calls. So it's, it's great. I really like it.
Yeah. And the graphs are nice as well. They're pretty obvious, not just like a grid of numbers, like a spreadsheet, but you know, graphs.
Yeah. Usually when you hear someone talk about graphs that are generated from Python, it's like, you have to work with them all to make them useful. But this, these ones are useful out of the box, which I really like.
Yeah. Cool. Another thing that it said that it does, which is nice, has nothing to do with PIPAM in this feature, but it's capable of profiling embedded Python interpreters. So like, for example, in micro whiskey or G unicorn or some of these, you know, backend worker processes for web servers. So you can get in there and get that in multi-threaded stuff. So I think it's pretty awesome.
Brian, do you guys care about performance where you are? I mean, you're doing testing hardware, so it's not like users are directly interacting with it. Is it, is it, I guess not, do you care about it, but is it something you have to like worry about?
In my production stuff, the Python is not the bottleneck. It's the communication. So yeah.
That's a great response.
It's on the wire. It's not our fault.
Well, it usually is our fault, but it's usually an optimization of doing too many calls and reducing the communication latencies.
Right. Having a chatty API versus trying to bulk up the thing you want to ask it or whatever, right?
Are you working with a lot of microservices?
Working with test equipment. So communicating commands and retrieving data.
Yeah. That would take a lot of time.
Yeah. Brian tests actual devices with Python.
That's awesome. Oh, that's right. I knew about this.
Yeah. You test like, like phones and stuff, don't you?
Yep. That's awesome.
Yeah. Pretty cool. All right. Before we get onto the next one, which looks pretty interesting.
Let me just tell you about data dogs. So they've been sponsoring Python bytes for quite a while and we definitely appreciate them.
So there are monitoring and analytics service that lets you take all of your metrics and logs and tracing and whatnot across your services,
like microservices, like it's just said, and put them all in one place.
And it automatically instruments async libraries like asyncio and Django and tornado and helps you visualize all that stuff across the boundaries to find your bottlenecks.
Super cool. So check them out to get a free 14 day trial and a cool data dog t-shirt over at pythonbytes.fm/data dog.
All right. Thanks data dog. Brian, what do you got next?
This was going to be one of my extras, but I thought I'd just discuss it because I was curious what you guys thought.
So flit is, I really like it. It's a little package that allows you to quickly build a pipe project.tomo file and a license file.
And basically, you know, if you've got a module that you want to share with somebody or a package that's just a source package,
it's just a few commands to try to get it into a wheel form to so you can share it.
And it even does publishing within it.
The one thing I didn't like about it is it didn't support source directories.
And I like source directories in my packages.
So I did what you can do with open source projects is I submitted a pull request.
So just submitted this last night.
I've been playing with the corner cases today and there's still some I'm listing it as a work in progress because there's some corner cases that still need tested and probably ironed out.
But I don't know. We'll see. We'll see where this goes.
Did you make it so it's configurable to any directory or specifically SRC?
Specifically SRC.
Okay, cool.
It doesn't break any of the other.
So really right now it used to have two kinds of projects, just a module or a package with a name.
And now I'm just adding those two within a source directory.
The old mechanism all works. It's just extending it.
Yeah, Flet is a little bit like a combination between Twine and Cookie Cutter a little bit.
Like it's far reduced in scope from Cookie Cutter.
And in Twine, all it does is publish things, publish wheels for you.
And that's the tool I typically use in my workflow.
But Flit is a great alternative if you don't already have your setup stuff built out.
I think Flit is like a great first tool to go for, especially if you don't have those files already written.
Yeah, that's awesome.
Yeah.
Well, hopefully people like it.
I mean, it's out there, the PR, right?
They could merge it.
That's pretty cool.
Yeah, so hopefully.
Hopefully they'll put it in.
Otherwise, you can't use it on your project.
You'll have to succumb to our side where you don't use source.
Well, I could fork it.
Yeah, you could.
But I don't really want to support it.
So I'm hoping that...
Call it Slit.
Yeah, you don't want that puppy.
You don't need another thing to take care of, right?
Yeah, that's a good name though.
She's going to do it.
Awesome.
All right.
So speaking of packaging and things that we've talked about and things we're like, I'm a huge fan of PipX.
I think PipX is really killer.
Yeah.
The way it works.
I've run into some issues with Homebrew in it, but I'm going to put those aside for a minute.
Also, PipInf, tell us the story here.
My endorsement is also with this flag, which is I've run into some issues and I'm not sure what they are yet.
So it appears as though PipX is great.
And what it does is it just creates a virtual environment and installs binaries for you.
So it's like a Pipsy replacement or a virtual amp wrapper.
If you have like...
Sometimes people will have like a system virtual amp where they install their system utilities or they'll just...
They'll keep their system utilities in the system installation of Python and then they'll isolate their different projects into virtual amps.
This makes it so every single tool has its own virtual amp, which is really best practice.
So if you're using PipAmp, if you're using HTTP IE, if you're using anything pip itself, anything that's pip installable from the command line, you can install it easily with PipX.
And it does appear as though it has shims, so I'm not sure that it's fantastic, but it appears as though it works pretty well so far.
And I really like that it supports multiple binaries.
Yeah, I do too.
It's quite nice.
And to me, it feels like homebrew, but for Python executables.
Like it's not necessarily for managing stuff for your project, but for stuff that is Python based that you just want to run, right?
Like I want to, I don't know, run Glances or Cookie Cutter or something like that, right?
Or PipInf.
Exactly.
And it gives you a nice isolated environment in which to install that.
And some of these, like PipInf has like some 50 dependencies or something crazy.
So it's really good to have an isolated virtual environment for that.
Because in Python, you can't install multiple versions of a dependency like you can in Ruby.
So that's why we need to do this, basically.
Yeah, cool.
Well, I definitely like it.
Yeah, that's the end of my endorsement with the asterisk afterwards.
Yeah, I love it.
The problem that I ran into, the only problem I ran into was when I installed Python 3 through Homebrew and then Python 3 got upgraded by Homebrew.
It had lost like the symlink to where Python was in all of the virtual environments that it had created.
Oh, interesting.
Yeah, yeah.
So when I basically, when I upgraded Python, it like lost track of what it was up to.
So I just had to like re-PipX install everything.
There's maybe another way to fix it.
But that was what I did.
Because all the virtual environments it manages seem to have gotten whacked.
Yeah, Pip-Am does that too, where it'll break.
All your virtual environments just break if you upgrade your Python underneath it.
So.
Yeah.
What do you do to fix it?
You know better than I do.
I just delete them all.
Okay.
So even you have the same fix as I do.
Did you try turning it off and on?
How many times?
Three times.
I always do it three times.
I would like to automate that so it does it for you.
Like, you know, it has a message like, oh, you appear to have upgraded your Python.
We're going to clean it up for you.
But, you know, there's limited time.
Exactly.
Quite cool.
All right.
The last one.
Kenneth, I think you'll like this one because it has to do with requesting things on the internet.
And I don't know how to say this.
I'm guessing cheat sheet.
Cheat.sh as a domain.
Okay.
So this is a, an interesting like cheat sheet for getting started with Python or bash or whatever.
And the way it works is you send it curl requests or send it HTTP py requests on the command line to ask it questions.
Okay.
So you can go over there and say, like if you have HTTP py installed, you could say HTTP space CHT.sh slash Python.
That tells you you're talking about Python.
Then you could say slash sort plus list.
And if you run that, it will tell you, oh, here's a Python example of how you sort a list.
You create the list.
You say my list dot sort.
You set the key to like string dot lower or, you know, whatever you want to sort.
If you like say you want to sort alphabetically, but without concern of casing, things like that.
So you can ask it arbitrary questions like cheat sheet dot slash Python slash connect to database or something like that with a pluses in there.
And it'll like tell you, oh, here's some ways you can do it.
Like with SQLite.
Let's see what it says for this one.
Oh yeah.
Here's a little example of how I use PeeWee to open up a pretty little class and do ORM stuff to it.
And just, it's pretty, pretty funky, pretty interesting.
And then you can ask it questions like how to get started with a colon learn on any project.
Like how do I get started with Python?
And it'll tell you in its little way.
It's pretty sweet.
I think funky is the right word for this.
It's different, right?
So it's like Google, but harder.
Yeah, basically.
It's slightly more deterministic.
Yes, but it has integration into Visual Studio Code and Vim.
Oh, nice.
Which is interesting.
And then you can also, like you can install a client and put it into stealth mode.
So like if you're doing an interview, anything that you select in a text box, it will start like on the side printing out its response to that.
Okay.
So if like you're in a chat window.
I'm looking at the readme and he really takes this very seriously.
It is.
He says ultra fast returns answers within 100 milliseconds as a rule.
So like he's definitely making scalability concern.
So I think this is like a really fun production project.
I think so too.
And it doesn't use its own data sources.
It uses other community driven repos for different topics.
And it tries to pull those in.
So it's not like it tries to be the answer.
It tries to be like a facade front end API to the answers.
So it has sources that it gets them from.
I'm interested in seeing that part.
Yeah.
It's pretty interesting.
So I just want to give a shout out to John Boltmeier.
He sent this in a while ago and, you know, I thought it was fun.
So I thought I'd throw it out there.
And he also has clipboard integration and tab completion support for Bash, Fish and ZSH.
I know.
I mean, this is in depth, right?
Like you can really go all out with this.
Yes, you can.
All right.
Well, that's it for our full major topics.
But I'm sure we'll have a couple of extra things to throw out here real quick.
Brian, you want to start us off?
So you guys were giving me a bad time about being a VI person last week.
So I thought I'd throw in an article about VI is good for beginners.
It's just a fun read for anybody that thinks that VI is terrible.
Do you use Vim, not VI?
I actually use PyCharm right now with IdeaVim.
Yeah, this is an interesting contrarian sort of take on the simplicity is good for you.
Yeah.
Myself.
I think it's a good thing to learn.
I did a presentation last week with a Jupyter notebook.
And one of the things I needed to do was to quickly make sure I cleaned out all the output of a bunch of notebooks.
And I found this tool called the NB strip out.
And so I wanted to drop a link to that.
It's pretty helpful.
Yeah.
It's just a command line thing.
And then we had a bunch of people, a couple of people, including Cecil, mentioned Pyodide.
But we did cover that in episode 93.
But there was a recent article written up about Pyodide that's kind of neat.
So I'll drop a link to that in the show notes as well.
I'm super excited about Pyodide.
I actually just yesterday interviewed Michael Drotboom, who wrote that article you're referencing here and worked on the project on Talk Python, going deep into WebAssembly and what Mozilla is doing with Pyodide stuff.
So it's, yeah, it's super cool.
Kenneth, have you seen this, Pyodide?
I'm looking at it now.
So it's like all of the scientific Python stack in WebAssembly?
Yes.
Including the libraries like NumPy and Matplotlib and stuff like that.
That's awesome.
Not just like CPython.
That is not unimpressive.
No, it's not.
It's quite something.
That's awesome.
Let's see.
I guess I'll start mine really quick.
I got some quick conference announcements.
Kenneth, I see you do as well.
So PyCon Australia just opened their call for proposals.
So Australia is a beautiful place to be.
Either maybe you're already there and you just want to go to the conference or you want an excuse to go to Australia.
Submit a talk.
That's awesome.
And then last time I had used about whether the gravitational waves of black holes colliding.
That research was also done with Python.
So remember we talked about the black hole picture and all that stuff, Brian?
Yeah.
Well, our listeners are awesome because they're like, oh, Michael, did you wonder about this?
Yes.
Here's the package they use to discover gravitational waves and do all this amazing science.
So actually, there's some really cool projects out there.
And I'll link to a video of someone talking about it.
So thanks to Dave Kirby and Matthew Feikert both for that.
And I think it's GWPy.
Yeah.
GWPy.github.io is a Python package for gravitational wave astrophysics.
So detecting when black holes collide and the ripple in space time they make with Python is pretty awesome.
Yeah.
I was really surprised to find out that when that code was made available that a request was used for it.
That's so awesome.
I have no idea how.
It doesn't matter.
It's awesome.
But it's in there.
So I was like, yes.
That is super cool.
Congrats, man.
And then finally, another thing that's awesome about our listeners is anytime we mention something, we think it's unique.
They're like, there's four other ones.
Here's another one.
So Bullet, we talked about.
Cooked input.
We talked about.
It's awesome.
Bullet is super cool for like drop downs inside terminal windows and like nice selections.
But it doesn't work on windows.
So someone else, Sander Tunison, sent over questionnaire, which is one that is also compatible for windows, for our windows folks.
Thanks for putting that in because I need that.
See?
You were like the first, one of the very first people to benefit from this podcast.
I feel the same way.
Like people are like, oh, you finally, like I benefit from this just like you guys do.
It's just I have to get there first before we publish it.
Awesome.
Okay.
Kenneth, what do you got?
Honestly, I have a few CFPs I wanted to announce.
One of them is for Pi Colorado.
It's a great conference.
It's going to be their first year.
It's run by a great team, at least.
It should be a great conference.
If they are actively looking for people to submit to their CFP, they have not had as many submissions as they would like to so far.
Bad timing with the conference here.
They have a great team of people to submit, so if anyone has any talks that they think could be applicable to that event, please submit.
Pi Ohio also has their CFP open at the moment, and they're looking for people to submit, but they never have a problem with getting too many submissions.
So I wouldn't rush to that one if you're feeling iffy about it.
And then the last one is a PiCon remote, which is something that I'm going to be putting on if all goes according to plan with Calvin Spellingman, I believe is how you say his last name, who is from the Pi Tennessee organizers group.
Him and I are co-chairing.
That's cool.
What's that about?
It's basically a PiCon, but it'll be accessible to people who can't attend PiCon or who can't normally speak at PiCon.
Is it also virtual or only virtual?
Only virtual.
Okay, sweet.
That's awesome.
Yeah.
We're still figuring out what the feasibility of different approaches are, but it'll most likely be live streamed and people will send in videos ahead of time of their talks.
Okay.
Unless they're like a keynote speaker or something like that.
So we're still figuring out the details, but it'll be, it should be good.
We have a mailing list with like 700 people who have signed up so far.
So it should be, it should be something we can pull off.
So if you're interested and want to learn more, you can go to do slash co slash pi con dash remote.
I know it's not the best URL, but that's the best I can give you right now.
Awesome.
Yeah.
We'll put the link in the show notes.
People can just click it in there.
Their player.
That's awesome.
All right.
Well, let's round it out with some, some jokes here.
Brian, you want to go first?
We're not doing all the jokes.
All right.
We got to go fast.
Okay.
So yeah, I'll just pick one.
Uh, I don't know how tasteful this is.
We'll let it land anyway.
So Python used to be directed by the BDFL Guido.
Now it's directed by steering council.
Guids zero through four.
Love it.
Kenneth, you want to do one?
You got any,
what's the difference between a musician and a pizza?
I don't know.
You can eat a pizza.
Pizza can feed a family of four.
Oh, that hurts.
I can say that because I've made $25 off of my music so far.
Beautiful.
All right.
I got two, but they're related.
So I'm going to put them together real quick.
I think first to kick it off that Ubuntu users are apt to get this joke that I'm about to tell.
Okay.
And then the second one, the second one, this is fun.
I actually, I know Kenneth, you switched over to windows recently, and I'm also kind of a fan of it, even though I spend a lot of time on Mac.
Still, I like the joke.
How many programmers does it take to kill a cockroach?
Two.
One holds, the other installs windows on it.
All right.
Beautiful.
Well, I think that's probably about it for our show today.
Kenneth, thank you for coming.
Brian, thank you as always for being here.
Yeah, thank you.
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.
On behalf of myself and Brian Okken, this is Michael Kennedy.
Thank you for listening and sharing this podcast with your friends and colleagues.