Python Bytes - #139 f"Yes!" for the f-strings
Episode Date: July 18, 2019Topics covered in this episode: Simplify Your Python Developer Environment New fast.ai course: A Code-First Introduction to Natural Language Processing Cloning the human voice Ab(using) pyproject.t...oml and stuffing pytest.ini and mypy.ini content into it Polyaxon Flynt for f-strings Extras Joke See the full show notes for this episode on the website at pythonbytes.fm/139
Transcript
Discussion (0)
Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
This is episode 139, recorded July 11th, 2019.
I'm Michael Kennedy.
And I'm Brian Akin.
And I want to welcome Enis Montani to the show.
Enis, it's great to have you here. Special guest, going to help us cover the news of the week.
Thanks for being here.
Yeah, thanks for having me. I'm really excited.
It's going to be really fun to have you participate in this.
Also, thank you to DigitalOcean for sponsoring this episode. Check them out at pythonbytes.fm slash DigitalOcean.
More on that later. Brian, we've talked a lot about like, how do you install Python?
How do you manage Python? How do you upgrade your stuff? There's just so many ways. And then we've
got things like pipf, flit, poetry. It goes on and on and it still goes on, right? This was a
contribution from Niels de Bruin
sent us this. There was an article called simplify your Python developer environment.
And it talked about using PyENV, PipX and PipEnv together. And my first reaction was like,
we've already covered all of these. However, I have tried PipX. Actually, I did the joke, the Pi jokes.
I did that with PipX.
And I've tried PipEnv once before.
It doesn't really do anything for me that I really need.
And the PiENV, I've tried it and it didn't work for me. So actually, all these things, I kind of wanted to give them another shot anyway.
So I went ahead and read this article.
And it actually is pretty nice. It's a nice
pros and cons of all the tools and how to set them up. And I think for somebody that wants to try
these out again, this is a good article to read to try to get back into it. So if people don't
remember, PyENV is used to install and manage multiple Python versions and flavors on a computer.
And then pipx is something that allows you to create,
take a Python application and have it bundled with its own virtual environment
and use it globally on your system without having to activate the environment.
And then pipenv is for when you're working on project and application.
It's a way to manage virtual environments and dependencies on a per-project basis.
These are really interesting because I feel like often they kind of blend, like in a blur together, right?
You're like, well, I know there's all these ENV things I could use and whatnot.
And it's like, well, when should I use what?
And what one is relevant for the situation?
And what do you think, Ines?
Yeah, it actually took me a second to remember the one that I've used.
So I'm totally in the market for stuff like that.
But actually, I hadn't heard of pipx at all.
But I think, yeah, pyenv I definitely use.
And I think it's quite important,
at least for the work I'm doing,
because I need to run stuff in all kinds of Pythons.
And I mean, as a library developer,
we need to build stuff for like Python 2.
We're supporting Python 2.7 and 3.5.
Just so folks know, you're deeply involved with Spacey
and some tools built on top of that, the natural language processing,
which will come evident as we go through some of your topics and more.
But maybe not everyone knows your background.
But I feel like PyMV is most relevant for people building libraries.
And PyMV is really relevant for people building applications. I pipenv is really relevant
for people building applications.
I don't know.
What do you think, Brian?
Both of them are important
for people like us
that have to do both.
I have a question for Inez.
The pyenv,
so one of my concerns was,
can I use it to install,
to have multiple Pythons
and still be able to run them all
from one project,
like with the talks build to be able to access all of them so i haven't tried it all like within the exact same projects i think
you might need different virtual environments for that at least that's how i use it so i use
vnf to create my virtual environments and then they are created with whichever python version
i've configured locally so i do like like high-end local 2.7,
and then the virtual environment will have 2.7 in it.
Okay. Well, I'll give it a shot.
Yeah, yeah, really nice.
I'm a big fan of PipX.
I think PipX is super cool.
So PipX is great if you have a thing that you just want
as a utility on the command line in your terminal.
That happens to be Python-based.
So instead of brew install something or npm install something, pipx does that.
So for example, I have like cookie cutter.
I have the HTTPI library.
I have glances.
I have PyJokes, of course,
because we run this podcast
and some other stuff that I'll even talk about later,
like ptpython.
Is that a bit like pex files
or is that something else?
It's a little bit.
What it does is you say,
I want to have,
let's say I want the utility PT Python,
which is like an Emacs enabled rebel, basically.
Okay.
So I want to have that and I want to be able to just type it.
It's not tied to any project.
I just want to have it as a command on my computer that I can use.
So what you can do is you can pipx install PT Python
and then it just, it automatically puts it in a location,
modifies your path so that it it has its own virtual environment it upgrades itself and its dependency
separately but anytime i want i can just type pt python and go crazy or glances or pyjope or
whatever okay i think i get it okay that actually sounds quite cool yeah it's really nice you can
just say what are the updates from my python libraries that i use as applications or little
utilities it's pretty cool i like that one as. Yeah, I wonder if we can ship our annotation tool Prodigy like that,
because it's very, very command line heavy. And, you know, it's usually kind of a separate thing.
All it does is build upon pip. So if you could pip install the thing, and it has an entry point,
then you can pip x install it as well. Okay, yeah, cool. Yeah, pretty cool. All right, Brian,
are you switching to this?
Are you going to use PyENV, pipx, and pipenv?
Is this your new plan?
I definitely want to try PyENV because I want to try new Python versions, and my old process
was to just download the regular install and install it, and then my path is all weird,
and yeah, it's a mess.
Classic.
Cool, yeah, this is nice. Definitely for people looking for a different workflow, it's a mess. Cool. Yeah, this is nice.
Definitely for people looking for a different workflow.
It's something they can check out for sure.
All right, Ines, what's this next one that you got for us?
This week was actually like the past few weeks
were actually like super exciting also in my field.
So there was a new release of a fast AI course
for natural language processing.
So fast AI is a very popular free online course
for deep learning by Rachel Thomas and Jeremy Howard.
And it also comes with a Python library,
comes with lots of notebooks, really active communities.
So if you want to get into
like the modern machine learning stuff,
that's like probably the go-to course
that I would also recommend to you.
And they've also produced some very influential research
developed alongside the library and the course. So for example, ULM Fit, which was a very popular algorithm for text classification.
And yeah, the new thing is they've just released a course on natural language processing, and it's
a very practical introduction. And what I thought was really, really interesting and really cool
about it is that it, of course, covers like the modern neural network approaches and all the like
very hip stuff but it
also focuses on traditional techniques so just the whole background of like okay what did people do
before deep learning topic modeling linear models just really all the basics and even like rule-based
approaches like regular expressions like you know some people might look at this and be like what
regex that's like you know i did that 20 years in fact, like, you know, in real life and in like real life practical applications,
that's like super important. And you can do a lot with that, that, you know, really gets the job
done. So I thought that was really cool. And of course, another thing, the course has a really
strong focus on ethics as well. So their videos on bias and disinformation, and basically just
the topic of like, okay, think about the impact that the work you'll be doing has.
And I thought that was incredibly refreshing.
And of course, disclaimer,
like I haven't actually watched all the videos yet.
I don't even think that's like physically possible
to do all of that since it was released.
It's too new and it's too long, yeah.
Yeah, it's like, it's a lot of material,
but yeah, I really like the work they're doing.
And it's like, yeah, it's a very, very significant release.
And it's off-weight.
Yeah, it's super cool.
Yeah, it looks like it's free.
Like I was able to go pull up the videos without even having an account there.
It just sort of takes you through it.
More like an online video book you just make your way through, right?
Yeah, and lots of like notebooks.
So you can open the same notebooks.
You can play through the examples.
And of course, also use their library to, you know, really work through the things efficiently.
Sure.
That's super cool. Does it cover any of the libraries that you all work on?
Like Spacey or anything?
Spacey is a much more like high level toolkit and framework. So it's like, you know,
this is really the basics of the technology. So while the FastAR library, I think it does
use Spacey for tokenization, but Spacey is really, you know, once you're building applications,
and you have some problems, and you want to construct your pipelines and really ship something into production, that's when you would be using
spaCy. But actually, in fact, spaCy is not really the best solution if you really want to learn the
underlying algorithms and implementations, because we're actually super opinionated. You get one
implementation and, you know, you kind of take that or you plug in your own.
I see. This is like learning the algorithms and the foundations that maybe Spacey uses.
So you understand it better.
Yeah, exactly.
And also, you know, giving you some, yeah, the background.
And yeah, even the rule-based ideas, which, yeah, I still think it's so great.
I scroll through it.
I'm like, great, regular expressions.
That's like really what people should think about.
Yeah, I mean, that's a start, right?
Like sometimes you just want to pull data out of text and there you go.
Yeah, and especially then some people really, you know, then they start throwing like a neural
network model at it when actually best solution would have been to just write one regular
expression. Like, I don't know, you work at a company, you have a statistical model that
recognizes organization names and then, you know, your manager comes to you and is like,
well, it's all great, but like it often gets our own company name wrong. Can you fix that?
That's really embarrassing. And, you know, you can spend like hours trying to tune your model and like update
it and fine tune it with more examples. Or you can just add one regular expression or one rule on top
that says, okay, whenever I come across this string, don't get it wrong. And that will likely
take you like five minutes and it's much more effective in the real world. So this is the
practical applied natural
language processing right yeah speaking of language this next item that i want to talk about
i don't know it just scares me so let me tell you quick about it i'll get your
your two opinions but the idea is that we can clone the human voice by giving it a sample
using some sort of neural network type thing i'm not not sure exactly. So this was sent in by Brendan.
Thank you for sending that over.
And in just a couple of minutes,
you can load up somebody's voice,
use some Python,
a pre-trained machine learning model,
and then type in text.
It will speak whatever that text is
in the voice of that person.
And this is just, I don't know.
I feel like public discourse is in serious jeopardy here.
What do you all think?
This is pretty interesting.
And I was a little frightened actually watching this video of how easy it was to copy somebody's voice.
I mean, I don't know what the code behind it's probably not easy, but it's a little creepy.
My first thought was I could use it for if I have solo episodes, I could be my own co-host.
But that'd be cool.
That'd be pretty funny.
Yeah.
No, I mean, I think I would say,
I think it's still quite compute intensive
like to do that, right?
I think you still, you know,
if you really want to have good results
and really want to do it right,
but it's true that this, you know,
this really, this is a really good like example of,
wow, that's possible.
And that's the type of stuff
that's been possible for quite a while,
especially across like, you know, video image and, you know, also voice audio.
Right. I mean, we've heard of the deepfake stuff for videos and whatnot, and that's kind of scary,
but this is, it's almost like this can be worse, right? I can imagine somebody just putting a
little static, a little muffling filter on it and saying, oh, here's a hot mic take behind the
scenes. Somebody said something they weren't supposed to
during a presidential debate
or some kind of public figure they're trying to discredit
and just make them say stuff.
Now, I don't know what you all think.
To me, it still sounds a little bit off.
Like it doesn't sound exactly like the person,
but it's pretty close.
But I think you could still use it.
Yeah, and also, I mean, I do think this type of technology will definitely lead to a situation
where we will all just take things we hear like recordings or videos much less seriously.
Like, you know, I do think it will develop into a culture where we don't necessarily
trust an audio recording because, you know, it could have been produced by something like
this.
But I do think just for everyday life scam, like I think it's very timely because, yeah,
there are all these news articles about all these like financial scams and companies using deep fake audio
or even before like using spoofed emails that were quite effective and actually reading that like you
know the trick there i'm like i can totally see how like an accounting department falls for that
and thinks oh it's their boss in a hurry and then imagine that with a voice of like yeah it's so scary exactly yeah so i'm going to link to the video you all can watch it
i'm also linking to the software that did this apparently it uses something called transfer
learning from speaker verification to multi-speaker text-to-speech synthesis and that even has an
acronym sv2tts of course and so this was based on someone's thesis
and you can watch the video and get a good sense. But yeah, you just imagine like I call, I somehow
get the number of the CEO and I call them up and I record that call. And then I take their, I don't
need only five seconds or so with their voice. And then I take that and I use some text to like
real time generate. I'll call up the accounting department and say hey this is so and so we got a super emergency we really important
client we forgot to pay them we owe them ten thousand dollars and you just like type and then
replay what you type live back to him like is yeah and then you overlay that yeah with some
background music background noise and just like oh i'm like in a taxi right now exactly like please
get this done asap otherwise we're in trouble bye sometimes what usually doesn't work for email but
if it's literally a voice that's interacting with you that sounds like the boss well it might work
hopefully we didn't give anyone ideas i guess you guys are better criminals than me i was just
thinking like a different version of ferris bueller's day off you could just use this to
call in and excuse yourself from school oh my gosh gosh, you're right. This would be beautiful when I was in like middle
school or high school. Oh my goodness. Yeah. No, Michael's not feeling well. Is he going to be
okay? He may be out tomorrow, but he'll be back pretty soon. All right then. Yeah, that's really
horrible. Pretty soon you have like kids recording their parents' voices. Yes.
I don't know if that works.
It's worse.
But these are all bad.
This is a good example of why, yes, a focus on ethics, you know, when you're learning these technologies is like incredibly important because, you know, we have that technology
and every developer should think about, okay, what's the impact of having this and using
this?
And okay, we can release it to really also, you know, make everyone aware that this exists.
And, you know, we're talking about this right now, but still.
Yeah.
Yeah.
I guess final thought on this one, Enos,
what do you think the chances of some sort of fingerprinting
or like system that can determine that this was faked, right?
Like not a human, but if I could take this and feed it to, say,
another ML model that knows like the little glitches
that show up in the system,
like will we be able to verify stuff or not in the future? Are we just lost?
I think so. I think there've been like some experiments where they tried that. And I mean,
another approach would be, okay, you can always encode things in the model that like only show
up under very, very certain circumstances. So that's how, you know, you can watermark that
model, you can, or you can release that. And then if you say a very, very, very specific sequence, or if you type a nonsense secrets
in there, it will always produce something nonsense, but very differently.
And then you're like, ah, that's the system that was used.
And, you know, that's how we can, it won't work on the output, but like, at least, you
know, we can at least have some way of kind of finding out what type of system.
Yeah.
That's part of the ethics part, right?
Like that you,
you embed these little watermarks rather than just like putting out that,
I don't know.
It's,
it's pretty scary to me,
but I think as a society,
we'll come around to figure out what to do about it.
Cool.
Well,
not scary is digital ocean.
I just want to tell you quickly about them and they're supporting the show.
So thanks to digital ocean,
all of our software runs on top of digital ocean infrastructure.
You get the MP3s extreme and delivers either streams or downloads out of there, things like that. So
they're really, really great. You can get started for as little as $5 per month for a server. And
they got a bunch of cool services, managed databases, load balancers and whatnot. And it's,
you know, it's not like EC2, which is so complicated, it could run Netflix, it's like
the simple thing that you just need to build your app and get it going.
So check them out at pythonbytes.fm slash DigitalOcean.
And you get a $50 credit for new users there.
And definitely highly recommended.
Brian, what's this next one that you're working on here?
Okay, well, another contributed by a listener, this one from Andrew.
He contributed a little snippet that was on a Reddit stream, and it was, I'm going to
just describe it as abusing the pyproject.toml file by putting any file stuff in it. So the
example that he gave was you can have the pytest any file and the mypy any file or two any files for tools and you can they're in any file format and
toml files kind of look like any files but they're not they're different and you can break any with
toml syntax and you can break toml with any syntax however you can write them such that they are if
you're careful you can write them such such that they comply with both. And I
went ahead and tried this out. I was able to try putting a PyTest any like options within the
Toml file. And, you know, both PyTest and MyPy do not support doing this, but they do support
passing in a path of where their config file is. And if you pass in the project.toml file, you can get it to
work. And if all you're trying to do is reduce the number of files in your project, yeah, this kind
of works. Why would you want to do that? Just to try to reduce the number of files in your top
level directory. Okay. I don't know. I should like use all of these like files more. And I feel like,
you know, I love this idea of imagine if there was one config file like really you know only one place where you put everything also your dependencies everything
just goes in one file and then you have that but for some reason it's never actually worked out
that way in practice you can put it in the setup.cfg that's a possibility but they're both
those are any file syntax also i have to admit like our product our projects don't even have
a setup cfg we have a setup.py and And then we have the requirements TXT. Okay, I have a admission as
well. Like I know we're talking about pyproject.toml. But I'm still just using requirements.txt as well
for some of my projects. Because you know what the workflow works, I've got, like external systems,
like PyUp that are out there, like automatically doing PRs for changes. I mean, it's just like, it's super cool. But at the same time, I already got a flow working. And I just,
you know, yeah, no, I can relate. And I use the ones, I think contributed a Pi project to
Spacey. And we were, you know, I really appreciate it out because I'm like, great.
But it's still I don't think we can really ditch requirements TXT yet. And so now,
we also have that,
and now if we update a dependency,
I have to manually edit that in three places.
Yeah, yeah, yeah.
That's how it goes.
I'm on the bandwagon.
I'm using Flit now,
so I'm using pyproject.toml and Flit.
Okay, and that works cross-platform, cross-Python?
I don't know.
It works for me. Well, that's always good.
I'm using it for mostly 3.6 and above, 3.6, 3.7, 3.8.
My personal projects, I think it's sufficient, and the ones I'm supporting
for other people, I think it's fine for an individual project owner to say
I'm not supporting 2.7. No, of course. I would never, you know, and I also
would never go and just whine about like, oh, of course, there's like an edge case for 2.7 on Windows and there's something there.
Like, I understand it's not like as easy if like, you know, there was like the Python that could just like magically fix everything.
Yeah.
You know, I appreciate there's a lot of work that went into all of this and it's like, yeah, something's a bit tricky.
One of the interesting things was coverage.py.
I use that a lot.
And it got, there was a request to put pyproject.toml support on coverage.
The reason why it isn't there isn't because of any sort of like, not that it would be cool, but the toml parsing is not part of the standard library.
And coverage has the strict policy that the only dependencies that it has
are standard library dependencies.
That's a reasonable desire also.
Well, yeah, yeah.
Yeah, that's cool.
You just get a coverage.py
and just run the file or whatever, right?
Yeah, but maybe we should get
TOML support added to the standard library
and then it wouldn't be an issue.
There you go.
Yeah.
Yeah, that's a whole different discussion.
I know that's quite a heated debate
about what should be on the standard library these days. And the trend is less, not more. I think if you take. Yeah. Yeah. That's a whole different discussion. I know that's quite a heated debate about what should be on the standard library these
days.
And the trend is less, not more.
I think if you take the poll.
Yeah.
Yeah.
Yeah.
So some of the tools that you build are absolutely about making machine learning easier and doing
that across teams.
So I know that you're really turned on to that space and pay a lot of attention.
So this polyaxon one that you found for our next
item must be pretty interesting. Yeah. So basically it's actually quite funny because,
you know, I've obviously like, you know, thought about what I was going to talk about and had like
something else planned. And then really today, earlier today, that release came out version 0.5
of Polyaxon. So I was like, okay, great. This is perfect. It's like, as if like, you know,
they'd waited for my podcast recordings.
Yeah, so basically we've been using Polyaxon internally.
And essentially it's a tool for experiment management.
So, you know, if you work in machine learning and you train your models,
you have to like run tons of experiments.
And you have to, you know, you run an experiment, train a model,
look at the results, then you stop it.
Then you tweak some other knobs, then you try again.
And you keep doing that until you have a good result.
And one thing we always do when we travel and like visit universities and research labs,
we usually always ask them like, hey, how do you run your experiments?
And usually they're like, well, yeah, you know, we got this GPU and it sits on my desk.
And then I start an experiment and then I sit around and then I wait.
And, you know, that's like the top, some of the top like labs and like, you know, people where you'd think like, oh, they must have everything taken care of, tons of money.
It's like, no, they're sitting there with their little GPU on their desk.
And that's how it's done.
And basically Polyaxon basically, you know, helps you solve this.
So it's like super, you know, it's built on Kubernetes.
It's like very easy to set up.
And especially, you know, if's built on Kubernetes. It's like very easy to set up. And especially, you know, if you're already set up with cloud computing
and yeah, and you can also do stuff
like hyperparameter search where like, you know,
every hyperparameter is a tiny knob
and you have like tons of them.
And then you want to find the one combination
that gives you better accuracy.
And so you can run lots of experiments,
see them, you know, in their little graphs
and like try things out.
So it's been a very great tool.
It's all open source, which is very much in our spirit.
And yeah, they just released 0.5,
which comes with a plugin system, which is also great.
It's very much in our spirit.
That's also how we like to do things with Spacey.
You can run it locally and it comes with some new features
for chaining stuff together if your experiments have lots of steps. steps so yeah it's a great tool if you're working in the
field it looks super cool yeah i can definitely recommend it yeah so it's got a platform as a
service offering so you just you know kick it off and have it go but also like on-premise enterprise
option too yeah that's cool i think that's the focus it's like you know you run it and then it
gives you like a little ui and you just like you know you set it up yourself on your servers and then it manages that yeah this looks
really great runs on uh google's kubernetes engine among other things probably pretty much any
kubernetes cluster i guess i haven't tried yeah i think you might have to do a bit more like set up
if uh you know you you're bringing your own but like it should it should be quite very straightforward
google actually makes this quite straightforward.
And another nice thing here is with the hyperparameter search,
like if you, yeah, most machine learning stuff is done on GPU,
but not everyone has GPUs.
They're very expensive.
And we actually say it's not always the best choice necessarily,
because if you just want to run lots of experiments,
you can run them all in parallel.
You can run like thousands in parallel. And then, you know, if you have a to run lots of experiments, you can run them all in parallel. You can run like thousands in parallel.
And then, you know, if you have a tool like Polyaxon
that can help you do that,
so, you know, you don't have to kick them all off manually,
it's actually going to be much cheaper
and much more efficient,
and you don't need a fancy GPU.
You can just run it on CPU.
Right, yeah, the GPUs are great,
but they're much harder to come by.
So that's cool.
Yeah, it also has something about you can run it on your laptop as well.
Yeah.
A little data science as a box thing they talk about there at the end.
So yeah, super cool.
A nice one.
All right, this last one I want to talk about here.
Actually, the way I got it onto my system is I used PIPX.
So I PIPX installed this thing called Flint.
So we've heard about linting. And we've heard about f strings.
And I'm guessing some combination thereof is where the name of the thing called flint
came from. It's quite new. It's not super popular yet. But it works really, really well. So the idea
is I've got some code. Maybe it's old code. Maybe I just haven't bothered to write everything using
f strings. And I would like to
modernize it in its string processing. So this tool, what you can do is you can point it at a
single Python file, or you can just point it as a directory, like a top level directory,
just go to every traverse the whole directory tree and find all the Python files and then
rewrite all the string operations to be F strings.
Nice.
And it does a pretty good job.
It'll do the percent, you know, Python 2 style formats,
as well as the, you know, dot format style.
And it'll just replace all those with F strings.
There's a couple of things it doesn't do. If it's like multi-line, really long stuff, it won't replace those.
And when I first tried it,
it actually was making a mistake
on digit grouping format so if you have curly braces colon comma because you want you know
thousands millions grouping and so on that like just went insane and broke my code but i i submitted
a bug over to the guy who's working on it fixed it i believe a new release is already out so that
shouldn't be there but just you just run it on something you have
under source control and just look at
the wines that have changed before you
do the commit or
run your test, something like that.
Such a good open source user.
Found a bug,
reported it probably with
a nice description, fixed.
I ran this on all of TalkPython
training and all of Python Byte, and some of it broke.
So what I found out is it's exactly this.
If it has digit grouping, it broke.
And so then they fixed it, but it was no big deal.
I think I converted about 500 to 700 string formats
over to F strings.
And it's cleaner, shorter, nicer.
The thing with F strings is I always,
I don't know if you all use it i'll
ask you a sec but like i'm always like okay i'm going to write the string i'd say quote type type
type oh i want to put something in here curly brace i wish i would have done the f back back
back back back back back put the f and then back back back back back and then type the thing i'm
like well that was more work than just dot format because the ide will auto complete us like dot f
and then boom like so a lot of times i end up using the format anyway, but I still prefer to have
the F strings and read them.
So this way I can write it however I want and then just hit it with this before I do
a check-in.
I think that we should ask VS Code and PyCharm to detect when we put a curly brace in a string
and automatically add the F.
Yes, just like a hockey.
I was going to say the exact same thing.
So it's not.
That's awesome. You all are in the same
boat. So yeah, this is
really cool. I definitely think my
code is nicer. I originally
created, like when I created the Python Bytes website
and I created TalkByte on training,
this was when the latest
version of Python on Ubuntu was 3.5
so we didn't have Fstrings.
I actually took the server down once on accident
because i used
an f string in a little utility file that was like in the same directory and like the scanning path
looking for the routes found that couldn't parse it and the website couldn't start i'm like why is
it what have i done i didn't even change it so anyway i'm really happy now that i could just
take all that code that i used to like leave in the format style and just flint space you know
just run on this directory boom it's done so yeah it's really nice I can't wait to just like intuitively
just use like f strings and all that stuff it's still kind of I don't know just ingrained in like
my brain like even I know I go to conferences and I see people use all the new syntax and I'm like
yeah oh that's so nice but it's just like um you know in my day-to-day work you know even if you
don't support 2.7 we support 3.5 and they're just like
a lot of these yeah exactly you know there is this thing called i can't remember what it was called
brian we covered it where it lets you add f string support to python 2 it may also work for python 3.5
you can definitely retroactively add f strings to the format it's some weird way but then you need
like another runtime dependency which yeah yeah it's not worth it it's some weird way but then you need like another runtime dependency
which yeah yeah it's not worth it it does some weird thing that's how it works yeah that's a bit
unattractive it like rewrites like the the file loader with a certain weird encoder it's like
it's pretty sketchy yeah okay now i wouldn't want to ship that in like our libraries oh come on why
not just run your tests make sure they pass it's good good. But it's cool that something like this is out
so that when you decide, like, we're no longer supporting 3.5,
you just hit it with this and, like, you know,
a quick scan through the files and it's F-stringified.
That's going to be so nice.
Like, I can't wait.
Yeah, all that and all the type hints and, like, you know,
once we can drop all of the older versions, like,
it can be also nice.
So, yeah, I'm really, I won't even mind, like, rewriting all of the cult. Like, I think with our team, we're just going to sit down and be like, yay, it can be also nice. So, yeah, I'm really I won't even mind, like, rewriting
all of the code. Like, I think with our team, we're
just going to sit down and be like, yay, let's do this.
We're going to do it. Yes, here we come. Yeah, it's going to be so
satisfying, like, years later.
Yeah, well, it's the curse of success,
right? You have so many people using your libraries
that you just got to keep it sort of
a little bit backwards. Yeah, sure. And, like, some people are still
stuck on legacy code. Like, I mean, I'm not, it's not,
you know, some people, like, look down on, like, companies that are still on, like, Python 2, but it's like, you Yeah, sure. And like some people are still stuck on legacy code. Like, I mean, I'm not, it's not, you know, some people like look down on like companies
that are still on like Python 2,
but it's like, you know, it's not like many of them
like really enjoy using all this legacy software
and legacy like stuff.
They're just like, it just exists.
And we might as well keep supporting it if we can.
Yeah. What's the Python 2 story for you all?
You're still supporting it for now?
Yeah. And I think we will for a while.
After January?
Yeah, we probably will.
Like, there will just naturally be a point where, like,
we cannot upgrade any of our dependencies.
Like, I don't know, NumPy, for example.
Okay, if we ever, you know, it is a good reason
why we want to use a newer version of that.
We just can't.
And if everyone else drops it, we just have to be like,
okay, that's it.
We can't.
And it's also not like the old versions are going away.
Like if we make sure we don't have any ship major bugs,
like you can still use an old version of Spacey and like,
we're not going to take that away from you.
Right.
Just pin the version and you'll be good.
Yeah.
Very cool.
Very cool.
All right.
Well, that's it for all of our main items.
Brian, you want to,
I know we've got a few little extra things just thrown here at the end.
You want to kick it off?
Yeah.
So we had an email from Andre Janisch. I think that's how you say his name, saying that one of our episodes we talked about regular expressions taking down, and I even forgot, took down something.
It was something major, yeah.
I can't remember, but some major cloud provider went down because of it, yeah.
And how that could happen.
So there's an interesting video talking about regular expression denial of service attacks and how it happens. It was just an interesting video. We'll have a link to it some kind of application that's talking to some API
endpoint, you want to debug it. There's a new thing called HTTP toolkit, and it has like special
Python support. So this is like a proxy you can run on your computer and say, start recording,
and it'll start recording all the requests that you're making. So it integrates with urllib.request, urllib2, request, pip,
python2 and 3, photo, all those things, and specifically catches traffic from those.
And it does interesting stuff by like changing the Python path and environment variables. And
then all of these libraries that I talked about, apparently respect certain like proxy settings
and things you can set. So it just automatically, you don't have to change your app at all you just like
start a terminal with acp toolkit and then run your code and it can record it that's cool yeah
so if you if you're like why is this crashing you know i run my my request thing and then
i get some kind of crash and i how am i supposed you know you don't have like develop like the
developer tools in your web browser to like look at the headers and whatnot.
So you can do it with this.
It's pretty cool.
It's free, but there's also a paid version.
Just heads up.
Also, there's a nice little link.
Last time, time before, Brian, we were talking about magic, Python magic.
You're like, well, that's a pretty strong, strong name to be magic.
And all it does is detect file types.
You remember that thing this is a David Martinez center said well the reason it's called magic is there's basically these magic number
signatures that appear at the beginning of files and that's like teaches you about the syntax
So for example, you had a sequel light file
It would start with 53 51 4 C 69 etc. If you see those numbers up the front, that means SQLite, right?
So wait, did you actually know this by heart?
Or did you write this down?
No, no.
I opened it up.
Oh, of course.
Yeah, I know that one.
Sure.
No, I just pulled it up.
Let's see.
Really quickly, Python 3.7.4 is out.
So I brew and upgraded my Python 3.7,
which is how I'm getting on my machine.
And it's already on homebrew as well.
So that was like, I don't know, six, seven hours delay there.
It was really nice to see that come out real quick.
If you have pyenv, you can do pyenv.
I don't even know the command, but like install something and then...
Right away happen.
That's awesome.
Yeah.
And then the last one, I want to point out this thing called flying.
I just call it flying
fractals but this person put together this project using pi wonderland and it automates
some other libraries that are based on c so they made some really cool videos of like flying
through three-dimensional like animated mandelbrot sets and other kind of stuff and I just what I was
just watching I thought just wow this is this is super cool computational stuff over here I've done
a bunch of work in like complex dynamics and like trying to visualize that and like this kind of
blew me away so if you cared all about that stuff I think you'll just enjoy like a minute of that
video yeah yeah so yeah actually you might have actually noticed that my voice still isn't like 100% and it's a bit rough.
And that's because last weekend we had our very, very first conference here in Berlin
called Spacey IRL, like, you know, Spacey in real life.
So our community came together and I'm still like absolutely blown away.
Like there was, you know, the vibe was amazing.
We had like 200 people there and a lovely like old theater, 12 really amazing talks by people
from research, industry, community.
So it was really a lot of fun
and all talks were recorded
and we're currently uploading them
to our YouTube channel.
So probably by the time this airs,
they might've already been released.
And yeah, it'd be a bunch of, yeah.
If you're interested in natural language processing,
Spacey, the talks were really, really great.
And yeah, I hope you enjoy watching them.
That's awesome.
I'm so glad you're putting them
on YouTube.
And wow,
congratulations.
You must be just blown away
at how awesome it is
to put on a conference
about your own stuff,
right?
And so many people came
and the energy
and like you could tell
your voice was gone.
It's great.
I know that was like,
yeah,
wow.
And it was also,
it's actually quite refreshing
to organize your own conference.
Like,
you know,
we were like,
okay, let's do all the things that we think a conference should do and, like, try them out.
And it actually worked quite well.
Like, you know, only one track, for example, stuff like that.
No questions from the audience, much more social time, some, you know, really healthy food, stuff like that.
So it was great.
Like, my voice suffered a bit, but, you know, we're giving a lot back to the community, as in the videos,
photos, stuff.
Sounds great. Awesome. Congratulations.
A couple of episodes ago, Brian actually
talked about FastAPI, not to be
confused with FastAI, which I
talked about earlier.
It's a great, very modern
cool Python library for
REST APIs, and we're like, yeah, we've been
big fans.
We've started switching all our APIs over.
The exciting news here is that their core developer,
Sebastian Ramirez, is actually going to join our team here in Berlin.
This means a lot of cool development for us.
But also, we obviously, since we love the FastAPI project,
we'll keep supporting that,
and we'll definitely give him enough time
to keep working on it.
That's great news.
We found him through the project. We saw, oh, he's doing some consulting work. We're like, hey,
we'd love to work with him. And one thing came to another. And now, yeah, he'll be part of our
Explosion team, which is still growing, by the way. So we've been very lucky that we were able
to work with more people and expand our team.
Yeah, that's so cool that, yeah, that your business is growing. And I guess it's worth
pointing out that back on talk
python to me we talked about explosion ai i interviewed you about building a software business
so back on episode 202 so you know this is just like more yeah more evidence that that's all good
advice yeah super cool well great great news i guess it's probably time for a joke here too
a pie joke if you will maybe so i think this i'll do the first
one this one i think came from pie jokes we'll see we're starting to run that well dry so people
send in your jokes please but uh a programmer walks into the bar and orders 1.38 root beers
the bartender informs informs her that it's a root beer float she says now make it a double
all right it's pretty bad type system.
Maybe it doesn't work so well in Python.
We don't care so much about types, but still.
So it's all right.
I like it.
All right, we got one more up here.
Who put this one in?
Brian?
Yeah, so just last night, I was researching for this podcast,
writing notes for the other podcast,
and working on an open source project.
And I came up with this.
What do you call a developer without a side project?
What's that?
Well-rested.
Yeah, that's true.
It's almost a bit sad in that sense.
I know it's too real, too real.
I shouldn't be complaining.
But, you know, there are some comments we could make here
about, like, you know, the culture and, like, what's expected of developers these days and how that's maybe not ideal you know
sleeping enough stuff like that oh definitely we people should be and i was it's mostly a
self-reflection no i mean it is it is a good joke i'm not i wasn't criticizing your joke
it's a totally fine joke i'm just saying it's also, it's very real. You know, jokes can be like too real. And then you're like, yeah, I'm really uncomfortable now. Exactly. All right. Well,
I think that's a good place to leave it. Brian, thank you as always. It was great to have you
here. Thanks for coming. Yeah. Thanks. 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 Ocken, this is Michael Kennedy. Thank you for listening and sharing this podcast with
your friends and colleagues.