You've heard me talk to a wide cast of people building amazing things with Python.
Some of them are building bioreactors to remove carbon from the air with artificial intelligence
and Python.
Others are optimizing the aerodynamics and race strategy at the highest level of automobile
racing.
This episode is different.
Rather than seeing how far we can push Python to the edges of technology, we're diving into
the tiny Python applications that might never be released publicly and yet can transform
our day-to-day lives with simple automation on an individual level.
We have four great guests here today.
Rivers Cuomo, Jay Miller, Kim Van Wick, and Rusty Gregory.
They'll each share a couple of apps and the underlying packages they use to build them.
I know this will be a super motivational episode for many of you, and I hope that after listening,
you'll transform something tedious and error-prone in your life to an instantaneous button-click
solution with Python.
This is Talk Python to Me, episode 327, recorded July 15th, 2021.
Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the ecosystem,
and the personalities.
This is your host, Michael Kennedy.
Follow me on Twitter, where I'm @mkennedy, and keep up with the show and listen to past
episodes at talkpython.fm, and follow the show on Twitter via at Talk Python.
This episode is brought to you by Linode, us over at Talk Python Training, and the transcripts
are brought to you by Assembly AI.
Please check out what we're all offering during our segments.
It really helps support the show.
Rusty, Kim, Jay, and Rivers, welcome all of you to Talk Python to Me.
Thanks.
Great to be here.
Thanks.
Happy to be here.
It's really excellent to have you here to share this topic.
A lot of times I have people on the show like, oh, here's how we built Instagram.
Are we using this cool library to scale the largest Django deployment?
Or here's how I built Flask and how we're evolving it and something like that in data science.
And that's great.
But I think so many people out there listening are like, well, I'm not building those kinds
of apps.
I'm building something entirely different.
Or I don't.
I just build little things.
And I think actually that's where a lot of the magic is for everyone out there listening.
You know, we all have these things that are in our day to day.
And it's just like, you know, that is, I'm not looking forward to that.
But so many times, a couple hours of Python or other coding, a little automation, and then
that becomes automatic.
And life is just, you know, it's so rewarding to do those little things.
I'm excited to share the ones that I did.
They're incredibly simple, but they're, they just make me smile so much as I do them.
So really looking forward to doing that.
But before we get into the apps and the details, you know, let's maybe go around the YouTube
stream picture here and let you all quickly introduce yourself.
Three of the four of you have been on the show before, but just, you know, a quick introduction.
Rusty, let's start with you.
Okay.
Yeah, I gave my long introduction last time.
So I'll just say that I'm a reformed teacher.
About two years ago, or maybe three years ago, I started coding.
And then I had an opportunity to kind of become the data manager at my school district.
So I'm trying to build pathways between all the various services that we use and keep our
data clean.
And that is so cool because it's not like you had to leave the education space or the public
school space.
You just sort of transitioned into this world where you can take what you're really into
and like help everyone with it, right?
Yeah, it was a great move for me.
I was actually trying to learn how to teach coding to the kids and then I just really enjoyed
it.
So yeah, so it was great.
Just do more of that.
Just the same time big data hit.
So it was good.
Yeah.
Fantastic.
Kim?
Right.
If I can borrow a phrase from Rusty, I'm a reformed embedded software engineer.
So I've moved from C a couple of years ago to doing mainly DevOps work for a financial services
organization here in South Africa where I'm based.
Yeah.
Fantastic.
And you were also hosting the Ask Me Anything not long ago.
Thank you for that.
Yeah, that was great.
Yes, that was not that long ago.
Yeah.
That was very good.
Yeah.
Yeah, it was fun.
Jay.
Hello, hello.
I just saw you over on Python Bytes not long ago, but happy to have you here.
Happy to be back.
I will crib everyone and say I am also reformed, marketer, veteran, now developer advocate,
and spend a lot of my time just talking to the community and learning from folks that are
a lot smarter than I am.
Like the four people on this panel.
Yeah.
And you're doing stuff with Elasticsearch and some cool database-like things, right?
Absolutely.
Yeah.
Rivers, your first time on the show.
Thank you so much for coming.
It's really great to have you here.
Tell people real quickly about yourself.
My name is Rivers Cuovo.
I'm the singer and songwriter for the band Weezer.
Our first album came out in 94 and we've been touring and making records on and off ever since.
I'm such a fan of your music.
It came out when I was in college and I've been a fan of what you're doing longer than I've
been a fan of Python, which is crazy.
That's so awesome.
So thank you for that.
Yeah.
I'm a huge fan of your show, Michael.
I listen every morning and of course I've learned so much and gotten turned on to so many
cool packages, but also it's just nice to get that human connection in the midst of a few
hours of coding every morning to hear all you guys talking about it.
It really warms the heart.
Awesome.
Thank you.
I think a lot of people who have told me they listen to the show and some of the guests as
well, they don't work in like a startup tech place environment, but being able to listen
to a podcast like Talk Python To Me and others, it kind of brings that community to them, even
though they're not necessarily like every day showing up with a group of people who would
be that community.
Yeah.
That's exactly my situation.
I'm working on my own here and I don't know anybody who is into coding.
So it's great to know you.
Yeah.
Awesome.
Yeah.
You as well.
So as you said, people will know you from Weezer and that's amazing, but you are doing
such cool stuff with automation and Python and code.
And so I think people are really going to be blown away by what you're doing as well.
So I'm super excited to get into that.
Let's just sort of go down.
We all put together a couple of things that we're working on in a shared doc here.
And it looks like Rusty, I put you first.
So Rusty, you want to kick us off with the first sort of automation thing that you built?
Sure. So when COVID hit, we had to change a lot of different things and adjust like everybody
else did in the world.
And we ended up sending out a lot of notifications from our school district when an infection would
happen at a school and we'd have to notify people.
And it was this huge thing.
And at the height, we were getting lots of these things a day.
And so schools started to put the information up on their website so that you could just go
and refer to the website instead of get a wall of text every time something happened.
So my superintendent came in and said she wanted to put this dashboard up and then she showed
me some other schools that had done it.
And I looked at what they were doing and just knowing how the web works and schools work.
I knew that somebody who's going to have to update this information every single day or
every other day on the website, it was something that could easily fall by the wayside.
So I thought to myself, you know, who's going to be updating this?
And then she's like, don't worry about it.
I'll update it.
You know, you've got so much to worry about.
Like, that's not what you want your superintendent doing, right?
You're updating the website, you know, once a day or whatever.
So I was like, I should be able to handle this with Python somehow.
So I hit Reddit and I just asked kind of, you know, or well, first off, I had to find out
where she was getting the information.
So the health department put it up on the website, but it was a PDF.
And I was like, oh, that's crazy.
Oh, gosh.
Yeah.
So I can't scrape that.
So I was like, all right, well, yeah, maybe I'll just update it every day.
All right.
So then I hit Reddit and I was like, is there a way to turn, you know, a PDF into a CSV with
Python?
And of course there was.
So about two or three different packages got recommended.
I played around with them for about a half an hour.
And this one called Tabula, which I wasn't crazy about because it depends on Java underneath.
So it uses Java to kind of like recognize patterns on there.
And it'll, so it'll, it'll turn your, your PDF, pull out just the, the tabular data and
stick it into a CSV for you.
So I was able to just with a bit of requests, go up, grab that every time, save it, process
it, wrote a really gnarly little loop that finds my four schools and then puts those into
my own CSV.
And then I use Python again, Yagmail to just send it to myself.
I did it twice a day because it was updated at different times.
And then on the other end with a little JavaScript, I just went into my email and I find that and
I just update a Google sheet that's embedded on the, on the website.
So there's a bunch of little parts on it, but literally the Python was about 96 lines
of code with comments and stuff.
And it accomplished this.
And that's super cool.
And it's really valuable, right?
That if something like that gets missed, you know, it could make a big deal or it could be
some kind of outbreak.
Yeah.
And I can apply that to just about, you know, to so many other things as well.
So the time, all the time I invested in learning how that was, and it was an afternoon and I
was able to figure that out and, and impress my immediate boss, which was really cool.
He, he enjoys those types of things.
So that was good.
I bet.
Paul out there in the live stream.
Hey, Paul says, I use Yagmail to automate sending out emails for the SciPy conference.
Very cool.
Rivers, it sounds like you and Rusty share some of the same tool set there.
Like it turns with like web scraping, PDFs, Google sheets, that kind of stuff.
Yeah.
I was just remembering, in fact, I emailed you a few years ago in desperation because
I was trying to get some data from our agents that they have a web service where they give
you the artists, tons of details about their upcoming shows, attendance and tickets sold
and gross income, all this stuff.
So I wanted to get all that and I had to, I had to deal with Pete, like it's rendered as
a PDF.
I made the mistake of going to Stack Overflow first, I guess, instead of Reddit.
And my question was getting all these downvotes.
Oh yeah.
Yeah.
That's rough.
That is so, yeah.
You've got to find your community.
I turned to Michael.
Yeah.
Michael helped me out.
Yeah.
That's awesome.
I remember you were really frustrated because somehow the wrong information had been given
to you when you showed up and you're like, this was supposed to be one hour and it's
two hours and I was at the wrong.
Yeah.
I just, I could see, I imagine you're like, how do I get this table or this part of the information
out of the PDF?
And yeah, that was perfect.
Yeah.
But what is that package?
Yagmail?
I think I ought to try that one.
Yep.
Yagmail.
It's really simple.
The toughest part is going through the hoops with Google, but once you get your little
file back from them, you can use it for everything.
So.
Very cool.
All right.
Thanks, Rusty.
Kim, yours first one's up next.
Just remind myself which one I wrote down as my first one.
That was it.
Yeah.
This little one, there's no link to it.
It doesn't have a name or anything.
It's just a little small script that one of the many that sits on my hard drive.
And this I think is really kind of an epitome of small time or very small tool Python
writing.
It's a small tool I wrote basically as my, my, the team I work with at work is about five
or six of us.
We kind of as agile as we need to be, which includes a Trello board because we're no longer
standing in front of a whiteboard in an office.
We're all in our own homes.
And so basically tracking cards of what we're doing for the week.
And we include in our team, people who have from day to day responsibilities for deployment
to some of our environments.
So one of the guys will push changes to staging, a different guy will push changes to our production
environment.
And then it's all kind of boring setup.
But effectively what it means is at the start of the week, I need to generate 10 cards for
who's doing what.
So I used to get an email from one of our administrators to say, here's the schedule
for the week.
You know, Bob's doing the staging on Monday and Fred's doing production on Tuesday.
And I want to track those on my Trello board.
And I reached the point where it shouldn't be a big deal.
It took me about 10 minutes on Monday morning.
I would make 10 cards and I'd write down Fred Monday, Bob Tuesday, but it was tedious and
it was fiddly.
And I was putting it off because it was 10 minutes I'd rather not spend.
And it's only 10 minutes, but still it was irritating.
And that was kind of not the thing I wanted to do on Monday morning.
So basically I have sitting on my hard drive about 150 lines of Python purely to ask me,
interrogate when I run it, who's doing what?
Well, basically I've now got it set up.
So it says full staging on Monday, which of these six people is the deployer?
And just repeat for each of those cards.
And that was literally, it takes me 20 seconds to run it now.
I have to read the email I get on Monday morning to say, you know, who's doing when.
And then it all does it for me.
And it's incredibly daft.
I mean, I save myself 10 minutes a week.
It's no big deal, but I also save myself some irritation and scratches that little itch.
And that's the kind of thing I really love about a really small Python tool.
It took me a couple hours to write.
So it's not like it cost the company days of my time.
Yeah.
And it probably saved them some mistake or some forgotten.
Well, exactly.
Yeah.
What's the Trello communication bit?
That's all REST API on Trello.
So like most similar REST API services, you go along to Trello's side, you identify yourself,
you get back a token from them, and then that's all API queries.
So of the 150 lines of Python, about 40 are just config files for me mapping the names of
my team members and various bits of information about the Trello to ID numbers I have to send
back to Trello.
Yeah.
It's a little less actual code.
Yeah.
That's fantastic.
So I don't know how we managed to pull this together when you all arrived for the meeting,
but we're exactly sort of in the loop of the same order in the docs.
So awesome.
Jay, you're next.
That'll keep it easy.
Awesome.
Well, as I mentioned before, I work as a developer advocate and I work for Elastic.
We do search stuff and search things.
I'm sure any of my co-workers listening are like, that's it.
That's all you're going to say.
Yes.
But one of the things that we have done because we do a lot of visualization is we build dashboards
for like everything.
There's so many dashboards.
I have actually built a series of my own set of dashboards using one of my new favorite tools
called Elon, which is like a pandas like data framing tool, but for Elasticsearch.
And it's great because it's designed to work with pandas, but it's also designed to work like
pandas.
So if you've ever done any type of data framing, any type of dealing with big numbers, big,
any type of information like that, and you're used to those commands, you can just try them
and usually they work.
And what I've learned is Elon is amazing for like parsing CSV files, parsing JSON files.
You don't have to do like the for or with open, whatever the CSV file is as dict reader and
like all this, like that whole pattern you just do, you know, in pandas, you would just do
pandas read CSV or in Elon, you would say Elon CSV to Elon.
And then it just loads that information into your database.
No questions asked.
And it just goes.
Oh, that's super cool.
So instead of trying to work with it directly with pandas, you put it into the database.
You can do queries and reporting and stuff like that driven off of it.
Right?
Exactly.
Instead of like, because you're having to figure out all of the mutations that you would need to find
exactly what you need.
You just do a general elastic search query and then it shows you the information you're looking for,
but in like a data frame format, which is sweet.
And I've used that for a couple of projects.
I built a tool in react.
Sorry, I know it's a Python podcast, but it's called diversity orgs.tech.
I do a lot of diversity work in my job connecting with organizations that work with underrepresented
folks.
And this has been a way for me to collect, like, I think at this point, like over 500 different
organizations that work with underrepresented folks in tech and put it in like its own little
mini search engine, its own like small meetup and updating it.
I actually just use Flask, which I think is funny because you have, that is not it.
I wish that was it.
Diversityorgs.tech.
I was like, their design work much better than mine.
There we go.
Yeah.
So you can just search for it and like, but yeah, like it's a lot of people.
It's cool that like, you can just use things like Flask on the backend and build your own
little admin portal and you don't have to worry about spinning up a server or like being worried
that someone's going to try to brute force your backend or anything.
You're just like, oh, let me start my Flask engine, run it.
It's sending REST API calls to Elasticsearch and then it just works, which is great.
Yeah, that's really cool.
This portion of Talk Python to Me is sponsored by Linode.
Visit talkpython.fm/Linode to see why Linode has been voted the
top infrastructure as a service provider by both G2 and TrustRadius.
From their award-winning support, which is offered 24, 7, 365 to every level of user,
to the ease of use and setup, it's clear why developers have been trusting Linode for projects
both big and small since 2003.
To pull your entire application stack with Linode's one-click app marketplace, or build
it all from scratch and manage everything yourself with supported centralized tools like
Terraform.
Linode offers the best price-to-performance value for all compute instances, including
GPUs as well as block storage, Kubernetes, and their upcoming bare metal release.
Linode makes cloud computing fast, simple, and affordable, allowing you to focus on your
projects, not your infrastructure.
Visit talkpython.fm/Linode and sign up with your Google account, your GitHub account,
or your email address, and you'll get $100 in credit.
That's talkpython.fm/Linode, or just click the link in your podcast player's show notes.
And thank them for supporting Talk Python.
I think this whole diversity org tech place is really cool.
So the idea is, basically, you're trying to create groups that people can reach out to,
because if you see people who like you, you feel way more like you should be part of that
community, right?
Way more part of technology or whatever.
Yeah, just try it out.
Just type in Portland and hit search and see what comes up.
Like, there should be groups.
In Portland, there will definitely be groups.
Yeah.
Oh, yeah.
There's the PyLadies, Blackson Technologies, Django Girls.
Keep scrolling.
There's more.
Oh, yeah.
Yeah, there you go.
Oh, yeah.
Look at that.
Which is what I'm telling you is I need a lesson in UI.
So this is all running React.
But the way that I update this, like if someone messaged me and says,
oh, hey, I want my organization added to this list.
I just have a Flask site that I just spin up locally on my machine that sends all that.
Like, it's just a quick form.
And then it sends all the data to my server in Elastic Cloud.
And then it's up on the website instantly.
I was just going to point out one of the powerful things that you can do that had only occurred to me much later than I wish it had done is a very fast way to get a GUI tool for something you're only ever going to use for yourself is something like Flask or Django or something like that.
It doesn't have to be pretty.
It doesn't have to look good.
The only place it's ever going to run is on your own machine.
But you get all the HTML GUI stuff basically for free.
You're not writing anything.
You're not writing a desktop app for buttons to click.
You're just firing up some HTML.
So that's actually quite a useful thing to do.
You don't have to worry about deployment.
There's no security issues, et cetera.
It never leaves your hard drive.
Yeah.
Yeah, absolutely.
You know, another one that's pretty good is Anvil.
Yeah.
In terms of I just kind of want something.
Probably misspelling again.
We're watching my Google.
I know.
Yeah, there we go.
There we go.
I thought that's what I typed, but that's okay.
It's interesting because you write Python even on the front end and it runs in your browser,
but it takes care of the hosting and whatnot.
You don't have to share it publicly.
So it's kind of, you know, if you want to have a semi-hosted one, that's also a pretty neat option.
But yeah, Tim, you're right.
If you're looking for a UI, sometimes the right thing might be just a private blast gap for you
or maybe just for like your people who are going to work with it behind the scenes.
It doesn't have to be pretty.
Exactly.
Yeah, it doesn't have to be pretty.
You're not selling it or anything.
The buttons are in the right places.
Or for that matter, if it's the only people you know, they can ask you, what do I do?
And you can tell them.
It doesn't have to even be particularly attractive or easy to use if it gets the job done.
Yeah, absolutely.
Absolutely.
Very cool.
All right.
Thanks.
Thanks, Jay.
That's a good one.
Rivers, what's the first one you want to share?
First one I want to share is an app called Demolisher.
And I made this because when I'm writing songs, I very often like to Frankenstein unrelated bits
together.
That ends up sounding like a coherent song.
But for me, it feels like the song feels fresher when I have these unrelated bits where when I
was writing each bit, it was like, this is the only thing in my mind.
I'm just making this as good as possible.
So, I stick a few of those together and it turns into a song.
However, when I'm looking for a bit to attach to the previous bit, I usually have some idea
of what I'm looking for.
Right.
They can't just be a random combination of different types of music or riffs.
Yeah.
Even if it's a very contrasting bit, it's still something somewhat specific.
So, I don't want to have to look through all 1,500 of my old unused demos.
So, I needed some kind of filter.
There's a Windows app called MP3 Tag, which I highly recommend for tagging music files.
There's a search bar in there.
And I'm not sure exactly what the language is for that search, but it's some kind of SQL
looking thing.
But I would write these filter queries and they'd get quite complicated and long and like all
these nests with parentheses.
There's the filter bar down at the very bottom.
Gotcha.
I think I was using this app in a way that most people weren't because my filters were
just gigantic and unmanageable.
I wrote this app called Demolisher, which is a Tekinter window with a bunch of switches that
you set all the switches and then you hit a filter and it will copy this long string into
that filter bar there.
And you end up with the demos that only match the criteria you're looking for.
Oh, how interesting.
So, it basically develops this, the SQL query type thing.
Yeah.
For this app.
Is it okay if I put it up on the screen?
Do you mind?
The screenshot?
Oh, yeah, sure.
There we go.
I don't know if you can see, but there's just a bunch of switches here.
So, tell us about the switches.
I'm not very musical.
So, you've got to help me out here.
On the far right, this is pretty easy to understand.
It's just a range of BPM.
I often, I'm looking for a pretty specific BPM for a bit to Frankenstein in.
And then below the BPM range, you see like a more human readable version of the filter string
that this app has produced.
So, then each column to the left there is a different parameter.
Far left, I can select which folder I want to select from or not select from.
So, you've got things like feel, section, masterpiece, mode, melody.
Some of these you guys would probably recognize, but others are just particular to me.
But they're different tags I put on my demo.
Genesis, for example, on the far right, that's how I started writing the song, whether I started
on a piano or I started with a lyric and then piano or just started with a lyric and so on.
Because I found that those are useful tags.
They kind of set the direction of how that little composition is going to go.
This reminds me of like, like almost like a Moog synthesizer, like those giant patch panels
you see in studios.
We're just like, I need to find the perfect sound.
Let me just unplug this wire, plug it in over here and see what happens.
And then it's like that, but developing like a query for the right track that you have.
That's awesome.
Of your own stuff as well.
And intensely personal because you built it exactly to your needs.
So, very neat.
Yeah.
And it's quite easy to add or remove parameters.
There's a file in this package called sections.
And each section is one of these columns.
So, it's basically just a dictionary.
That is so cool.
Works perfectly fine.
Yeah.
Excellent.
I love that there's a feel there.
It's like, I would add fiddly to it.
That's the thing I've ever tried to do.
That's how it always feels.
I think you had the poetry guy on the podcast.
So, I've just tried to start converting a bunch of these to real packages.
And then I could put them up on GitHub.
So, other MP3 tag users could download this and use it themselves.
Oh, yeah.
That'd be really neat.
And maybe they can add some extra features and stuff as well.
Yeah.
I love this.
I love how you brought all this stuff together.
And it's just, it's so exactly what you need to make your life better.
And like you said, you had thousands of these demos.
And these pieces you wanted to bring together.
And it's just such a challenging format to combine.
And then here's how you just bring it all together, right?
Yeah.
So, typically I'll end up with a, it'll return about 10 demos that are, you know,
very likely to work for what I'm looking for.
And then I just pick my favorite one.
Yeah.
Fantastic.
Can you share any of the songs that maybe you sort of inspired to, you created through this thing?
Well, probably not anything you guys would know.
Because this is only, I've only been using this the last few years.
And sadly, none of those songs have become massively well known.
So, like, if you go back to the old Weezer classics, I was cutting and pacing, but I didn't have 1500 demos back then.
It was just, you know, I had a cassette tape I could look through.
Awesome.
At the live stream, Zachary the Hacker, a nice username there.
So, if I use this and it made us and came up with a search and it didn't return a sound,
I couldn't help but to see that as a challenge to myself to come up with a sound that matched that query.
That's a great idea.
Put in random things and see what comes up and then fill those searches.
If I could just note, one of the things I think is very kind of really cool about your approach here, Rivers,
particularly in a small tool approach, is you didn't then sit down and write yourself a replacement MP3 file player or what have you.
You're quite happy with the tool you had, but once you have the filter query,
you're quite happy with the existing tool to find them and play them and so forth.
So, you just wrote yourself a filter maker, basically.
There can be a strong temptation, or at least I would be tempted to go too far and then throw in file playing and media playback and so forth.
You don't need any of that.
You've got a tool for that.
You just need something to make you a filter.
Yeah.
Good point.
Yeah.
I was talking to Matthew Rocklin from Dask and Coiled a little while ago,
and he said that they have this interesting philosophy.
I'll probably misquote it just a little bit,
but something of the principle of minimum or minimal innovation.
What is the least thing we can introduce,
and what other pieces could we combine that everyone is already using and knowing about?
And yeah, I think this sort of matches that.
Oh, so I should add that one of the packages I used then is called PyWinAuto.
So, when I start Demolisher,
the first thing it does is PyWinAuto opens up the MP3 tag Windows app,
and then when I'm done with creating the filter,
PyWinAuto copies and pastes it into the filter bar on MP3 tag.
Oh, how cool.
Yeah.
So, basically, the use case is you import the application from it.
You can tell it to start some EXE on Windows,
and then just tell it to start typing keys into it.
Yeah.
That's awesome.
It's very cool.
It's a really cool way to combine it.
Yeah.
Fantastic.
If I can just maybe make a note,
you've reminded me about PyWinAuto,
and I'd forgotten about an episode from my career of 10 years plus ago.
PyWinAuto is also very useful if anybody's looking for,
well, exactly what it does, Windows automation.
What the kind of thing I'm thinking of is that more than once in my previous work,
we got tools custom made by the supplier, a particular vendor,
you know, that somebody was asked to knock together in a day.
So, it was terrible to use.
You had to click 50 buttons to get what you wanted.
It didn't remember any settings.
Every time you fired it up, you had to click all the boxes again
for exactly what you need for your output.
And it also means in factory work, you want it as automated as possible.
You want this all to be running as part of a bigger stream of work.
And you can't really say, well, do all these automated tasks,
then send somebody to the computer, take this piece of paper,
click these five or 15 sections, and then take the resulting file.
And PyWinAuto was fantastic for that kind of thing,
because I actually wrote some Python, basically remembered what the tool should be set to do,
fires the tool up, makes those settings, runs it, and grabs the resulting file.
Yeah, that's super neat because if you want to automate something on the web,
you could use something like Selenium.
But if you want to automate like a custom VV6 app that somebody wrote 20 years ago,
there's no API for that.
Well, exactly, yeah.
And when you open these tools up, there's things like, you know,
you need to tick a box 27 and, you know, drop down two.
It's not, it's not, they haven't been designed to be particularly well-written,
but the PyWinAuto doesn't care.
I mean, it's happy enough to use dodgy variable names and so forth.
Yeah.
Yeah, for sure.
I think there's a lot of folks that get their Python start doing little like computer automation
bits like that.
So I think having those tools, like one, like you said, starting out, it's never going to be perfect.
I mean, I think probably the hardest part is when you show people code you've written and they go,
that's not Pythonic.
Well, for stuff like this, it's probably not going to be because you're not working in Python.
You're just using Python to work in something else.
And it allows people to make messy code and just figure it out and hack at it.
And then over time, you just get better at hacking at it until your code does start to look more Pythonic.
Exactly.
Yeah.
On one hand, you have Pythonic.
On the other hand, I pressed a button and it happened automatically.
So I win.
The toughest parts about getting people to understand how to get into Python is you don't really know
the little tasks that you can do that you can solve with it until you get in and you can do a few things.
So little things like that open the door for you.
Yeah.
It's like a comment on LiveShane Brian says,
Never heard of PyWinAuto.
This has just opened a lot of quasi-RPA doors for me.
Indeed.
Fantastic.
All right.
So I wanted to talk about one as well.
So I'm going to throw out this one that I have to do.
So over on the course website, we have literally thousands of videos.
And these are MP4s.
There's a whole bunch of really cool automation about like geo distributed in them and all sorts
of stuff that I wrote during a break at my hotel at PyCon one year when I got hired.
I needed just a break from humanity.
But the thing I wanted to highlight is I end up with a folder full of folders full of hundreds of MP4s.
And I need to come up with some way to import those into the database.
And I was going through figuring out how long is this video.
I'd go in my Mac finder.
I said, all right, it's three minutes and 20 seconds.
So what is that?
That's 200 seconds.
And I would put that into the database.
And the file name is this.
And then I would do it again and again.
And after a couple of those and a couple of mistakes and similar stuff with the podcast,
I would just go crazy.
I'm like, I can't take this.
Maybe I have to hire somebody because I make too many mistakes.
And it's not useful for me to spend so much time converting minutes and seconds to seconds
and trying to do this.
So what I ended up doing is writing a little script that I just go to a directory.
I JSONify the videos.
I get a giant JSON document that I can just import into MongoDB.
And boom.
And it goes through and it finds.
It does two things that are really fun.
One is it goes through and it uses a little bit like what Rivers was talking about.
It uses FF probe.
Not the same thing.
But it goes in and figures out information about the audio stream or the video stream.
And it'll give me back the time and information.
And the way it works is I'm not using some API for this.
I'm actually using subprocess.
And then there's an output format for JSON.
And I just capture the standard out and then read it into a Python dictionary.
And then boom.
I have all that information.
It's as if FFmpeg had an API for Python.
So that's really fun.
And then I want to not bother to scroll back and copy it.
So I use hyperclip.
I was wondering how you're going to say that.
I've used a lot and I've never known quite how to pronounce it.
And so then I just I generate this huge thing, this composition of all these video files.
And then I just use hyperclip to copy it to the clipboard.
And then I just paste it in to the tool that is editing the JSON and like does all the importing
stuff.
And boom.
Off it goes.
So real simple.
But this thing was like it's no big deal to say.
I just want to sort of get the right file name relative to each another and get the time
and convert it.
But boy, did it save me a lot of frustration.
So I want to recommend those two things, especially hyperclip.
That's a cool one.
Yeah.
Hyperclip is very nifty.
The other thing I would just pick up from what you said there, Michael, is the point that
you don't have to use Python to solve all the problems.
If Fprobe exists, it's perfectly good at getting you the data you want.
Subprocess is a perfectly reasonable way.
Let the expert tool get you to do the difficult thing.
If Fprobe is already on your system, it knows how to get you the data you want.
It can get you the data in a format you can use.
Just use it to do it.
You don't have to write Python to do everything.
It's perfectly.
There's lots of very useful tools out there that are literally using Python to glue three
other tools together.
And that's fine.
And that works perfectly.
It works great.
I'm sure you see this a lot in your world where there's a lot of sort of stuff that is
more like desktop apps or CLI apps meant to automate things.
But maybe there's not a programming API for Python to it.
It's often that kind of thing.
Yeah.
Fantastic.
All right.
I think we've looped around our group here.
So Rusty.
Want to pick it up on the next thing you wanted to share?
Yeah.
So the next thing I needed to do at work was that I was going to automate was we have to
do state reporting.
And it's this big year long thing.
And it's basically what's caused my position to pop up all over the state.
So it's to keep giving the state information about our students and what's going on all the
time.
And it was a horrible process that they decided to automate.
It used to be people filling out papers and sending it in.
And then all of a sudden it just became this computer thing.
And then computer people had to do it, but it really wasn't their area of expertise before.
So we have to send our files in, CSV files in, and then they get checked and we get errors
back.
Then we have to fix that and do whatever.
So we're given an automated way to do it.
So if we can get the files there overnight, we get a time slot and then we get everything
back.
But eventually these errors creep in.
It's a flawed system and they know it's flawed, but since it's a government agency, there's
like nothing that could be done about it for multiple years or whatever.
So we're looking something different to kind of combat that.
Basically, I would get back errors every day and then I would have to go and hunt them down.
They wouldn't actually be errors.
It'd be false errors.
Oh man.
So what you have to do is upload three sets of blanks and then boom, then you can start over
and now your files are clean and it can work.
So what I just did was, I was like, well, we only have the one automated spot.
So I whipped up a little program in Selenium that goes in and submits my blanks every night
at nine o'clock at night.
So I'm always working off of the clean files.
And it's something I would never think of to do, but I could do.
It's a bit like Kim's project.
You know, I could have done that, take five minutes at the end of every night and submitted
my blanks and then let everything else happen afterwards.
But it just seemed really easy for me to go ahead.
It was a, it was a great puzzle to find out, you know, how to navigate around inside Selenium,
inside this older looking website.
But it was a, it was a great solution for me and I don't really get the errors anymore.
And because we can address things, you know, that day, it's really improved my job tremendously.
So I'd say it takes, I would say it saves me hours a week just being able to have this
little tool automated.
That's fantastic to just like reset the errors.
Yep.
Talk Python to me is partially supported by our training courses.
Do you want to learn Python, but you can't bear to subscribe to yet another service?
At Talk Python training, we hate subscriptions too.
That's why our course bundle gives you full access to the entire library of courses for one
fair price.
That's right.
With the course bundle, you save 70% off the full price of our courses and you own them
all forever.
That includes courses published at the time of the purchase, as well as courses released
within about a year of the bundle.
So stop subscribing and start learning at talkpython.fm/everything.
So I would say Selenium is the PyWin auto, but for the web, right?
The equivalent of that is such an amazing tool for that kind of automation.
Yeah.
Because we've got things like Beautiful Soup and we've got requests and Scrapey and stuff,
but they don't so easily just go, let me go over here, log in, you know, enter my username
and password here, click the button called login, then go to this page and then do that thing.
It's amazing, right?
I think that's definitely one of the secrets.
Select these 10 files and yeah, it's really good.
That was one of the reasons why, you know, with my previous one, the dashboards, I had
to create that web app, that simple web app to like upload stuff.
Because at first, my first thought was like, well, I'll just go to the website and scrape
it with like Beautiful Soup.
But then when you start getting like JavaScript frameworks and things like that, that come into
play, you're just, you can't get that.
You're scraping little curly braces that are just where the data would go.
Yeah.
I cycle in my spare time.
So they came out of these Velo Sambos from Adidas, which were like cycling shoes, but
they look like soccer shoes, which I was like instantly in love with.
They sold out within seconds every time they put a new batch up.
So I actually used Selenium and I kind of automated a check every three hours to kind of go in and
scrape it and send me an email if my size was in.
And I eventually got them.
But yeah, so it was a really cool little fun project that I just kind of used everything
I learned in this to go ahead and make that happen.
That's awesome.
You should do that for a PlayStation.
They build everything out of JavaScript.
So it's really hard to get.
So you couldn't do it with Beautiful Soup.
I had to go in and grab it this way.
Yeah.
Very cool.
Rivers, did you use Selenium when you were getting that schedule for your, when you were
scoring?
I definitely use Selenium a lot.
I think I use it in the app I'm going to mention next, I think.
So maybe I'll talk about it then.
Yeah.
That's awesome.
Yeah.
When I was trying to scrape from our agent's web service, I was trying to use Selenium.
Yeah.
Very cool.
I kind of wanted to just mention one other thing, Michael.
I had the mic here.
Just the way that I've been automating things.
I used a lot of Raspberry Pis in the early days to use Cron jobs to kind of fire these off.
Because I know that's something that I had trouble figuring out when I wanted to start automating
things was how to make it happen when you wanted.
And I had a guy that was a heavy Linux guy who was able to help me figure out, you know,
kind of how to do that with Cron jobs and things.
And then I moved on to an app on my Mac called Launch Control that helps create demons and things
like that, which is really, I found really helpful.
So those are some great tools to help make these things happen on the time that you want it.
Yeah.
That's really neat.
On my Mac, I install stuff with Homebrew.
And a lot of times you can install it as a service as well.
And it behind the scenes will basically run the launch control stuff, install something like
MongoDB or something on your Mac, which gives you slightly simpler commands to do it.
But it's got to be like lined up just like that.
That's cool.
Yeah, that is actually quite handy.
The other thing that is maybe worth looking at if you wanted to do that kind of automation
for stuff that's not just on your own machine, the GitHub Actions, which I'm not particularly
familiar with, or GitLab itself has got some very powerful, effectively free to use until
you get quite heavily involved CI.
And I've forgotten what CI stands for right now.
Continuous integration, that's the word.
But really, it's just automation.
At a particular time, do this thing.
That can be quite powerful.
I really want to try and figure this out because what I want to do is I put everything on GitHub
and then I just, you know, get up, pull it on the remote computer that's actually, that's
on all the time.
But I want to be able to figure out how to make it update when I, you know, when I push,
just make it auto updates.
That should be fairly doable.
That's what everybody says.
Again, my GitHub Action experience is not great, but certainly if you can do it on GitLab,
I'm sure you can do it.
Yeah, I've heard.
The CI tools are all geared around this kind of thing.
I've heard whispers, but I'm looking for it.
Something's changed in the code chat.
Do something.
Let's chat, Rusty, because my topic is actually designed for GitHub Action.
Wow, fantastic.
I'm glad I shaved today.
Yeah, yeah.
Yeah, I mean, if I can put my DevOps hat on, that CI kind of stuff is bread and butter for
us.
It makes a heck of a difference because it means when the developers make changes to their
code, they don't have to know how to go about and deploy things or build things and so forth.
It just happens.
It basically happens for them.
That's fantastic.
I also set up an automation, so if I get pushed to a certain branch, I'll just automatically
do a zero downtime redeploy of the Talk Python training infrastructure and stuff like that,
which is so fantastic.
Rivers, you mentioned Source Control before.
You guys are using GitHub for your kind of stuff.
Is there Source Control plus music going on here?
That's one of my many weaknesses because I'm usually just working on my own.
I haven't had much use for that sort of collaboration tool.
I do have my own website, so it does go through GitHub.
I've recently started volunteering.
I'm like a volunteer coder with this other group of people.
And I'm going to have to learn a lot more of this, of these Git tools, push, pull, all
that.
Once you have a need for it, I think it's easier to learn.
You know, until then, it's all just something you hear about.
But then it's like, oh, now I need this.
Now I can dig in and figure it out.
Yeah, if I could basically make one suggestion, if you are currently making changes to your
software by making final final.version.2 kind of files on your hard drive, look into version
control.
It doesn't have to be Git, but Git is effectively one in this argument.
It really is by far the most well-used one.
Even if you never collaborate with it, just the ability to use a version control system to
basically see what your code looked like yesterday or when you made the last, the change you made
three changes ago, compare them to each other, those kinds of things.
Until you have that capacity, you don't really kind of think about how you thought it would
be.
Once you're able to do it, you cannot really imagine not being able to do it.
You're saying even if I'm not collaborating with anyone, it's still very useful to involve
Git.
Yeah.
I think I've probably collaborated in my personal projects once with someone, but I wouldn't dream
of not using something like Git for anything I've ever written just because I know I'm not
going to remember, I'll have this vague memory that a week ago I made some change that actually
would be useful to have back now.
And Git's got that kind of history.
It'll show me that a week ago I made a push that said, you know, tweaks the Prognob Decator
knob or something like that.
And I'll go and look at that and do a comparison against what I've got now.
Yeah.
That sounds great.
I've been using the poor man's version control, which is my Dropbox history.
I just refer to like the state of the folder three months ago.
Yeah.
That is super handy.
But like just the ability to see, like, I want to see how it was two weeks ago when
it worked like I expected.
And now it doesn't anymore.
Tell me, why did I break it?
What did I do?
Right.
And then you don't make it public, right?
No, no, definitely not.
Yeah.
I feel like we all have been there with Zach the hacker.
Like once you've accidentally lost eight hours worth of work because of misunderstanding
of Git, you probably, that's when you.
Yes.
I've given talks on the data I've lost from bad Git commands.
Or because you didn't commit something and you really, really wish you did.
Yeah.
If we had more time and some beers, I would definitely be able to tell some good horror
stories to that.
But I think it's, Kim, you're up next on the sharing, right?
I just wanted to just finish off that Git discussion.
Just another, just to comment on what you were saying there, Rivers.
In terms of making it public, Git itself never necessarily needs to leave your hard drive.
You could run Git entirely locally if you wanted to.
And it's still useful as a version control system.
GitHub is just a publicly accessible Git tool.
And it's not the only one.
GitLab exists as well.
But even there, you don't have to share anything.
You can do it all privately as long as you're the only person ever seeing it.
But it's still useful.
Right.
Interesting.
Yeah.
I'd never do it that way.
But you're right.
You could just do Git and just save it there, right?
It is something you could do if you wanted to.
Yeah.
If it were in Dropbox, it'd be backed up even.
Yeah.
Exactly.
Lots of us are using GitLab and GitHub as offsite backups of our files, not necessarily to
collaborate with anyone on them.
Oh, yeah.
That's absolutely true.
In my case, we're back to PDFs, actually.
And manipulating the data in them, although not CSVs this time.
The second little tool I wanted to talk about was, again, doesn't have a name.
And in fact, this ties into a previous example.
This is in my GitLab, but it's one of my private GitLab repos because it involves some kind of
data that the world doesn't need to see.
That has basically my wife and several of her colleagues regularly receive large PDF documents.
She's in the financial services industry.
That's got 60 to 70 people's account details in them.
So it's three pages per person.
So you can get a 200-page document.
And they then basically need to split those up and send them to each of the individual recipients.
And similarly to what you were saying earlier, Rusty, you get your CSV data in a PDF.
It'd be much more convenient if you could get that CSV directly.
In this case, it'd be much more convenient if you could get 70 people's separate files.
But that's just not how they come.
You can't go to the provider generally and say, do something else.
What you get is what you get.
And from various cries of anguish from my wife of hours of doing this and it's era-prone and you're opening up a PDF GUI tool,
selecting the first three pages and saying, save these three as this person's name.
Then the next three and save these three as this person's name and that kind of thing.
It was actually surprisingly easy to use some Python to write them a tool to make life a lot easier on their side,
which effectively opened the PDF.
And I had a comment on the name of it.
What did I use?
PyMoo PDF, which I had never heard of before.
I see you've got that one.
I've never heard of that either.
I don't know.
In fact, I haven't looked at it since I wrote this thing.
I'd forgotten what it was called.
It used to be called FITZ.
There's something called FITZ, F-I-T-Z, which this has become, which is what was confusing me because FITZ is what's in my poetry history in my PyProject.automal file.
And this is actually, it's a remarkable project.
You split up everything in your PDF.
You can basically access all the text fields.
And once I'd done that, it was a lot of kind of trial and error.
I split up each page and printed out all the fields until it looked like the one I wanted.
And when I had that, now it's just a simple loop that goes through each page.
And if the page happens to have the details of an account holder on it, then that's a new document.
Take the ones I've seen before then and save those three pages or four pages as the person's name that I found in the PDF and repeat.
And within seconds, it's spitting out 70 PDF files with automated names.
So maybe not the most best way to do it, particularly if you've got, as is common in South Africa, two or three surname, two or three words in your surname.
It's trying to be smart about it.
But ultimately, it's easy enough to identify who the file belongs to.
And that was saving hours and hours of time.
Yeah.
And that's really rough error-prone work that you go to this big PDF and break it up.
PDF's a bad format.
That's not right.
Yeah.
Once you use a tool like PyMoodie, if you break the PDF up, I mean, it's all, it's little bits of text.
There's a full stock here and there's two commas in separate text fields.
They look perfectly fine when rendered, but when broken up, they're terrible data format.
But the beauty is if for work like this, if a tool made it in the first place, it's likely to be consistent enough that you can break it up and expect to find the same data in the same places because it wasn't written by a human in the first place.
Yeah.
That's super neat.
Another thing you mentioned in the notes is GUI.
GUI, yes.
GUI is a beautiful thing.
I think GUI is really interesting.
I vaguely recall every now and then on Python Bytes, you brought them up briefly.
You don't discuss GUIs much, but every now and then you vaguely discuss that.
Oh, wow.
Yeah.
Yes, actually.
GUI is magnificent.
They come in waves.
GUI.
G-O-O-E-Y.
As in UiGUI, but it creates a GUI GUI for applications.
What I really like about GUI is that when I develop things, I'm very much a Linux-based developer these days.
So I don't really want to be developing a GUI app at all if I can avoid it.
A command line is perfectly fine for what I want.
So I wrote this tool as a command line tool and then just basically attached GUI to it.
And then I think two or three lines of code.
I think it's really just a GUI decorator on one of my functions.
It produces on this.
If you guys are watching it, people on the live stream, you can have this look at GUI.
It just makes really basic looking GUIs in form layout that pretty much taking every option you could give in the command line.
Yeah.
If you wanted to create an app that would come up and show like a UI that would have a little text fields or even drop downs or stuff.
Exactly.
It would be the command line arguments.
Like this is it.
And then you package it up with I2 installers.
Is that right?
That's what I did.
Yeah.
Or PI installer, I think.
PI installer.
Yeah.
Sorry.
You're thinking PI2.exe perhaps.
I'm thinking PI2.app.
You're thinking PI2.app.
Sure.
So PI installer is beautiful.
So with a bit of, I wrote the code.
I got it working in the command line.
I was happy with it.
Attached GUI to it.
And suddenly I have a GUI, which isn't a Windows only thing.
It works just fine on a Linux box too.
And then PI installer to make an exe.
And I can hand a tool over to somebody else.
And they need no Python.
They need no installation expertise.
I'm certainly not going to be able to explain to people who aren't in the technical industry
how to open a command prompt on your Windows machine, find where you put this file, and
then give it command line arguments.
That's not reasonable.
Right.
Oh, yeah.
And also set up a virtual environment.
Make sure you have the right version of Python.
Install the requirements.
Like, this is not going to fly.
No.
Exactly.
Like, why did you not build me an app?
Even at the exe distribution level, I mean, you can make an exe that's command line only,
but no one's going to want to use that.
Unless, like me, you prefer not to ever use the mouse.
But most people aren't like me.
They want a tool that they understand on the screen.
So GUI is beautiful for that.
Yeah.
Yeah, absolutely.
That's awesome.
Thanks for sharing that.
All right.
A couple of live stream comments I'll throw out here.
Got one.
I once worked for almost like three weeks on a project in a company that had commissioned
me.
Then the server crashed.
My backup got fried and I lost everything.
Yeah.
So good reason to put stuff.
Ouch, indeed.
Yeah, I've been there.
Good reason to put stuff up on maybe like GitHub private repos or something like that.
And then also Reginald.
Davis came here to show love to my guy, Jay.
Hey, Reginald.
Thanks for being here with all of us.
Let's see.
So now we're on.
You're up next, Jay.
Awesome.
So like most of us have and at some point in our lives, I built my own website.
I would say I don't think the show isn't going to be sponsored by like Squarespace or anything,
is it Mike?
Because I'm going to I'm going to give you the perfect reason.
I'm perfectly acceptable to let the sponsor.
So I built my site.
I made a static site generator.
And one of the things that my brain is kind of buzzing right now because I actually just launched
a new podcast on Relay FM called Conduit.
And like the first episode went live the same time this live stream did.
So there's like a bunch of stuff happening in my head.
But I say all of that to mention that when you run your own site and you're doing stuff on like other people's podcasts and other people's sites and things like that, and you're doing it consistently, you always forget to put it on your website.
So I built a small tool for my little static site generator that uses feed parser to just check the RSS feeds for the shows that I do regularly and then check for certain information.
If I'm a guest, like if I'm just a regular guest, it'll just check to see if I'm a guest.
If it's there, then it'll it'll create the blog post for me using the summary for the show.
So now I do a show every Tuesday I do, you know, conduits going to be biweekly.
I'm I guest on another show once a month and every once in a while Mike calls me to to get me on here to to I guess share Python tricks and stuff.
But I can have all of that running and just have a cron job for through GitHub Actions that checks all of these RSS feeds every, you know, six hours or so.
And it's perfectly free, perfectly within the realm of it.
And I don't know, it's just one of those things.
It's like I love the idea of taking RSS, which is an amazing but often forgotten format, and just say, let me parse this data because it has a very defined schema on it.
And I mean, I love data and I love data that's well defined.
So that's kind of my tool.
And feed parser is kind of the thing that that really makes that happen in conjunction with GitHub Action.
Yeah, feed parser is super neat.
If you're working with some kind of RSS feed, you could approach it from a like ground up thing.
I'm going to use requests and I'm going to use elementary and do my XPath queries.
And you're like, whoa, but it has just this format, right?
So you could use feed parser and it just turns this into like a dictionary of dictionaries, which is so much nicer.
Yeah.
So you don't have to worry about the RSS format.
Yeah, it's a quick and easy one.
So it's a nice example of taking a higher level Python library, you know,
maybe a good place to look would be awesome Python or something like that to go.
Instead of just saying, I'm going to start from scratch.
You're like, OK, well, I'm going to go over here and find the audio section.
And then over here, I want to do like Liberosa for the audio and music analysis.
And so we're going to go with that and then like see if that's going to solve my problem.
Right.
So I'm trying to start with something higher level.
You know, something I forgot.
Now, this reminds me that I was going to ask you about.
Have you done anything with FoxDot?
No.
So with FoxDot, basically you can write little tiny Python things and build up like almost like a growing symphony of a type of it's super, super interesting.
It's like the sort of interactive and not quite IDE, like a REPL for music.
It's something pretty interesting.
For making music?
Yeah.
For making for like live performance.
So you write these little tiny Python elements to like change the tempo or bring in like a background drum or like now I want this, this sort of bass guitar to come in and add to it.
And the performances of it are really, really interesting.
I'll check it out.
I think GitHub Universe used this for like their intro this year.
Like they had a live DJ that was like writing code to make the actual music live.
It's like so now DJ sets are being controlled via Python.
I love that.
It's fantastic.
Yeah.
I love it.
Just remembering at the end of the 2020 Python ZA conference, which I was attending, was purely online.
There was a DJ set by two Brazilian chaps whose name I've forgotten I can look up, who were also doing basically programmatically controlled or at least generated music similar to this.
It's actually quite an interesting idea.
This is something that kind of builds up over like 10, 15 minutes, but it's really neat if you just want to like have something in the background.
But the fact that the way they do it is really impressive.
Yeah.
Cool.
Rivers got a quick shout out in the live stream there.
I love Rivers.
You're pretty epic.
The Sarah DM says awesome.
Definitely.
We all agree.
Speaking of Rivers, I think you're next.
And before we move on, just Jake, congrats on the new podcast.
That's cool.
I'm already subscribed.
All right, Rivers, you're next.
Michael, hearing you mention Labrosa and FF Probe reminded me that to maintain the tags of all those 1500 demos, I use a fantastic Python package called ID3.
Oh, yeah.
Which makes use of FF Probe and Labrosa.
So, you know, every night my program will run and using ID3, it opens up the tags of all those files and does a ton of maintenance.
I'll access spreadsheets of my managers and see what comments they've left on these demos or ratings.
That's awesome.
And you have automation back over to Google Sheets as well, right?
I mean, that's how I got into coding in the first place was from spreadsheets, especially Google Sheets.
Just getting tired of like trying to work those formulas in those little cells.
I went on, was it Fiverr?
And had some people code me some scripts to help with the spreadsheets.
And then I just started looking at the code.
I was like, well, this is pretty interesting.
And from there, I just got into it on my own.
Yeah.
So, what's the last one you want to share?
Is that there or you got another one?
I love to listen to a lot of music, but also I feel like it's part of my job is to just be aware of new ideas.
And so, I'm just constantly listening to music.
I feel like I don't need to hear a song more than once or twice and then I kind of get it.
And then I just want to hear more new music.
And by new, I mean new to me.
So, there's tons of old records, classic records I still haven't heard yet.
So, it's very tedious to go through the Spotify app every day and try to find stuff for myself.
So, I have an app called New Music that assembles a playlist for me.
First of all, using Beautiful Soup, it goes to all the online charts so I can get like the,
whatever the hot songs in the different formats are, gets a few of those.
And using a package called Spotify.
Spotify, okay.
Yeah.
It accesses the Spotify API and I can access any playlists from there.
So, I go on to all the editorial playlists like Today's Top Hits or Wrap Caviar, whatever it is.
But then I can also access any user playlists, playlists my manager shared with me or playlists I've created.
And I grab a random sample from each of those.
Some of the parameters are hard-coded in that script.
But then I also came up with the idea of creating a front end with a Google sheet.
So, in the Google sheet, I can see one column is all the different playlists I'm drawing from.
And then another column is how many songs I want to pull from there each day.
Another column would be like, how long do I have to wait before a song is allowed to come in again?
That's super cool.
I love how you've automated this to go basically scrape through that.
Because, you know, these streaming services, they're great.
But when you sort of say, you'll play my channel, they really get in a groove of like, here's the 100 songs we've decided you don't skip.
Yeah.
I can also control what songs, what artists, and what genres are banned.
And, you know, with Python, I can create more complex algorithms.
So, like, I only want to hear hip-hop from before 1996.
Except for Kanye and Cardi B.
I'll let those ones through.
Yeah, yeah.
Very cool.
Whatever you want.
I only go to that same playlist every day.
It makes my life a little simpler.
Wow.
That is so neat.
And I, you know, I did not plan this.
I don't know.
This is just sort of some awesome inception thing.
So, I pull up the PyPI listing for Spotify.
And their documentation shows how to get the show list from you, Rivers.
This feels like a setup.
This does feel like a setup.
I have not seen that before.
I think that's a recent change.
Yeah, yeah.
Brian out in the live stream also.
I noticed that.
That's awesome.
And then Zachary the hacker says, Rivers, please tell me this app.
It's available.
This sounds amazing.
I need it.
Yeah, it was one of the very first apps I tried to publish online.
And so, it was super janky.
And I don't think it works at all anymore.
But yeah, maybe.
I found that people didn't use it in the way I expected them to.
Most people, they would say they would just put in the name of an artist or the name of
an album.
And really, it's more useful for sampling from playlists.
Because then you have a much greater variety.
People would just go and put in their favorite three bands.
And the results weren't all that impressive.
Yeah, yeah.
Guess what?
You know, with music from your three favorite bands.
There was a talk last year by Gotham by Angeline Protasio called The Album Discoverer, which
was like an album recommendation system that uses something similar to this.
But it was like going into a deep dive of Spotify's API.
And I mean, I will give Spotify all the props because there's just so much information and
stuff that is like similar to like your previous example, Rivers, where you had these variables
that most people who don't think about music wouldn't think about originally.
Like they're like, is it somber?
Does it have good gut feel?
Like stuff like that.
And you're just like, I don't know how you quantify that.
But at the same time, like the talk was really interesting because it showed like a comparison
of tracks that were in different genres, but had similar feelings.
And it was a really cool example.
And I've been trying to find it online while you when you mentioned it, but I can't find it.
So I'll have to reach out to the PyGotham team and see if I can get, you know, find out where
that link is.
Yeah, I know just what you're talking about.
And Spotify gives you access to all that data.
That being said, I'm skeptical of a lot of it because I've seen the data on my own songs.
And like we covered Take On Me by AHA, which is a very danceable song, especially compared
to a regular one.
Yeah, especially compared to normal Weezer song.
You'd think that would be rated very high on the parameter of danceability, but it's
they rated as one of our least danceable songs.
Oh, interesting.
Very cool.
I love this look at how you're interacting with music because it's really different than
I think a lot of people out there just looking for something in the background.
Cool.
I must admit, I think you're onto something here.
You were saying there, Michael, if you just let Spotify do its own thing, it'll say to you,
here's the things you've listened to again and again and again, including the things
you've always skipped, which we are convinced you'll listen to if you play enough.
But I should be doing this.
I should craft it more deeply to kind of get exactly what I want to listen to or at least
things that sound like stuff I like to listen to.
This is brilliant.
Yeah, absolutely.
And Jesus out there in the live stream.
Welcome, welcome.
There's an awesome app reverse.
Please share so I can get an automated Chimba Wamba playlist.
Fantastic.
Yeah, I agree.
That's a really, really cool one.
All right.
I want to share one.
I'll be really quick since we're at the end.
This is my second one as well.
This brings together a lot of pieces.
It is ridiculously simple.
Like you're almost like, why would you ever do this?
So I built this app and it has a screenshot because it's an app that runs in the Mac toolbar
in the notification area by the clock.
And this is primarily why I even wanted to bother bringing this up because if you've got
these little scripts, like Kim talked about GUI, which is a cool thing you package up as
an EXE you can share.
But sometimes you just want like a little notification thing or something that might listen to a hot
key that can just like live up there.
And so one of the things that I have to do all the time is I'll take the title of a
podcast.
I will take the title of a course video and thousands of them.
And I want to turn that into a file name that will work well.
So I have this little app I called URLify, which is probably poorly named, but it does like
simple little text transform.
So it uses Piperclip again, and I can just click a thing and it'll turn it into something that
would look as like a slug for URL.
So like if it was the playlist with spaces and a capital T, it'll be all lowercase with dashes
and it'll strip out symbols that wouldn't work.
Right.
So that actually turned out to be incredibly helpful because I can always reliably name
stuff the same.
And anytime I put something in, I just copy like the title of a presentation and then I
hit that button and it turns it into the, just the right file name.
And then that app I talked about before, it'll actually read that in the reverse engineer
it back into like, like a title, like with case, the right casing and stuff again.
So it actually sort of comes all around about, but the thing to build this is there's this
app called rumps and I'm just be careful when you search for this, I'll link to it rumps.
And it's an acronym for ridiculously uncomplicated macOS Python status bar apps.
So glad it has a shorter name, but just like GUI, like there is a full on application on the
screen here that you can find on the, the PyPI listing, which I don't know, what's that?
12, 15 lines of code.
And you've got a notification app that pops up little macOS toast runs as a .exe, not
a .app in your Mac bar there, which I built the .app with, Py2 app.
So yeah, that's two really cool things to put together to just like, I want something that's
always up in my Mac bar.
There's probably something like this for the taskbar and windows, but I haven't found it.
So,
That sounds like a great little free course.
Yeah, it does.
It does.
Maybe I should just take a week and fill it down.
I've actually been thinking about building like little notification app, like a simple,
simple GUI, like GUI, GUI at G O O E Y.
And like this, and maybe that taskbar one.
You can fork archive project that I have then.
Cause I actually used rumps to make like a, like we've all seen those little timer apps
where you can put a bunch of dates in and it'll tell you like how soon until that thing was
happening.
Yes.
I made an app called wins at that.
I just like put on GitHub and it was just like, I'm not going to develop this anymore.
So I'll send you the link for it, Michael.
But the thing I like about this is there are so many tools that just do the thing and do
it like really simple, really quick.
And when you think of stuff like, what is it?
PipX, where you can just call a command directly from your command line and it just runs and
does the thing.
Like that's always nice.
And then doing things like rumps where it's like, okay, I want to do this thing normally,
but I want to put it up in my menu bar so that I can just take a quick look and see it.
I think it's super awesome to, you know, we've talked about these big programs or these things
that change our lives, but sometimes it's even just like the little things that you can
look to see when, how, you know, how soon before your anniversary is coming up so you
don't forget it or like, Hey, when is that big meeting that I'm supposed to be preparing
for?
When is that big conference presentation or when a CFP deadline is due?
And you can, you can just make a little applet that you just run every now and then and get
results like that.
Yeah.
You're making me think that the next one that I want to build is one for when I go live
stream on a recording.
I want to send out a tweet.
I want to update the website.
So as a little banner, we're live streaming right now, all those kinds of things.
That just seems like another one up there.
I just click.
I like a little button that opens up my Jupyter notebooks, you know, like I always have to clear
my desktop all over.
So I would, I would take the time to make something like that would be cool.
Yeah.
That'd be super neat.
All right, guys.
It looks like we're a little bit over time, but so many interesting things.
Thank you all for being here now, since there's so many of us, I'm not going to, and I think
we've all just, this has basically been the entire show, like these little libraries.
I normally ask, you know, what's your favorite PyPI package you want to recommend?
But like, we've got 30 of them.
So that was a show.
It was awesome.
But just really quick, I'll go around for the final question.
Favorite editor.
Start VS Code again.
Rusty.
Right on.
Kim?
Emacs still.
I'm probably always.
Emacs.
Right on.
Yeah.
You like to type on an operating system that is itself artificial intelligence.
Pretty much, yeah.
Yeah.
Reverse.
VS Code.
Okay.
Right on.
That's a good one.
Jay?
The war begins, Kim.
Vim.
Well, Vim you said at least.
At least you're using the M version.
Neo Vim.
Yeah.
Neo Vim, I should say.
Awesome.
I can tolerate Vim.
Basically, yeah, I can tolerate it, but if I have to very, very slowly get things done.
Because basically the problem, and I'm sure you've, this probably happens less to Vim guys.
If you're an Emacs guy, then you remember the key bindings for Emacs, and VI is what's on the really primitive servers.
And you cannot remember how to make it do things because you keep pushing the wrong buttons because your fingers remember Emacs commands.
The same would probably happen to you, but you probably don't necessarily have to use Emacs very often because VI is everywhere.
Yeah.
If I have to use a text editor, there will be like HJKLs just all over the place because I think I'm in normal mode.
And I'm just like, oh, no, it's just typing.
Yeah.
I'm reminded of the joke.
Like, how do you generate a random string?
You give a first year computer science student Vim and you tell them to exit it.
Yes.
All right, you guys.
Thank you so much for being here.
It's been really great.
Everyone is doing such neat stuff.
And I'm sure we're going to inspire a lot of people, even ourselves.
Like Rusty's like, I need a button to launch on my Jupyter Notebooks, right?
I'm going to do one for live streaming.
So thank you.
Thank you all for being here.
It's been great.
Thank you.
Thanks, Michael.
That was fantastic.
Thank you, everyone.
Yeah.
You bet.
Bye.
This has been another episode of Talk Python to Me.
Our guests on this episode have been Rivers Cuomo, Jay Miller, Kim VanWaik, and Rusty Gregory.
And it's been brought to you by Linode, us over at Talk Python Training, and the transcripts
are provided by Assembly AI.
Simplify your infrastructure and cut your cloud bills in half with Linode's Linux virtual machines.
Develop, deploy, and scale your modern applications faster and easier.
Visit talkpython.fm/Linode and click the create free account button to get started.
Transcripts for this and all of our episodes are brought to you by Assembly AI.
Do you need a great automatic speech-to-text API?
Get human-level accuracy in just a few lines of code.
Visit talkpython.fm/assembly AI.
Want to level up your Python?
We have one of the largest catalogs of Python video courses over at Talk Python.
Our content ranges from true beginners to deeply advanced topics like memory and async.
And best of all, there's not a subscription in sight.
Check it out for yourself at training.talkpython.fm.
Be sure to subscribe to the show.
Open your favorite podcast app and search for Python.
We should be right at the top.
You can also find the iTunes feed at /itunes, the Google Play feed at /play,
and the direct RSS feed at /rss on talkpython.fm.
We're live streaming most of our recordings these days.
If you want to be part of the show and have your comments featured on the air,
be sure to subscribe to our YouTube channel at talkpython.fm/youtube.
This is your host, Michael Kennedy.
Thanks so much for listening.
I really appreciate it.
Now get out there and write some Python code.
I'll see you next time.