Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
This is episode 64, recorded February 7th, 2018.
I'm Michael Kennedy.
And I'm Brian Okken.
And we're excited to be here with you today.
We have a ton of good stuff that we've uncovered to share.
Very exciting.
Before we get to that, though, I just want to say thank you to DigitalOcean.
Check them out at do.co slash Python.
There's some really awesome news from them, and I'll share that with you in a little bit.
But right now, I'm kind of in love with this project that you pick right now, Brian.
Tell me about it.
Well, it's WXPython.
We've heard of this before.
But when we've been talking about GUI development and desktop development lately,
and the WXPython folks contacted us and said,
Hey, we are Python 3, and version 4, codename Phoenix, is alive and usable.
That is really cool because WXPython, there had been a really old version.
And I think we all can see what Phoenix means in terms of a project, right?
It's sort of reborn in this new modern Python 3 UI.
Very exciting.
The underlying WX toolkit had been, it also underwent a change,
and the WXWidgets project has been updated.
And then the WXPython on top of all that has been updated.
And it's something that I think I've developed with years ago,
and sort of discounted because it had an old look.
But now it looks nice, and people should check it out.
Yeah, that was one of my two major, major complaints, maybe one or three,
about the Python GUI stuff.
And obviously, we're still on this kick.
And I think it's a good one, actually.
But the fact that a lot of these UI toolkits look like they've jumped in Marty McFly's car
and, like, been transported from the early 90s into your computer,
and they got this old-fashioned sort of look.
They just looked out of place, right?
And so the WXPython stuff looks really modern,
and it looks like it belongs on a lot of the platforms,
at least Mac, Windows, and Linux that I've been playing with lately.
So I'm really happy to see this coming along.
The other one, of course, I would love that, like,
visual designer sort of tooling in there.
But, you know, I'm happy that this thing is coming along.
It's been re-released.
That's awesome.
On their startup page, there's a, like, a, you know,
after you do all the downloads for it,
there's a five-line application that you can use to try it out.
And that's pretty slick.
That's fast to get something up and running.
I tried it out yesterday, so it's good.
Very cool.
So I have a little question,
a little tech interview type question for you, Brian.
Did you know that you can define a Python function
and just put triple dots after it and just kind of say,
you know, actually, I don't want to define it?
I did not know that.
I did not know that either.
However, part of my experience of going to PyCascades
was to meet Lucas, who gave this amazing talk from,
he's from Facebook and Instagram,
about how they're doing gradual typing in Python
and how they're adding types to, like,
the millions of lines of code at Facebook slowly.
And this whole process they went through,
it's super interesting.
I'm having him already recorded,
going to have him sort of in real time
with the way people experience it on Talk Python,
talking about it.
And one of the projects that came out of there
that I thought was really interesting
is this thing called TypeShed.
Have you heard of TypeShed?
I have, yeah.
Yeah, so TypeShed is this place
that contains the external type annotations,
basically the signatures for everything
in the Python standard library.
Okay.
So you go in there and you'll find functions
or classes with methods and whatnot.
And you'll see stuff like def visit self-commonode colon AST.
This is, like, from the AST module.
And so it'll tell you the type.
And it says, you know, arrow goes to any,
for example, colon, and then just dot, dot, dot.
And that's it.
And this is a way in which you can define
these external types in these PYI stubs.
So it's like a normal Python file
that Python can interpret,
except for all the methods are empty.
You know, there's a couple of annotations
that talk about, sorry, a couple of PEPs
that talk about the annotations
and how this is working and so on.
And these are just the annotations people know.
But what's pretty interesting
is that this is actually what mypy uses,
like this get repository of what Python looks like
in terms of types.
this is what mypy uses, the static type checker,
as well as this is what PyCharm uses
to get all of its magic.
So PyCharm is much better than many, many editors
about going, oh, you know, if you call, like, what, right?
You call some method on this other thing,
it returns this other type, and you hit dot,
and you can see all the autocomplete from it.
Like, where did that come from?
It came from TypeShed, actually.
Okay.
So, I don't know.
I thought this was pretty interesting.
And the other thing that is really cool about this,
and it doesn't look like people are using it this way very much.
So, I'm putting this out there as a call to everyone
who cares about Python 3,
who wants their library to be very rich
with inside these various editors and type checkers
to take a moment and document their packages' signatures here.
So, there's a place to put third-party packages,
like requests or flask or, you know, you name it.
If you run an open source project that has a package that people use,
you can come over here and put yours in,
and then that will be picked up by all the other things.
So, it's pretty cool.
Okay.
That's interesting.
We're not sure how they avoid name collision on that.
They basically structure it.
There's a third-party folder,
and then I think it's just the next subfolder
is the name of your package,
which is unique on PyPI.
Okay. Yeah, right.
So, it's probably okay.
Okay.
I hadn't heard of TypeShed.
I mean, I knew that you could annotate your signatures and stuff,
but I didn't know that there's this one place
that's kind of being used as this common source.
So, I thought that was pretty cool.
Yeah, and I'm curious about,
so, are these Python stub files,
is that the only thing that they're used for, is type?
I don't know.
I had never heard of them before,
but, you know, apparently.
Okay.
Yeah, it's this new signature.
It reminds me a little bit of what happened a few years ago
with TypeScript,
where I think it's called definitely typed.
I can't remember.
There's now this massive Git repository
of all these external JavaScript libraries
that want to interact with the typed version of JavaScript.
And so, they all have basically,
like, there's this similar concept
of just the signature descriptions
without the implementation
in this one giant Git repository.
So, this is kind of cool to see it happening
in the Python space.
Yeah, definitely.
All right.
One of the things I wanted to,
I think that Ned Batchelder's coverage tool
is super cool.
The same caveats as normal is,
don't be too enticed with trying to search
for 100% code coverage in your tests.
But it's a useful tool in its own otherwise.
Anyway.
But he, coverage 4.5 just came out,
and he added just one new feature.
And this new feature is pretty darn cool.
It's the configurator plugins feature,
which allows you,
you kind of have to read it a bit
and get your head around it.
But the idea is,
there's a lot of people
that have different configurations
or different run configurations of their code.
And some of the code
is intentionally not supposed to run
at certain times.
So, it throws up,
honoring all these different,
like, different requests from people
to put new features in.
It has this configurator plugin feature
so that you can do your own pragmas ahead of time.
You run a little bit of code
before you run the rest of your code.
And you can comment out things.
As an example,
for instance,
in the pytest book,
I had an application
that used both TinyDB
and MongoDB
as two different options.
So, I would want to run my test
on the whole thing using Tiny
and then also the whole thing using Mongo.
But I don't want to,
there's some of the code
that's only for Tiny
and some of the code
that's only for Mongo.
It doesn't make sense
to run coverage on those parts
in those configurations.
So, that'd be a great use for that.
Yeah, that's really cool
because it's really easy to say,
okay, we're at 80% coverage.
We've got to keep going.
Like, how do we get this higher, right?
But there's some stuff
that should just kind of be left alone.
And this is a nice way to say,
right now,
you should not consider this bit of code
because who knows,
maybe it's like some sort of little
utility script
that you're just throwing in
and you don't actually want it to be run
as part of your package.
Who knows?
It's pretty cool.
Yeah, so, you know what else is pretty cool
is the recent changes
that the folks over at DigitalOcean just made.
So, they've always been
the incredible, affordable hosting
and basic virtual server space.
They've sort of made places like AWS
react in like extreme ways
to try to keep up with them.
So, that's pretty cool
but they just recently
more or less just doubled
everything that you get for the price.
So, for like $5,
you get a server with a gig of RAM
and 25 gigs of SSD.
It's pretty sweet
and even includes a terabyte of transfer
which, by the way,
at AWS rates,
that's $93 worth of bandwidth.
$10, 2 gigs,
if you pay like $20,
you get 4 gigs,
80 gigs of SSD,
couple CPUs.
It's just crazy
some of the prices
that they have now over here.
So, if you're looking to do
sort of virtual server stuff
or things like that,
definitely check them out
at do.co slash Python.
They've got some really cool options now.
That's great.
Yeah, definitely.
And thank you, DigitalOcean,
for supporting the show.
It helps us keep going.
So, we've already talked about, Brian,
the fact that
neither of us are really into gaming, right?
I've been playing a little bit of Formula 1,
you know,
with like the steering wheel thing.
That's kind of a fun simulation.
But generally, gaming,
not so much with either of us.
But I have some gaming news
that is pretty interesting.
It doesn't have to do with playing games.
It has to do with the creation of games
and 3D worlds.
So, you may know,
I'm sure that you know personally,
but people listening may know
that Python is actually used
quite a bit to automate
and manage
and sort of build the pipeline
between all these different tools
and all these different people
at these massive game
and movie companies, right?
Yeah, that's pretty cool.
Yeah.
So, if you've got to go from like Maya
over to some other tool
or, you know,
you've got these hundreds of gigs of files
and they need to be transformed
and processed and whatnot,
that's a challenge
and a lot of people have built
sort of custom versions of that.
So, the big news here
is that Unreal,
the Unreal Engine,
which is one of the most significant
sort of 3D game engines there is,
they're now integrating Python
deeply into its sort of processing pipeline,
not its necessary execution.
But they plan to integrate Python
into the Unreal Engine
for data,
basically for this data pipeline.
That's great.
Yeah, it's cool, right?
So, this is from Autodesk
and they said,
hey, we're going to give you a glimpse
of what we're doing.
So, maybe somebody's built
like a model in 3D Max
and it's like this super intense,
ultra, ultra fine quality,
you know,
every single thing is modeled.
The example I have in this article
we're linking to
is like there's a motorcycle
and the tires on the motorcycle
have those little,
like, you know,
those little dots,
those little sticky pieces of rubber
that come out on like new tires
where they come out of the mold
and they're still like sticking out.
So, they're like,
we don't need that in the game, right?
This is going to kill the performance
if we actually put every little bit
of these like knobby things and stuff
into the model that ends up in the 3D
in the Unreal Engine, right?
So, they're basically building this pipeline
where you can say,
in Python,
why don't we just delete all the objects
that are probably too small
for people to notice anyway
and just do that automatically.
do level of details models.
You can like merge objects together.
You could say,
actually create a bunch
of different motorcycles
by automatically taking the source one
and replacing like the material
that is say the fenders
and the gas can and stuff
to change it from say like a light blue
to like a purple shiny motorcycle.
And so, all of this is automatic.
So, once it's automatic,
you can, you know,
make a change at the beginning
of the process
and replicate this entire workflow,
which is pretty cool
and it's awesome to see
that Python's the choice for it.
Yeah, very cool.
Yeah, so just one more example
of people using Python
in ways that I had no idea existed.
Yeah.
Neat.
Yeah, pretty cool.
Good job, Unreal.
Yeah, good job, Unreal and Autodesk.
And they're going to have
a brand new version of Python
to work with pretty soon, aren't they?
I think we mentioned Python 3.7 last week,
but the Python 3.7.0 beta 1 is out
and because it's now beta instead of alpha,
that means the feature sets,
I think I might get this right,
the feature sets frozen
and we're just tweaking it,
making sure it's all tight
and everything and tested.
But beta means that there's beta testers
and I was just thinking
if it's not people like you and me
in our community that listen to this,
who is it?
So, I think we had,
I'm just putting a call to action out there
to go pick a few of the features
that are coming up
and test things out,
make sure it works in you
and report bugs otherwise.
Yeah, and there's definitely
some cool features in there.
Like, we talked about data classes last week,
that being in there,
but there's actually a bunch of changes
and, you know,
it's one of these things,
speak now or forever hold your peace,
it's going to come out in June.
So, here's your chance to test it.
I was going to take a look
at the breakpoint feature
and the data classes
and maybe a couple of the others
and give it a whirl.
Nice.
So, do you know if there's easy ways
with things like talks and stuff
to go ahead and run your tests
on Python 3.7?
Yeah, of course.
Talks you can set up 3.7
as one of the Pythons
to test everything.
Yeah, that's one of the ways
I'm going to test this.
I've got to make sure
that there's new versions
of pytest as well
and I want to make sure
that all combinations of Python,
all recent versions of Python
and pytest
work with all the demo code
I have in my book
and doing that manually
is just too much work.
So, I'll use talks for that.
Yeah, that's a complete nightmare.
Yeah, tell people really quick,
I know some people know about talks
but not everyone.
So, tell people what,
like, where does talks fit in?
Because I thought you were
a pytest guy.
What's up with this
testing with talks thing?
Well, talks is sort of
like a top-level
scripter thing
and I'm totally
going to get it wrong.
but the way I use it
really is to pick
multiple configurations
to, you can have
multiple combinations
of different libraries together
or configurations of your system
and test them separately.
Yeah, nice.
So, you could say
test on PyPy
and on CPython
and multiple versions
of either of those
in a single test run, right?
But the system will, like,
configure sort of the interpreter
or the runtime for that, right?
It goes out and by default,
you can turn off
or on all these features
but by default,
it takes your,
takes your,
like, let's say,
a package that is
a Python package
and it runs
its setup function
to create
an installable
Python wheel, I think.
And then it
creates a virtual environment,
installs your package
and all of its dependencies
and then runs the tests on it
and then reports on that.
And then it does it again
for however many
different configurations
you've got set up.
All right, so for our final item,
the one that I want to cover
is similar,
you were talking about
a new release of Python
coming out in beta.
I want to just sort of hit
a whole bunch of other things
that were released
that were pretty interesting
on a couple levels.
So, first of all,
I think some people
use this web framework.
It's called Django.
What do you think, Brian?
Yeah, quite a few.
Yeah.
So, they just announced
that they had a security release
to fix some issues
in around authentication
and basically
the login infrastructure
in Django.
So, if you're using
2 or 111,
you may want to check that out.
All right,
so there's been like,
you know,
here's the testing thing.
There's been a regression.
There was a problem.
It was fixed
and now it's unfixed.
It's fun when problems
unfix themselves.
So, the release is
with the unfixed one?
This puts the fix back.
Oh, okay.
And then two more
around Python 3.
One is Python 3.4.
There's a security release there
and one is Python 3.5.
There's also a security release there.
So, respectively,
the versions are 3.4.8
and 3.5.5
and there's apparently
some problem
with this internal bit
called libxpat.
As far as I tell,
it's like an XML parsing library
and there's some kind
of issue with that.
That sounds not good.
Like, people could send you
bad XML
and bad things happen.
So, be aware.
And just a reminder
to everyone
and if anything like this
happens in Python 2 shortly,
there will be no fixes.
You're just going to have
to live with it
after it goes end of life.
So, it's good
that they're fixing these.
I suspect,
I don't know when 3.4
is gone end of life, right?
3.3 I think is now out.
Anyway, the final one,
I said I had a lot of releases,
is channels.
So, these are Django channels.
They're pretty interesting
in that they add
like an asynchronous way
to write Django,
WebSocket,
and these types of things.
Actually, I had the guy
behind this on Talk Python
and I linked it
and interviewed there.
But, this is sort of
a complete rewrite.
This is channels 2.0.
It's a major rewrite.
And most notably,
Python 2.7,
even Python 3.4,
are no longer supported.
They're fully legacy Python.
They're out.
It's 3.5 and above
is all this works on.
So, I suspect some of that
might have to do with Django 2.
But, also,
it being this async thing,
maybe they use the async
and await keywords
and it just doesn't work
in 3.4 or below.
But, yeah,
it's all pretty cool.
A bunch of new releases.
So, if you're using these
and want to check them out,
do.
That's it for our news this week.
Brian,
what items do you have to share?
Well, I've got a couple
exciting things.
Yes, you do.
I had submitted
five talks to PyCon
and one of them
was accepted.
Congratulations!
That's awesome.
Yay!
It's a talk.
I'm going to do it
together with Paul Everett
from the PyCharm team.
So, it'll be PyCharm
and pytest
and that'll be fun.
That's going to be
really, really fun.
The two of us also
are going to do
a webinar coming up
on the 22nd of February
and a similar topic
but a little bit more advanced.
So, we're going to dive
into how to productively
and effectively use
pytest within PyCharm.
Oh, that is really cool.
You know what I'm doing
right now?
I'm going to register
after I'm going to sign up.
That'll be really fun.
And then all these,
of course,
get recorded afterwards.
Right?
So, it's typically
an hour, a Q&A,
lots of fun.
But if you can't make it live,
you know,
you should still register
because then you'll get a notice
that, hey,
the recording is out.
And I suspect
we'll let people know
when your recording is out.
Like, maybe this week
I might let people know
my recording is out.
I registered for yours
and I got a,
I didn't watch it
but I got an email saying,
hey, it's up.
So, I got to go,
I started watching it this morning.
Yeah, that's cool.
So, I did recently,
I did a webcast
with the PyCharm guys as well.
Paul was sort of there
as the emcee
of the whole experience.
And what I did in mine was
I said,
let's learn how to play
with MongoDB from Python.
So, let's take PyPI
and recreate
the data access layer
of what PyPI might look like
in a document database
using Mongo
and Mongo Engine
and stuff like that.
It was lots of fun.
So, you can go check out
that recording
and we link to it
in the show notes.
And I suspect
around February 30th
you might have a similar one.
Just a small toy project there,
recreate PyPI.
And I'm a little disappointed
because I used Faker.
You know,
we talked about Faker before,
right?
where you can like
create fake data.
The thing is glorious.
It needs a few other features
which I'm actually,
I'm thinking of doing
some PRs for it
to add them.
But I created
sort of 100,000 fake
PyPI packages
and they have kind of
some kind of data.
So, now what I'm working on
is a system
that will let me
entirely download
every piece of data
from PyPI
and then model it
in the database
so that for other projects
like I'll have this
like basically corpus
of all of PyPI.
Okay, so for the next few weeks
if PyPI is slow
it's your fault?
Yeah, you can blame me.
I'm sorry about that.
Exactly.
Or I go over my bandwidth limit
or something like that.
Yeah.
It was really interesting
so far
that I've gotten into it.
So, good job.
Yeah, cool.
Thanks.
All right, well,
that's it for this week.
Thank you everyone
for listening.
Brian, thank you
for sharing this with us.
All right, thank you.
Talk to you next week.
Yep, bye.
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