You know that feeling when one of your developer friends or colleagues tells you about some
amazing tool, library, or shell environment that you never heard of and that you have
to run out and just try right away?
This episode is jam-packed full of those moments.
We welcome back Jay Miller to discuss tools and tips for developer productivity.
The title says 10 tips, but we actually veer into many more along the way.
I think you'll really enjoy this useful and lighthearted episode.
This is Talk Python to Me, episode 345, recorded November 17th, 2021.
Welcome to Talk Python to Me, a weekly podcast on Python.
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.
We've started streaming most of our episodes live on YouTube.
Subscribe to our YouTube channel over at talkpython.fm/youtube to get notified about upcoming
shows and be part of that episode.
This episode is brought to you by Coiled and CockroachDB.
Please check out what they're offering during their segments.
It really helps support the show.
Jay, welcome back to Talk Python to Me.
It is always a pleasure to join the show and hang out.
Yeah, it's a pleasure to have you here.
You help out with all sorts of things and it's been great to bounce ideas off of you.
I've had you on the show a couple of times, literally two times so far, I believe.
How many more before I get like that golden jacket like they do on SNL?
You get the golden jacket after 10.
This is a really...
After 10?
Wow.
It is a commitment to get the jacket.
Wow.
Yeah.
Well, we'll pick up the cadence here and we'll get you the jacket.
I mean, you're a third of the way there, basically.
All right.
I got goals now.
Before I retire from the Python community, I will have my golden jacket from Talk Python.
That's right.
Oh, man.
If you come on 10 times, you are getting a jacket.
I'll figure out how to get one of those.
I'll demand one.
Thank you for being here.
This episode is going to be something of a reversal, but not 100% reversal.
I've got all these ideas about developer productivity.
I've been bouncing around and I want to share them with the audience.
And so we're going to kind of share those together, right?
I'll present them because it's my idea.
I don't want to force that recommendation coming out of anyone else or you in particular.
So I'll present them and then we'll discuss them, right?
So you'll be both the guest and the sounding board.
How's that sound?
I get to be the Simon Cowell to your performance.
I love it.
Yeah, exactly.
Well, hopefully you're in a good mood because Simon, he can be tough sometimes.
We'll see.
We'll see how it goes.
I've seen the talk.
I think there's a lot of great points in there and some stuff that I immediately was like,
oh, and then I heard you explain.
I go, actually, you know, that's not a bad idea.
Maybe.
Well, you know, you let me know where you disagree because a lot of these things,
one thing that works for one person is exactly the wrong thing for others.
Now, before we jump into it, though, you know, you've been on the show a couple of times.
The most recent time we were on, we talked about little automation tools, which was super fun.
We had you.
We had Rusty, we had Kim Van Wick, and we had Rivers Cuomo, of all people, who did a fantastic job on the show.
So that was really fun.
And I feel like that's a really good lead into this conversation here.
Before we get to it, though, for people who don't know you, it has been a little while.
When was that?
That was back in July since you've been on the show.
Tell people a little bit about yourself.
Yeah.
So I'm Jay Miller.
I'm a developer advocate for a company called Elastic.
We do Elastic Search.
I also do podcasting and a lot of productivity automation.
And you can usually find that stuff over either on Relay.fm, where my podcast lives,
or on YouTube, where I'm often talking about different productivity tools around the macOS ecosystem
or the iOS ecosystem, mostly Mac.
And I guess the biggest difference there is I don't shy away from the programming-friendly stuff.
I am the more that I can hack in, you know, shell scripting, Python scripts, even Swift from time to time, like, bring it on.
I am here for it.
And yeah, so you're not, you're not, you're going to see some software recommendations from me.
But I often tell people like, let's use what we know, build what we can, and ultimately just make things that work for us.
And it's kind of me.
That's kind of what I do in my day-to-day.
That's awesome.
If it's got to be solved with if this, then that, then let it be solved that way, right?
Absolutely.
Yeah.
You want to give a quick shout out to your podcast in particular, Conduit?
That's kind of new, right?
You also did the productivity podcast before this and then transitioned over here, right?
Yeah.
So before I did a show called Productivity and Tech, it was, you know, just a general productivity conversation with people around the tech, I guess, lowercase word, tech ecosystem.
Just learning how they did things and how they were more productive.
Somewhere along the lines, I found my co-host for my current show, Kathy Campbell.
And we do a show on Relay.fm called Conduit, where we talk about productivity, but make it so that it fits no matter what tools you're using.
We don't, we don't like to, we do like to make up, you know, our own different funny names for things, different techniques and tools and stuff.
But ultimately the idea is whether you like GTD, whether you like bullet journaling or whether you absolutely have to build to-do lists and Visual Studio code, like whatever you're choosing to do, like hopefully we can provide some guidance on how to do it to the best of your abilities.
Yeah, that's awesome.
We all have different tools.
I remember being in one high-level meeting with some executives and such, and they said, for some reason, my screen was being shared because I was demoing something.
And I said, Michael, can you just go ahead and take some notes on this?
I'm like, yeah, sure.
So I fired up VS Code in Markdown mode and just started taking notes.
So I go, okay, I see how we're taking notes here.
This is very, like, I didn't know they expected like one note or something.
I don't know what they wanted, but yeah, like, no, this is how we do it.
We're doing this.
Yeah.
I mean, you'll often hear me talk.
I'm a notebook pen and paper person.
So when it comes to managing projects or tasks, I'm often starting in my notebooks and then I'll move it over to a digital format.
Like if I need to share it out or something like that.
Yeah.
Right on.
Also from the audience, Jaylee says, please make that golden jacket a thing.
Goals.
We got goals.
I think so.
It's easy for me to stand behind this because I'm pretty sure we don't have any 10 time repeat guests.
I've put the bar pretty high, but we'll get there.
It'll happen.
It'll be awesome.
I feel like I'm in the race with people like Rusty Van Wick and Anthony Shaw and maybe Brian.
I feel like Brian can sneak his way on.
Brian does sneak in periodically.
He's an easy one to reach out to and like, hey, we got to cover this topic and I can't find somebody.
You want to drop in and do it?
Yeah.
Awesome.
So what do you think?
Should we jump into the tips straight away?
Let's do it.
I'm excited to do.
Awesome.
Well, I think there's a lot of little things that you pick up when you work in software.
And I feel like you and I share this belief that software is the superpower to whatever you're actually trying to do.
You talk so much about, oh, I found this cool tool to automate that.
You've even created mail through automation and stuff like that.
It's beautiful.
Yeah.
You know, I think the coolest part about tools is that they are that.
They're tools.
I love artists that are able to take a tool that wasn't designed for that thing and make something truly beautiful with it.
Like, I mean, the first time I saw like Bob Ross on like TV, you see some of the brushes that he uses and they're not like these little ones that you used in like your high school arts class.
They're like shop brushes that you would use, like paint a fence.
And like somehow he could still make these crazy pictures in like 30 minutes.
That's where the happy trees come from.
Exactly.
Awesome.
So the things we're going to cover here, they're like that.
They're a bunch of little things and I specifically chose them because I thought they're incredibly easy to try out.
Right.
They're not like, oh, you know what you should do?
You should move to a no SQL key value store database.
That would be better.
You're like, yeah, no, that's like a month.
And then we have to live with the consequences.
Like, so everything that we're going to talk about here, I believe is something you could try out really quick and say, yeah, that's cool.
Actually, no, maybe not.
Okay.
And if we got some time, I'm going to throw in some extra ones there.
I think everything here is free except for like one or two things.
So like, absolutely.
Your download manager like might get exhausted, but your bank account won't.
Exactly.
So the first one that I wanted to start out with, and I feel like this is a very bimodal distribution is shells or terminals or command prompts, depending on your origin, where you're coming to think about these things.
And I say bimodal because I feel like there's one group of developers that lives in the shell even more than me by quite a wide margin.
They're incredibly talented there.
And then there's a whole group that are just like, well, whatever is on my system, that's what I'm using.
What do you think?
What would your estimation on that population be like?
It's tough because I think as the community continues to grow, you're going to have more and more people that are not back in my day.
We we had the green screen with the blinky dot, you know, like I don't think you're going to have as many people that are doing that.
And I don't think that's necessarily a bad thing.
I think the first programming thing I learned was like when I was like eight or nine and like my grandfather was using Eclipse.
And it's like I don't go anywhere near Eclipse now.
Like that is not that's not me at all.
But nowadays, like even in my IDE, I find myself often going into Vim to make changes like in my IDE instead of just clicking on the file right there, making the change.
It's like, oh, I know I can do this faster just from my muscle memory.
So I think I think having at least some knowledge of, you know, if I need to dig into the shell, I can.
And I think that was actually, you know, one of the things you talked about here was using different tools to augment the shell.
I think that even if you're not going to go in there a lot, at least when you have to go in there, make it make it at least enjoyable.
Yeah, there's a bunch of little tools.
And there really seems to be a renaissance of the tools around the terminal.
We've got things like Rich and Textual, allowing people to make really cool apps there.
We've got OhMyZShell, OhMyPosh, a bunch of things there.
Some stuff called Big.io.
I'm not totally sure I want to make a recommendation for it yet, but I'll sort of bring it out there and so on.
And so, yeah, so my recommendation was if you open up your terminal or command prompt, if you're on Windows and you're still using cmd.exe, if it looks like the way it looked when you got the machine, there's a problem.
You're doing it wrong.
If it if it just comes out of the box and it's just cmd.exe, that's what you're using.
Or if you just open up macOS and it's the white bash, like you're missing out on so much.
Yeah, Brandon Brainer out there in the audience says, I'm using Fig and it's pretty awesome.
I just started checking out Fig.
I'll pull up Fig in a moment.
We'll talk about that.
So on one hand, there's a bunch of people who are incredibly talented, but there's also all these things that support being more efficient on the terminal.
So for example, I'm a big fan of OhMyZShell, OhMyZSH at OhMyZ.sh, which I learned that macOS now switched to ZShell as the default terminal.
So that's interesting.
But that means it's even easier to install OhMyZShell because you've already got ZSH or ZShell.
And there's just so many little nice tricks.
Like if you go into a directory and that directory happens to be within a Git repo, you get information about your Git repo right there in the prompt.
It tells you what branch you're on and what repo you're in and all those kinds of things.
If you can get it to say things about like the Python version that you're on and so on.
Do you ever use ZShell?
Yeah.
What do you use?
Oh, I use OhMyZShell.
Absolutely.
Like it's to me, if I'm not using it, I immediately know because of like, it's like, wait a minute, what's happening here?
I'm typing stuff and nothing's happening and I don't get it.
I hit tab and it didn't help.
Or I hit, I typed a few things to hit back here and it just went back to the previous command.
This is broken.
So, so we can't, I can't give you the name on it because I guess we'll try to be a family friendly episode.
But there's one of the things I like about OhMyZShell is that they have these plugins that do a lot of the configuration for you, which is already a big help.
Like the fact that I don't complete and all sorts of things.
Yeah.
Not even that.
Just the fact that I don't have to go into like my like ZSHRC and then put a bunch of like path statements and this crazy shell scripting to make things work.
I can just go to the plugin section and type something in.
But one of the things that one of my favorite ones, the command for it is WTF.
So if you know, you know, but the way that it works is if you type in something wrong, like if you mistype it, if you type in the phrase, the magical phrase, it'll go, Oh, I think you meant to type in this.
And you can just hit Y and then it inputs it in for you.
So like if you can't remember, what's that one weird command that you have to use if you're using something like said or awk, which I will.
I have another suggestion if you're using those still like you can be like, Oh, I think you meant awk slash this not awk slash this other thing.
Yeah.
Like, yeah, that's what I meant.
That's awesome.
There's one also that is the spelling out of the last of those three letters.
Yeah.
In there.
And you type that and it'll say, did you like if you do like a get checkout and it meant get branch or something like that, it'll you can just type that and go, did you mean this?
You say yes.
And it'll fix it.
Yeah.
It sounds similar as well.
That's awesome.
Yeah.
And things like fast D and ASDF, like ASDF, I'm sure we'll talk about later, but fast D, like the fact that you can do like things like fuzzy searching, you don't have to remember the exact path.
You just know the name of the directory you want to go into.
You hit Z space, the name of the directory, hit enter, and then now you're in that directory.
And if it ever messes up, you just hit tab and then you can manually set it to whatever you want it to be.
So in the future, it doesn't mess up again.
To me, it's like you're missing out on a very modern and clean browser experience if you're not kind of unleashing it with some of these extra plugins.
And Oh, my Z shell is the way to start with those.
To me, it feels a little bit like I'm programming in Notepad versus I'm programming in PyCharm or VS Code.
Like, why would you not want all this stuff that can help you with what you're trying to do?
Okay.
If you just take the base one.
All right.
So now if you're in Mac, I think macOS has the best shell of all the OSs.
And then you've got Linux.
There's a lot of good stuff there.
They're very, very similar.
But then if you're on Windows, I felt like that's just a different world, right?
It's just you're not meant to be on the terminal command prompt that much until recently.
So Microsoft released this thing called the Windows Terminal, which I started using on my Windows machines.
And I really like the Windows Terminal.
There's a bunch of good stuff in there.
And in particular, you can install Oh My Posh on there and get fantastic similar experiences over on Windows Terminal plus Oh My Posh.
Yeah.
I haven't gotten to play around with the new Windows Terminal experience.
But everything that I've seen makes me really impressed with what they've been able to do in the last few years.
Yeah, totally.
And you can set up Windows so that if you just say open command prompt, open terminal, the default terminal is the Windows Terminal.
And then within Windows Terminal, you can set up the new PowerShell, the PowerShell 7 or whatever it is, not the old school PowerShell 3 or command prompt version.
So it'll also drop in to like the latest version with Oh My Posh set up.
And then you're in a pretty good place on Windows, actually.
Yeah.
And I guess on Mac too, I mean, Terminal is fine.
Use iTerm.
Like iTerm 2, it is...
Unless you're using data of some sort, I would highly suggest iTerm 2 to replace it.
This portion of Talk Python is brought to you by Coiled.
You already love using Python to build your data science projects, but training models and working with tons of data on your laptop is limiting to say the least.
But that does not mean you need to learn new cloud APIs or buy expensive and hard to acquire hardware.
Just use Coiled.io.
Coiled supercharges the tools you already use for scale and performance, so you can use Python for your ambitious problems.
In the words of Eric Ma, principal data scientist at Moderna, quote,
Quite literally, burst into the cloud from your laptop.
Everything I've been dreaming of since grad school, unquote.
With Coiled, you really can burst into the cloud with a few clicks and stay focused on solving the important problems.
Adding Coiled to your project takes less than one minute.
So what are you waiting for?
Get started today.
Just visit talkpython.fm/Coiled or click the link in your podcast player's show notes.
A couple other things.
We're going to spend a lot of time.
We're going slow, but we'll make it.
We'll make it.
We've got a lot of stuff to cover.
This is the most exciting one for me because it's like, oh, you want recommendations.
I'm here for it.
Yeah, absolutely.
Oh, it's so good.
Yeah.
If we spend a lot of time here, I think that's also totally fine.
So one of the things I much prefer about all my Z shell over, say, bash is I could type git git space and hit the up arrow and it'll only show me stuff that started with git.
So if I'm like, all right, what were the git commands I recently did?
I hit up arrow, up arrow, and it'll cycle through them.
Very common, like SSH.
I'm like, I need the third server I was recently on.
I don't want to type it.
So SSH space, up arrow, up arrow, up arrow, enter, right?
And that's really good.
Something I've been using for about a month now that's really neat was recommended to us by somebody listening to Python Bytes.
We covered it there.
Was it McFly?
Are you familiar with McFly?
I'm not.
And now I want to know because I have a very specific wish that ohmyzshell would do.
And if this does it, I will insta-download it.
Okay.
First thing that makes this nice is it integrates in a non-conflicting way with ohmyzshell.
So I have McFly and ohmyzshell working together.
Okay.
So McFly, what it does is if you type normally, if you type control R, it'll go to a reverse search on Bash or zshell or whatever, right?
And that's, I find, to be very useless.
I've never done that.
Yeah.
You know what?
I'll tell you what I do.
I'm like, oh, I tried to type something else and I accidentally hit it.
I'm like, darn it.
I got to get it out of this thing.
I know that you can search for stuff historically and it's useful.
But what I already talked about with the up arrow stuff, that's like the way I go through history.
And zshell, like, ohmyzshell, really nice.
But this, imagine if you could just say, actually, what I want you to do is use artificial intelligence, a context, and fuzzy matching to show me a dropdown, Emacs-like experience for my history that I can then run.
So what you can do is you can type a part of a command and hit control R and this replaces your control R with this, like, full screen select mode that'll show you all the stuff, which is really cool.
The stuff that matches.
And it doesn't have to just be the beginning.
It can match in the middle of strings and commands.
So you're like, oh, I checked out this branch.
I don't remember where it was.
Or you just type part of the word of the branch and hit control R and then boom, there's all the commands you ever issued to that branch, basically.
Which is fantastic.
It uses context.
So if you're in a certain directory or you had just typed one command that's usually followed by another command, it'll give you different ordering on your history, not just the order you typed in.
But, like, usually go to this directory and type that.
So you're in this directory.
You ask for help on it.
So we're going to suggest that one first.
Isn't that cool?
See, that's the exact problem that I had was the directory sensitive, like, context.
I mean, I guess the big example for me is if I'm building something in, like, Flask, I often use something like Tailwind CSS to do the styling for it.
And I need to reload Tailwind from time to time to add the changes.
And, you know, on some project, I might put that CSS file in, like, static CSS Tailwind slash Tailwind CSS or something like that.
And the other one might be in, like, static Tailwind CSS.
And the thing I need to remember is when I do NPX Tailwind CSS output, whatever that file name is, I always mess it up.
And I always put it in the wrong folder.
So if I knew what folder, like, based on history it was supposed to be in, like, to me, that solves that problem.
Yeah.
I don't know how well it'll work there, but that's one of the types of things it takes into account.
You can also optionally turn on fuzzy matching and some other stuff.
So, so far, it's been working pretty well.
I'm pretty, pretty psyched with it.
So, yeah, this one's fun.
I would recommend people check it out.
It's been working well for me.
I'm going to give this a shot, but I have one that I recently just started using.
And I think that this is, this might be something that a lot of folks have had issues with.
Have you ever tried to do, like, a grep for something, and then you find the thing that you're looking for, and then you're like, wait, but now I need to go and replace that thing?
How do I do that?
Yeah.
Like, I found a program called Amber, which has two commands to it, AMBR and AMBS.
And the way I think I sent you a link in, oh, it's a link in the doc there for you.
But AMBR is a replace and AMBS is a search and everything else is basically the same.
And it uses that grep-like feature.
So you could do AMBR for, sorry, AMBS for search.
And then type in what you're searching for, what file directory you want to have it search through.
It'll do some nice, you know, stylized matching.
And then when you're ready to replace it, just hit up, replace the S with an R, and then add whatever you want to change it to.
And it'll just go in and make that change.
So like, if you don't have to remember, like, how does sed work or how does awk work?
It's like, you know what?
Just AMBR, I found what I'm looking for.
Or in AMBS, other way around.
That's the one thing I will say is I get them confused and mix them up when I'm talking about it.
But you don't have to remember two different languages.
You just have to remember, replace one character with another and then add whatever I want to do as my substitute.
Oh, that's pretty nice.
Yeah, I haven't heard of this.
This is great.
So another one, the one that Brandon talked about that I mentioned was fig.io.
This one is new and interesting.
So with tools like PyCharm and VS Code, as you type things, you get autocomplete dropdown.
What if you could have that as part of all of your shell?
That's what this fig thing is.
And it has crazy integration, like all sorts of coloration and stuff.
And to the point where I have a bunch of custom icons I put for certain folders so I can find them more quickly.
When it shows the folders, if I type cd space, like GitHub space, like talk and start to type top Python,
it'll show the top Python icon on the folder.
It's autocomplete in the terminal.
Like it's ridiculous.
See, this is where like I wish that there was like copilot for just working through the shell.
Like I just start typing something.
It's, oh, you meant to do this.
And it's like, yes, exactly.
And I hit okay.
And I'm good.
So I was trying it.
They updated today.
It broke some stuff.
I got frustrated.
I've only tried it for one day.
So it's not a real recommendation.
Brandon seems to like it out in the live stream.
I thought it was pretty cool.
But I can't give a full recommendation.
But I can tell you to check that out.
All right.
So that was a bunch of stuff for just the shell.
But I think this is really one of the things that's super important.
I'd also like to point out, was it Starship?
Is that the one?
Yeah.
Starship was the reason why I specified use iTerm if you're not using some type of emulator.
because Starship is actually pretty cool.
Yeah.
That's the one Brett Cannon definitely recommends all the time.
And I definitely admire his recommendations.
So this is another one.
If you're not on the Oh My Zoo Shell bandwagon, that sounds like it'd be pretty good.
This one's more about the prompt and not the whole shell.
So you can like swap it from place to place, which is also pretty cool.
All right.
Ngrok.
Have you done anything with Ngrok?
I haven't.
Please.
Like I was taking a look at it and I was like, this seems amazing.
But I also don't know if I have a need for this.
Ngrok.
Is it .com?
Yeah.
Ngrok.com.
So there's this, there's like three or four scenarios that are just so painful that this
hauls so well.
So Ngrok is a tool that's free, but also has a paid plan.
It's like a hundred dollars a year.
They get a hundred of my dollars every year because it's extra useful what you can do with
the paid plan for me, but maybe it's not for you.
So you can try it for free.
So let me give you a scenario.
I'm working on rewriting the credit card e-commerce system of Talk By Line training.
Yeah.
Okay.
And the way this new site that I'm at a new service I'm going to integrate with tells me
somebody bought something because you don't want to do all the processing on your server
because then you have PCI compliance and all that stuff.
Like they do the processing and they let me know and I take the person to where I tell them
they need to go.
The way they let me know is they do a web hook, a call into my server with the results.
And then I create the access to the course and then redirect.
And then when they go to that place, they have access to it, for example.
Right.
So I've got to debug this and I've got to debug their server calling into my server.
And you're like, well, how do you do that?
Right.
So one terrible way would be to like open up your router and put your computer straight
on the internet.
But with Ngrok, you could just say Ngrok, I want to accept HTTP messages to my local machine.
It opens an SSH tunnel out.
So I don't have to open any firewalls, any ports.
It can be as complicated on the way out of town as it wants to be.
And then it listens on Ngrok.com for an HTTPS URL that then is SSH tunneled back to my local
server.
So I put a break point in PyCharm, go to their little app and type in my stuff and say, test
this purchase.
And then boom, paused in PyCharm, pausing their server request as I'm going through.
See, I thought about something like that.
And as soon as you pulled up the site, an actual use case for me popped up.
And a good example of this was, you know, doing the developer advocate thing.
I often have like builds of stuff, servers, you know, Docker composed instances.
And I keep all of this on like a Mac mini at my house.
And the one time I actually needed it and it kind of, you know, bit me in the backside was
I was in LA for KubeCon recently.
And I was like, oh no, I want to do this demo.
But all of my database stuff is like on my server at home because, you know, we haven't
been going anywhere for like a long time.
So yeah, you forgot what it meant to leave the home.
Exactly.
So had I had something like this, I could have just said like, you know, open up access on
this port and this port only and say like, hey, now I can actually access data on my home
server and keep all of my configs the same instead of doing what I had to do, which was like redownload
all the data, open up a cloud instance and then, you know, move everything to the cloud
and then get a call from our company saying, hey, you, you, your bill went up like several
hundreds of dollars with the gives.
And it's like, oh, sorry.
I was downloading gigabytes and of data and left it on.
Yeah.
On conference wire on conference wifi nonetheless.
Yeah.
So you don't even have to open up ports.
It just like you run this and then it, it, it SSH tunnels in reverse back.
Oh, that's really, really awesome.
So, and you can just leave it running for days if you want.
Another example is when we were debugging the mobile apps for viewing the courses, we just
told it the URL was that opened up the phone.
It didn't matter if we were on LTE or whatever, hit a button and boom, break point again.
Another one that I think this would be really helpful for is, Hey, I'm in this standup meeting.
I want to show everybody this new feature we added to the website, but it's only on my local
version.
We haven't deployed it, but you don't want to show it over Zoom.
Cause like the animations look crappy and all that just and grok it, give everybody in
the meeting a URL and they can interact with it live with all like the JavaScript fanciness,
but it's running on your server, right?
It's just the latest one.
It's beautiful.
I was, I was thinking about that in terms of like, what's the, what's the overall latency
of what is happening there?
Because in my mind, I'm, I'm like this, this is the better way to, to show people things
is like, you can go to this website and you can play around with this.
And at the end of the day, like you just close the end grok connection and you know,
it's all done.
You don't have to control C and like you're off the network again.
Yeah.
I might have to play with this as soon as we're off this call.
Cause I have a demo that I have to do soon.
So yeah.
It's awesome.
One of the things you get with the paid plan is you can create a stable URL.
Whereas if you have a free one, it always resets the URL.
So you got to like reshare it, which might be fine.
It might actually be good, but yeah.
That's good for me.
I needed to reset on its own.
Yeah.
So instead of trying to set up some crazy server setup at home and trying to do like router
NAT routing, which you probably don't want to even expose your, your server to the, or your
machine to the internet, just fire up an ingrock session.
Good to go.
I really think this is a, I've been using this like all week and it just reminds me how much
I love it.
I'm like, yep.
It's just set the sandbox URL to have my ingrock endpoint instead of the production endpoint.
And boom, it's good to go.
You know, one of the things that I was thinking about as a productivity tip is very much for
the beginners out there.
Like I, I have always struggled in the idea of like, Oh, what do I do with all of this server
admin stuff that I don't want to have to do?
Um, I remember how intimidating that stuff was.
Yeah.
And, and I think that this is, you know, it's, it's kind of a good segue between, you
know, the next topic that you're going to talk about and this existing one.
And that's like the idea of like you, it's okay to embrace, you know, not necessarily the
serverless ecosystem, but like the power, like the past product as a service ecosystem
to where like, Hey, I just want to build my app and I don't want to be a, you know,
sysadmin.
Can I do that?
And now with stuff like Netlify or sell digital ocean has a thing now, like Heroku, Heroku.
Yeah.
Like taking advantage of some of those things or even doing something like in grok that you
can spin up when you're done with it, tear it down.
I think that was actually a tip on the, the last time we were in this call is like, I often
build admin consoles and flask, do them locally, have them connect to my servers offsite to do
any database changes.
And that way I know for a fact, I'm not leaving anything secure open because I'm just doing localhost.
It's sending the API calls.
And when I'm done and I close the terminal, it disconnects and there's no more access unless
someone has my API keys.
I'm not putting anything up on a server.
I'm not putting anything up in GitHub and I don't have to maintain it and be worried about
it.
I can just go, Oh, Python app.py enter, and then go to localhost 5000, make my changes and
then close it.
And then cool.
Got access.
Don't got access.
That easy.
This portion of Talk Python to Me is brought to you by Cockroach Labs.
Let me ask you a question.
What if you could build like big tech?
Use the same powerful infrastructure that they spent engineering centuries building.
It's actually possible with CockroachDB.
The founders has spent the last eight years creating a cloud native distributed SQL database
that provides the consistency, ultra resilience, data locality, and massive scale for modern
cloud applications.
Tech that was only once available to the likes of Google, Facebook, and Netflix.
The easiest way to kick the tires on CockroachDB and feel the power of a distributed SQL database
is to sign up for their serverless database over at talkpython.fm/cockroachDB.
With CockroachDB, you'll get automatic scale without breaking your budget.
The storage and transactional volumes automatically scale up and down to meet your application's
demands.
You get a familiar SQL interface that's compatible with Postgres.
Zero downtime.
The ability to make schema changes in production with no interruption.
And even a generous free tier.
You get up to five gigabytes without even entering a credit card.
With their credit cardless free tier and Postgres compatibility, you owe it to yourself to check
out CockroachDB.
Just visit talkpython.fm/cockroachDB or click the link in your podcast player's show
notes to get started.
Jaylee out there also says, I'm using Ingrock to work with my RPI, or Raspberry Pi.
Raspberry Pi, yeah.
Yeah, for home security services.
Works great.
Yeah, that's another thing on devices that aren't necessarily listening.
You can get them to sort of push out and then start listening again on the public internet.
Yeah, there's a lot of good use of it.
Told you, it's Ingrock thing.
It's a thing of beauty.
All right.
So another thing that I think, speaking of people who are beginners and struggle, right,
has to do with security, right?
You push something out on the internet, you know, who knows what's going to, how quickly
will it get owned, right?
It's not going to be good.
And there's a bunch of recommendations from OWASP that they say, look, these types of things
we found to be common vulnerabilities that websites have, like injection, cross-site scripting,
other things like if you don't explicitly disallow it, people can take your site and embed them
in an iframe and then wrap other stuff around it, right?
Like go to your login screen, but actually overlay something that captures the keystrokes
or other weird things, right?
So how do you keep track of these?
How do you prevent them?
So this thing called SecurePy is fantastic.
And it's got the most amazing PyPI name, just secure, like how they got that name.
I have no idea.
That's incredible.
But it integrates.
One of the things I like is it just, it's like a couple of lines of code to integrate
into whatever framework you're using.
So Quart, Responder, Sanic, Flask, FastAPI, Django, Pyramid, AIO, HTTP, like all of these
things.
And it's just a couple of lines of code to get it integrated.
Usually it's some kind of like middleware type of thing that you wrap it up with.
And so in order to use it, all you have to do is create one of these secure headers.
And then you set a couple of values like whether or not you want to allow cross-site scripting
and things like that.
And then what it'll do is it'll automatically put all the security controlling headers into
the response coming out of your website.
So for example, X content type options, no sniff.
Did you know any of that?
Want to protect against that X frame thing or iframe?
X frame options, same origin.
So you can do it with no one else.
Things about the referrers and so on.
Cross-site origin for JavaScript and whatnot.
So it's super easy to integrate with what you're doing.
It also has like a tamper-proof cookie type of option for doing that as well.
So what do you think of this one?
So I know when I first saw this, I was like, oh, what is this obfuscation of like what's
happening behind the scenes?
And, you know, I literally just talked about this 30 seconds ago.
Like, oh, you don't want to have to think about that stuff.
Yeah, I'm going to completely walk that back.
And like in my own projects like that I'm building, it's like I want to know what's happening.
I just don't want to have to maintain it.
Yeah.
Which is like, yeah.
And that's kind of where you actually, your response in like showing how this works and
showing like it's just adding the headers on that it needs makes me feel a lot better because
I mean, I'm in a DevOps space where we're like, we do a lot of like APM stuff.
And I just got off a live stream where someone was like, yeah, it just connects to your platform.
And it's like looking and digging and getting like logging of all of this stuff that like
is a dependency of the tools that you're using.
And it's like, oh, that's kind of, I mean, it's cool.
Should it be doing that?
I don't know.
I mean, it's great because I know that I can drill down and see where the problem is.
But at the same time, like I want to know that it's doing that.
And that's my concern with tools like this.
But I will always say leave security to people who know security and don't try to roll your
own.
I think Jacob Kaplan Moss said that.
Yeah, that's good advice.
One of the things in my dream world imagination or idealification of this thing is if a new
recommendation comes out, some new header that we should all be adding that we are not paying
attention to that we should have added, but we didn't for some sort of configuration change
for security, secure pie could be updated to make those changes and you just pick them up
and you don't have to know that that was improved.
So that makes me wonder, do you know if any of these protections come in at like a platform
level?
Like if you can, you know, if you're using something like a Netlify, you say, oh, I use Netlify
functions to load a thing.
I mean, I wonder if Netlify is doing something on their end to also include some of these.
And that's, I mean, that's where a lot of my concern comes from is that, you know, if
down the road I'm doing a thing and then like my provider is also doing a thing, am I going
to run into some goofy error that I have to troubleshoot?
I would guess because it's headers, just they would overwrite what your app creates.
Yeah.
This is more intended for like Flask or Django or something like that where you're kind of
the beginning and the end of the security statement.
Yeah.
I mean, something like that.
Absolutely.
And like I said, I will always leave security to in the hands of people who get paid to
think about security because I know I should be thinking about it.
And the most secure thing I can do is say, hey, I need an adult in this situation.
Please make this right.
I've thought a lot about this and I haven't.
Absolutely.
I also would like to point out that if you're not doing Python and web apps, I mean, first
of all, what's wrong with you?
No.
But seriously, second, there's tools like this for other frameworks for like ASP.NET
and other ones.
If you want it, if you seek it out, they have a totally different name.
Very unlikely to have a cool name like secure, but there's other tools for other frameworks
and platforms as well.
You'll have to listen to talk whatever that language is to me, I guess, to hear about
that.
Yeah.
Talk Cobalt to me about our APIs.
All right.
So yeah, to integrate it is like incredibly easy.
So that's super cool.
All right.
So here's a recommendation, which is in some sense in contrast to how much I went on and
on about how much I love the shell and the terminal.
And that is don't shy away from UIs for your Git.
For source control, basically.
This is the one that I was like, I'm ready to fight on this one.
All right.
Let's battle.
So here's the thing.
I think there's a lot of value to having nice visualizations of what's happening, right?
Like, for example, my first thing I pulled up for this was source tree from Atlassian.
And when you open up a repo, you see the branch history and who has made what changes and where
the tags are all in like one quick shot.
And you still have hotkeys.
Like if you want to just do a pull latest, you shift command L and that's the same as
Git pull.
You want to push shift command.
I don't remember what the push one is.
P maybe.
But, you know, there's a couple of hotkeys that are sort of give you a quick access that
is like being on the terminal.
But you also have really nice and beautiful things.
One, for if you're an expert or two, like if you have two branches, you want to merge
one, you drag one branch on the other and that merges the changes from one to the other.
Right.
There's things that help people who are new a lot.
So I, I find this doesn't mean you should never do source control in the terminal or with
Git in the terminal, but that also shouldn't mean you should never use UI tools.
That's my stance.
How do you feel about this?
Okay.
Same.
I can tell you feel the same.
With that phrase, with that phrasing, I'm like, fine.
But I did.
I took the first word on this one.
So go from there.
So I, I have many a tweet that has said, I have made said mistake.
I need to unmistake it.
And how do I do this?
And almost like clockwork.
I do it wrong.
And I wind up.
Yeah.
I just, I wind up deleting things that weren't supposed to be deleted.
And then I'm banging my head against the wall and then figuring out how do I fix this?
And the biggest get undo is just delete the whole directory.
That is, that is actually.
Check it out again and just hope that you can like kind of get it back.
Yeah.
That's, that's exactly my, my solution in most cases.
Um, and, and again, I also want to say, I am not saying that any type of UI is bad.
I'm just saying, if you're getting started, learn the basics because you're going to be
on a server one day.
You're not going to have access to tower or source tree or something else.
And you're going to need to know what was that command?
Like what would get, get Brent?
What, what is cherry picking?
Get whatever, whatever.
And it's like, you're going to need to know it.
And if you have an over reliance and you don't understand what's happening behind the
scenes, that's when you're going to be in trouble.
So for me, it is very much, you can use the UIs, you can use the tools, know what's happening
behind the scenes and know what they are as well.
And I love what's this comment.
Why make things more difficult?
There's so much to memorize in our languages already.
Why do we need to memorize the get commands as well?
That's the thing.
You don't have to memorize all of the commands.
You just need to know, get a good understanding of what you do need to know.
And on top of that, plus we already talked about use things like OhMyZSH where you can just
tap through it and get a list and you can use man and you can learn about all the different
commands and what they do.
But again, if, if you hit delete on the Git or the GitHub, you know, interface, what is that
doing?
Is that just deleting your re is that deleting your entire repo?
Is that deleting the clone that you have locally?
Like what is happening?
And what happens when you go to use some other tool and they use the exact same phrasing to
do something different?
What happens when you go to a new company and your Git workflow changes and you're like, Oh, well, now we don't do branch stuff.
We do tagging and things like that.
I'm not saying that you can't use the UI.
I'm just saying it's good to kind of understand what the UI is doing so that if you ever need to change it or if you ever need to change what UI you're using, you can do so and do it in confidence.
And when you're stuck in that one situation that I have personally been in where it's like, crap, I don't have I don't have the button that I press.
Like, what do I need to do?
Like you can at least have a better chance at making the right decision.
Yeah.
No, that's fair.
I would say to Robert, I think our jail is Robert.
Hopefully I got that right.
Robert.
There's probably five or six Git commands you need to actually know how to do.
And then the rest I would go go to the UI because to me, it's like, do I really need to like visualize the branching in some other way?
No, just open up source tree and look at it.
That's going to be totally fine.
But if I need to know how, you know, Git pull, Git commit, Git add, push, Git checkout, like these, these are the various things I need to know, you know, but like a complicated rebase, maybe I'm maybe I'll just go.
I'm going to find I'm going to find the server or the UI and I'm going to do it.
We've all done that interactive rebase.
And we're just like, why am I doing?
We get like three of them through and we're like, yeah, sure, whatever.
Just accept the rest of them and go.
And then you realize that you weren't, you shouldn't have done that.
I mean, I'm totally there.
Why am I, why am I in VI?
Just accept theirs, accept theirs.
But I think that that's the thing is like, no, I'm not typing Git commit dash M insert my message.
And then all the files that I want to commit.
I'm often just doing Git add dot GCam for Git commit add message all.
And then whatever my message is.
But at least I understand what those commands are doing.
So that down the road.
And to be fair, I do understand it.
Yeah.
And to be fair, sometimes the tools like you're also giving access to your repo.
Like, I mean, it's cool if you're using like GitHub and everything's public.
But like, you're also adding a layer of opening to another company.
Yeah.
And I would be hesitant to say that there's no company out there that's not going to be vulnerable
to some type of attack.
And then you got to revoke access to your repos and things like that.
Because again, in order for these UIs to work, you're giving it a lot of access to what you're
doing.
So again, some of them, I think, I think source tree mostly just work.
Like you can just drag a folder onto it and it'll start to do its thing.
Whereas there's other ones where you're like, oh, off, you know, all the, oh, I'll sign
it into GitHub or get lab or something.
Yeah.
All right.
I'm going to, I'm going to let Anthony from the audience have the fun word here.
Don't roll over source tree.
Yeah.
Not at all.
Like you use the tools.
I think tower is great.
I think the GitHub UI is great.
I've never actually used source tree.
I'm sure it's fine.
I would say source tree is the one that hides the least.
It's there to help you.
And there's UI, but like, it's actually pretty complicated in what it does.
And I don't mean that necessarily in a bad way.
Like it's, it's not hiding everything behind pseudo actions.
Yeah.
And I'll also throw out there.
I am probably not the best, you know, subject test case for this because most of the project
that projects that I work on, it's just me or it's me and like one or two other people.
So it's easy to follow that tree.
If you've got 50 people working on a thing and you need to be able to trace back and forth
what's happening.
I totally get using a tool to help with that.
Yeah.
If you find yourself over here in the SKCD world where you start out writing beautiful,
beautiful code, like created main loop and timing control, enable config parts.
And at the end, you'd find yourself just eight A's, A-F-D-K-F-S-G.
My hands are typing worse.
Hands.
Yeah.
You're kind of breaking down there.
All right.
So I reset this on active.
Where did they get access to my get commit messages?
Exactly.
How did they do that?
All right.
There's also GitHub desktop, which I reckon is kind of neat.
I would say the other area that I just point out really quick is a lot of the tools we have
already have built in awesome Git stuff.
Like PyCharm has fantastic Git integration.
And so does VS Code with like Git lens and stuff.
So you might already have a UI for it if you just press the button.
You know what I mean?
All right.
Keeping along with Git, if you've got a Git repo that you've forked, something that's always
driven me crazy is like, I've got to go and there's a series of events I got to do on the
terminal, like add a remote origin.
And then I can earn upstream origin and then I can do some commands to pull the upstream origin and merge it back into my main branch and so on.
And so GitHub added a button that just says, have you forked this?
Oh, look, there are changes.
Press this button to make them the same.
I love this fetch upstream and fetch and merge.
This is awesome.
I really want to give a shout out to like a lot of the features that Git has added recently that like every time I go in there and like I see something, I'm like, oh, this is nice.
Yeah, GitHub is coming along.
Yeah, there was concern about what would happen to it and Microsoft bought it.
I think it's only gotten better.
Yeah, I think because, you know, I'm such a professional open source contributor.
There was a misspelling in a read me and I wanted to lift, tilt my glasses up my brim and go, well, actually, you swapped the T and the H and without.
Yeah.
And you're like, and by the way, I am a contributor to Django now.
Exactly.
And like just the process of doing all of those things can sometimes be more when it's like this is a simple fix.
And like in your mind, you're like, now I got to go do this thing.
I need to fork the code base.
I need to go and do all this stuff.
And like I literally did everything just in the browser.
And then it was like, hey, do you want to sync this?
Or, hey, do you want to create a new, you know, do you want to put this on the branch?
Do you want to do a new thing?
How do you want the PR to look?
Hey, they accepted your PR.
Do you want to go ahead and delete this?
And it's like all this maintenance stuff that I am bad at doing.
I am glad that GitHub will be like, hey, it looks like you merged a PR.
I mean, to me, Microsoft just clippified GitHub and made it easier for me to do what I do.
Good afternoon, Jay.
Are you trying to write a letter or merge a PR?
It looks like you're trying to rebase.
Would you like some help with that?
Exactly.
Wait a minute.
First, why are you rebasing?
All right.
So I love this.
This is like a single button click.
It solves a lot of the problems.
Really nice.
Because keeping your forks in sync have been a problem.
What I would love to do is just say yes and do this every day and don't tell me about it ever again.
Just make it happen.
Make it as if they're committing a line.
It depends on what I'm working on.
But there's a lot I would be happy to do that on.
Yeah.
I think as long as I maybe give me like a deadline.
Give me like, hey, we're going to auto merge this in after like five days.
You know, at least that way you can get the messages of like, hey, we broke this thing.
Don't do it.
Yeah, sure.
So for me, there's like two reasons I'll fork a repo.
One is because I really love it and I want to contribute to or explore.
The other is just I really want a personal copy of this thing that I can control just because I depend on this so much.
I want a copy of it.
And for those, just keep it in sync.
You know, I can always go back to the version before.
I was wondering, like, how many like were you doing this for like dependency management?
But I don't know if I I don't know how much I'm doing that.
I'm not really forking someone else's code and then like bundling it in with my projects.
But I mean, there I'm never going to say never because that's the one time you need to go and do that.
Yeah.
Yeah, for sure.
All right.
Well, so glad that we're I mean, we're only partway into like we're on halfway through now.
And we're just barely into the podcast.
So it'll be fine.
Oh, I mean, some of some of these I am just like, I agree next.
Like, yeah, this one's perfect.
If you're not using Let's Encrypt and like you're not a company that buys their own certificates and other things like just just use Let's Encrypt.
Yeah.
And it is so simple.
I I would say getting a certificate is kind of a challenge.
I remember being on the phone with a certificate company and having to verify the identity.
Where's the office and what do you do there?
Maybe we'll give you an SSL certificate.
It might have been one of those enhanced ones or something that didn't really matter, but they thought it would matter.
And it was just such a hassle.
And then, oh, my goodness, if you've got to renew that thing and you don't remember the details or the person who originally got it is gone.
What what a hassle.
Right.
And so one of the benefits of Let's Encrypt is not just you get an SSL certificate, TLS certificate.
You also get them automatically renewed behind the scenes without you doing anything.
That's beautiful.
And this is I mean, again, this is a plus one for those platforms as a service.
I know like Jamstack and all this other stuff.
People are like, I don't want to have time to deal with that.
The fact that I can just commit to GitHub or, you know, push my push my repo up to GitHub.
And then from there, I know my website's done and I don't have to worry about the sort of like certificate renewals and everything else.
I will always go that route, but I do have servers that I run for like, hey, I want to show you what it looks like to run the server.
Let's Encrypt is absolutely like the first step in that process.
Like, OK, let's make sure this is good to go.
And I always imagine this would be kind of complicated until I actually saw the steps.
The steps are apt install software properties common apt add apt repository universe apt update and then just apt install certbot Python 3 certbot Nginx.
And then just run certbot Nginx.
That's it.
That's then say yes to the prompts.
You know what I mean?
That's it.
Yeah.
It's really, really not that intimidating.
So people should absolutely be using it.
And the audience, RJL, Robert says, hey, don't forget about FlaskCon in a couple of weeks.
Michael will be speaking.
I will indeed.
That'll be super fun.
And he agrees with us.
I'm also speaking at FlaskCon.
You're speaking at FlaskCon?
I had no idea.
Awesome.
We didn't even get a chance to connect.
What is your talk on?
My talk is on utilizing the Google Maps auto complete API to do location based searching with Elasticsearch.
That's awesome.
And I'm demoing it in my college board clone.
So anybody that's, you know, in high school getting ready to go to college and wants to know how much student loan debt you're going to go into.
Yeah.
Check out my talk.
There you go.
Awesome.
No, congratulations on being there.
You could run in Grok and let the audience interact with it.
That's why I said I was going to test this as soon as we're done here.
Nice.
Yeah.
I'm doing Flask plus HTMX stuff.
I'm a big fan of that.
And it's not even on my list of my suggestions.
All right.
Here's another one I find really challenging is testing web maps.
And yes, you should write very focused tests like, oh, here's the e-commerce section.
And this is what the price is when I set a discount code and I'm not logged in and I tried to purchase it.
But sometimes you want to know, will the thing just catch on fire and 500 or will it actually work if I put it, if I were to push this to production?
So this recommendation is that if you have a sitemap and most sites do, one of your tests can be just request all the pages and see if they 500 or 404 or if they return something that looks like a response like 200, 201, 302, something like that.
I'm trying to remember what it was called.
I think it was like pytest Request or something like that that does something similar.
But I love the idea of using sitemaps.
I'm going to do a shameless plug.
One of the things that we started doing with our search platform is adding a crawler that you can tell it to just go and, you know, brute force all of the links on your site and make sure they're good.
But you're going to miss something like you will miss something that way.
But you can also just add a sitemap.
So sitemaps are a great tool.
And it's one of those things that like a lot of like I don't think Flask does it by default.
Django doesn't do it by default.
But there's usually a very simple way to add a sitemap to those applications.
And I think if anything, this is just another reason to implement sitemaps.
Also, search engines do like sitemaps.
So if you want to get another bump in the SEO ranking, this is the way to do it.
Yeah, absolutely.
Super easy.
It's not a lot of work for the relative benefit you get.
John out in the audience says, Ingrok sounds similar to Cloudflare tunnels, which are also free.
That's awesome.
I have no idea what Cloudflare tunnels are, but it's a good recommendation.
People can check that out.
So thanks, John.
I'm going to add that to the list.
Right on.
All right.
Here's actually the code I put up there.
Like it literally is 15 lines of code or something to do the sitemap test, which is pretty straightforward.
Another one, you're talking about the SEO aspect.
Google's been paying attention to how fast your site responds and not just what is the server response, but how long does it take to get all the JavaScript and parse it and run it?
How long does it take to read the HTML and then get the images and resize them and all kinds of stuff?
So there's a place called PageSpeed Insights by Google, which you can just go put any web page, your root page or some sub page in there.
And it'll give you not just what they think your speed is, but what their recommendations are.
Like your image is too large here on wimpy processors like phones.
It's going to slow down the page load.
So you should resize.
Like you're saying 300 in your CSS, but the image is a thousand.
Just make it 300.
I'm right in the orange on my site.
So I got, I got, I'm at the high.
I'm like right underneath green.
So I got some changes I can do.
But I, one of the things that I thought about this and I love the idea and I absolutely agree with it 100%.
One, if you're doing static, static tends to be faster.
I'm just going to throw that in there.
But, cause I love static sites.
But it's not as easy of a fix as you would think.
There's still a lot of problems you can have with a static page.
Yeah.
And, and actually one of the things that I wanted to add onto that, speaking of like scores and ranking is the idea of accessibility scores and ranking as well.
We've all, we don't want to be dominoes.
We don't, we don't want to be the company that gets sued for not having, you know, good accessibility.
Luckily, I don't think anyone here is, you know, building stuff like that.
And if you are high, welcome.
I'd love to chat sometime.
But I do think that it's important to be good stewards in the community.
That's, that's something that I think is, is really great.
And if your site isn't accessible, like you're, you're cutting off a lot of people.
And, you know, a lot of people are like, well, you know, it's hard to do this.
And, you know, what, what else can I do?
There are a lot of great tools out there.
The one that I'm going to promote is wave, which is the wave web accessibility tool.
And it gives you a bunch of different things.
It even does its own evaluation and you can use it to say how accessible is my website?
Yeah, that's cool.
Definitely.
People should check that out.
This is important.
I think it might even be legally required.
And then also page speed is starting to be used for actual ranking as well.
So we'll should consider that.
All right.
Here's an interesting one, which I don't know how you feel about this, but I find if I set
up a server and the server's job is to run a website or an API and I log into it, there
is about a half of 1% chance that I want to change details about the service of the system
Python.
There's a 99.5% chance that anything I need to change is with packages or details or commands
involving the service I set up.
And I found I was always, I would log in there.
I'm like, okay, well, where's the virtual environment?
I got to activate this thing.
And now I can issue the pip install this new thing or, or do some other command that I needed
to do on the server.
And then it occurred to me, like, why do I do this every time?
Why don't I just set my ZS HRC to say the last thing is to source activate the virtual
environment.
So now when my servers, when I log in, at least the ones that are web servers, it automatically
activates the virtual environment that runs the web app.
So are you familiar with DIRENV?
D-I-R-E-N-V?
Yes.
So to me, my solution here is DIRENV.
For those that don't know.
Tell people what this is.
Yeah.
So DIRENV is this way to load an environment in based on the path that you're in.
And in most cases, this works for just environment variables, which I mean, I love.
It means I don't have to put stuff in open source.
I don't have to risk putting a password in there.
I can just point to an environment variable, load that stuff in, and then know that if
I'm actually in that folder, then the variables are loaded properly.
Right.
Exactly.
If you're in the folder that contains the somewhere above it contains the virtual environment,
it's going to use that.
Exactly.
And the thing that's really cool about this is there's another tool called ASDF that uses
something similar to PyEnvironment or PyE and V that you can put into your environment
variables to say layout Python and the Python version.
And it creates a virtual environment the same way that when you load into that directory, you're
loading into a virtual environment that you can control the actual version of Python that
you want to run.
And that works for both pip and the Python environment.
So when it's like calling PyE and V every time you you change directories into a certain
path.
And to me, like this is the new way of doing it.
When Python 310 came out, all I had to do when I wanted to test for 310 was change my
ENV RC to say layout Python 3.9.1 to 3.10.0.
And from there, that was it.
I CD'd out of it, CD'd back in, it created a new environment.
I reloaded my requirements and I was off to the races.
That's pretty awesome.
Yeah.
Very cool.
Yeah.
I think that's good as well.
For I would definitely lean heavy on that for the dev side for the servers.
I'm like, I might not log into the location I want to be in.
I just, it depends on if I have a bunch of services running there, just one.
But yeah, those are good recommendations for sure.
Especially like I said, on the dev side where you're doing lots of different projects.
All right.
Last one is dependencies and there's all sorts of dependency stuff going on here.
So there's levels.
So you can pip install some package.
Like I could pip install Pyramid that would install Pyramid.
It'll get me the latest one.
Unless I already have it.
Then it says you already have it.
So you're good.
Even if there's a newer version.
It's cool.
So you just do --upgrade and you get a new one, right?
But Pyramid might install Chameleon and my Chameleon might be out of date.
But this pip install Pyramid --upgrade doesn't upgrade my Chameleon, right?
It doesn't upgrade the transitive closure of all the dependencies, which is a hassle.
And then, you know, you got to remember to run these commands.
What if there's like a security vulnerability that I just got a notification a couple of days
ago.
There was some security vulnerability and not something I'm using, but something that I'm
using is using, right?
Very indirect.
So there's all these challenges, I think, around dependencies.
You talked about GitHub having cool features.
If you pin a version in your pyproject.toml or your requirements.txt and there's a security
problem, right?
If I say I'm using flask 0.1 and there's a security vulnerability that was fixed in flask
to get up will automatically create a PR for me and say, there's a problem except this PR
to fix it.
Right?
That's pretty cool.
Right?
So one of the questions I had with this was, does pip-tools solve this second problem
of like doing upgrade, but then it only upgrades like the top level and none of the stuff below.
Yes.
And that is my current solution is I'm using pip-tools.
And I think the command is actually pip compile in there.
I don't remember.
I've aliased it away.
So it's like gone from my mind.
Like I just type pip, pip.
I think it is pip compile update all or something like that.
It's pip compile --upgrade.
I do the same thing except for I never thought to just alias the whole pip compile upgrade
plus pip sync.
Like that makes sense.
Exactly.
Yeah.
I've aliased these things away.
They're all down to like, like pip install -r requirements dash dev .txt is just
PIR, PIRD.
If you want to without the dev, he's PIR.
Like I'm all about the aliases.
My, my Neo Vim, because I could never remember N V I M.
I just do V V I.
Yeah.
Nice.
Exactly.
So, the pip-tools is my current recommendation because what you do is you create a requirements
dot I N and you put the things you would have pip installed yourself, like pip install flask,
pip install SQLAlchemy, not their dependencies, just the things you want.
And then when you run the command that you talked about, it'll create the requirements
dot txt with the closure of all of the dependencies and actually on dent them showing why they're
in there.
Like blast depends on it's dangerous.
So like it would put that in there and it would be clear.
This is a dependency of flask and it pins the versions of all of them.
And then at first say it drops the it's dangerous requirement and you rerun this again, like
that'll come out of your txt file entirely, which is also nice.
So there's, I think this is fantastic.
You, it sounds like you're using it as well.
Yeah.
That's, I mean, that's part of my default setup of, of any new project is install, you know,
pip-tools.
And then from there build my requirements dot I N and then immediately compile and upgrade.
Yeah.
Awesome.
Also package managers for the OS, like homebrew.
I use homebrew on my macOS.
I know there's other things to use, but that works well.
Windows has chocolatey, which I think a lot of people on windows are not using a package
manager.
And I think chocolatey is awesome.
You can install Python that way.
Obviously there's apt and other things on Linux, right?
Yeah.
I really like a homebrew.
Um, I know they were, I think they're now in one there.
Yeah, they are.
One ready.
Okay.
Good.
On this computer we're talking on, I got this one in December, 2020.
It has the Intel homebrew on it, but my new MacBook.
Pro, I put just the straight up, in the Apple Silicon version on there and it's been
working fine.
I haven't had any problems.
Okay.
Yeah.
Homebrew to me, it just makes sense.
Um, the one thing that I will say is ASDF.
Uh, if you're using that, you're, you don't want to run, you know, Pippin or brew install
Python because then you have different, they're like your stems and stuff will get all weird.
Um, so install Python through ASDF.
If you're using that, but other than that, like, yeah, I think homebrew is, is great.
Um, and I guess the other bonus to ASDF is you can use that not just for Python, but if
you're doing like Ruby and you have like RVM or, you know, you need to manage node versions,
which I hate managing node versions, but you have to do it, I guess.
Um, that's like, you can do all of those things in that environment control area, you know,
in VRC.
Um, and again, with homebrew, it's like, it works, but when it doesn't work, you're just
like, okay, great.
Now I need to uninstall this.
I need to run brew doctor.
Like, I'm going to format the computer.
I'm going to, yeah, exactly.
You just need to just, just reformat your hard drive.
It's destroyed.
It won't upgrade Python anymore.
We're done.
I've had so many times where just updating Python is like.
Just giving me time to be like, well, I'm done with this.
Yeah.
All right.
A couple other things out in the audience.
Anthony suggests pip depth tree, which will show you kind of that.
Here's the top level things you installed and what they depend upon, which is great.
That's really a good one.
Product fund says pip audit is a cool tool.
If you want something on security, it's a project by Dustin Ingram, who is associated with
pypi.org and pypa and stuff, which is awesome.
One more thing I'll throw out there.
Pretty new is pip dash or pypi dash changes.
So this just came out and you type pypi dash changes and you point at the Python, the Python
executable in a virtual environment.
And it'll list all the things you've installed, what version they are, how old they were.
Like, here's a thing I've installed.
It's 10 years old.
Maybe I should think of something newer, but also whether or not there's an update.
So this is a fun one as well.
That's nice.
Again, I'm really impressed with a lot of these tools and companies.
Like, I mean, the fact that Python now has some folks that are dedicated to working on
these systems and it's what they do.
I mean, talking about like Lucas and having a developer in residence.
I think this is the benefit that we see of this is you get these little touches that just
make each version of Python, not just, you know, more performant, but also nicer to work
with and nicer to play around with.
Yeah.
It gives you joy, not frustration as you work with some of these things for sure.
All right.
So those were the 10.
How about I just throw a real quick thing out there for people as a delightful little
takeaway.
Nerd fonts.
Have you played nerd fonts?
I haven't.
What is this?
So if you want fonts that are good for programming that support font ligatures and for example,
the Oh My Posh I talked about, they have all sorts of weird like continuation between like
transitional characters and stuff.
All those things test against nerd fonts to make sure every nerd font will work well in
that shell fancy extension.
So if you go over here to the downloads, you can see there's like a huge scroll bar, but of
all these different fonts that support font ligatures, nerd fonts, et cetera, et cetera,
that you get here.
So, and they all come with a ton of variations.
So if you want to have a bunch of cool programming fonts, you've got like Neto nerd font looks
pretty good.
Pro font nerd font, not a nerd action.
That is, that is if you support.
That's if you like ligatures, you can turn them off.
I mean, you can turn them off, right?
You can turn them off.
I was going to say, I don't want to start that, that war of whether or not ligatures or anything.
I love ligatures, but I don't want to, I don't want to battle that out right now.
But I went and installed every one of these nerd fonts on my new MacBook.
It took half an hour longer for that little font book app was like locked up.
I thought it destroyed my computer, but nope, it just had 2,600 font families to install
or something.
I'm glad you don't use Photoshop.
It probably doesn't like you either.
Probably not.
What are all these fonts?
Exactly.
No, but if you're looking for good programming fonts, I don't have one over the other to
recommend, but there are many, many of them here.
All right.
And then I see Antonio out there in the audience who is saying, we got to wrap this up with
a notable PyPI package.
I mean, I had, I had two that weren't included in the list and that was black and eyesort.
I'm pretty sure the folks listening know like black is a great formatter for your code.
If you're like me and pepe is a thing that you want to, you want to understand and believe
in, but from time to time you're like, but what about this weird scenario?
I don't think about that anymore.
I just run black and then I'm done with it.
You know what I think is the real value that black adds is not necessarily that it does
the formatting.
Like I could open a PyCharm, go to the top level of a project, right click and save format
everything in this directory.
And it would format it the way I told PyCharm.
I like it, but it solves the debate.
It's like, you don't have to debate.
Is there a space before the comma or after the comma?
Does it go on one line or does it go on three lines?
Like black puts it on the lines.
We've agreed that we're just going to take this and nobody's going to be a hundred percent
happy, but you're going to be 84% happy.
And we're just going to stop fighting about the formatting.
And I sort is the exact same, except for it does this with sorting your imports.
And I, I mean, I will say sometimes when I'm writing code, it's messy.
Thank goodness.
I have black and I sort to make it not so messy whenever I have to give a talk.
And then someone goes, is there a repo for this code?
And I'm like, give me 30 seconds.
Black.
I sort.
Okay.
Now there is now, now I can, now I'm willing to share this.
That's right.
It's not embarrassing anymore.
Also, John out in the audience says, I was just going to say black and I sort get out of
my head.
Jay.
Oh man.
Well, other than that, I mean, I, you've talked about rumps so many times.
I mean, we can, we can, we can play the classics, you know, all the time here.
I personally, I try to, to not do a lot of installation of stuff, but, if I go to
some of my projects really quick and just open up, you know, actually, I think I do know one
and let's see.
I, I'm trying to remember what it's called.
Um, yeah, I have an app I built with rumps, Python three and pie to app.
That's running up in my Mac terminal bar.
And if I'm really unlucky, it'll get hidden in the notch of my new Mac book.
Oh no.
I haven't played with rumps recently.
I need to do some more with rumps.
Um, rumps is good.
Honestly, some of these little dependencies that I add to some of my projects that, I mean,
I could probably do my own, but also I don't want to like sluggify.
Um, you know, if you've ever, again, a lot of this is just getting rid of how do I do
this?
Um, one of my projects that I just started working on is this idea of we've all done, you
know, markdown and then you convert it to like a markdown table or, you know, you convert
it to like HTML and you got to do some stuff with it and then you got to process that HTML.
But what about doing like markdown to JSON, like where I have a markdown table and I want
to convert that table into a CSV file or a JSON file.
So I'm like playing around with this.
And in my head, I am, I'm like physically pulling my hair out, but I'm also like banging my head
against the wall going like, Oh, but how do, what's the regular expression for this thing?
And that's where stuff like validators is absolutely amazing.
Cause you can just go, is this an email?
If it is okay, good.
Run this, you know, is this a properly formed URL?
It is good.
Okay.
Run this.
Like I don't need to, to rebuild those things.
Yeah.
Awesome.
Yeah.
A bunch of good recommendations.
So thanks for being here, Jay.
This was a lot of fun.
I, I love just going through a bunch of these little tools because I learned a bunch from
you and it looks like people, the audience have found a bunch of interesting ones that we
covered as well.
I love it.
I mean, as always, now that I'm a front runner for the golden jacket club of, you know, talk
Python, I, I absolutely love coming on and, you know, just now that you got the chat
here, they're, they're talking about products.
I'm like, what's that?
Let me, let me add that to my list.
And, you know, I get to learn as much as you know, everyone else does.
Yeah.
That's awesome.
Yeah.
I just want to give a shout out to the YouTube live stream.
It's been really fun to have so many of you all come and join the streams and give us
feedback and thoughts during the show.
I think it lets the audience have a little bit of representation.
If you want to watch that one, just go to the episode page.
You can click it right at the top.
It'll be there.
Or subscribe to the newsletter.
Um, there's a link to the YouTube videos.
Every, every newsletter drop.
They are in there.
Absolutely.
Every time.
That's awesome.
All right.
Uh, Robert says, thanks again, J.
Michael.
This has been very informative.
Thank you so much for being here, Robert.
J.
Final word.
Call to action.
People are psyched about this stuff.
What will you tell them?
Uh, honestly, just play around with it.
Have fun.
Um, be a good steward of the community and absolutely take, take someone that was like me.
Seven years ago.
That was like, this Python thing seems hard, but I really like flask.
So I'm going to keep trying it and just continue to, to pour time and energy into them.
Trust me.
It'll, it'll pay off for them in the future.
And you know, they'll, they'll be sure to thank you with all the drinks that they can.
And, yeah, if you ever want to get in touch with me, you can do so.
I'm on Twitter, KJAYMiller on Twitter, LinkedIn.
That's kind of it.
Um, yeah, I'll definitely put that in the show notes as well.
Yeah.
And, yeah, again, if you're interested in my productivity takes in wild, hilarious
opinions on things, but you know, you want to get outside of the Python space, check
out conduit, on relay FM relay.fm slash conduit, where, we put out an episode
every other week, this next one actually talks about having to do your job when you're
in physical pain, which is something that, you know, you don't think about until you have
that migraine for like the third day in a row.
And you're like, all right, how do I do this?
My most recent example was when I fell in a river and landed on some mossy rocks and broke
my finger in three or four places and couldn't, and had a cast that went to the tips of my fingers
could only work with one hand for two months.
Let me tell you, you got to find some productivity tips to keep things going.
Absolutely.
That was a while, a couple of years ago, but still, yeah, it's, it's all of a sudden
it usually realized, oh boy, I got to keep going, but this is not so easy.
Oh man.
Yeah.
So, people should check out conduit.
Yeah.
Thanks for being here.
It's been great.
Absolutely.
Yep.
Bye.
This has been another episode of talk Python to me.
Thank you to our sponsors.
Be sure to check out what they're offering.
It really helps support the show.
Coiled supercharges the tools you already use for scale and performance.
So you can use Python for ambitious problems.
Add coiled to your project in less than one minute.
Get started today at talkpython.fm/coiled.
Experience the joy of distributed data in zero downtime with cockroach DB.
Get started with no credit card and Postgres compatibility at talkpython.fm/cockroach
DB.
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.
Thank you.