Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
This is episode 375, recorded March 19th, 2024.
I think I got that right.
And I am Brian Okken.
And I am Michael Kennedy.
And our episode today is sponsored by Scout APM.
Thank you, Scout.
Listen to their section later in the show.
If you'd like to connect to us, we're on Mastodon and the links are in the show notes.
But it's at M. Kennedy, at Brian Okken, and at Python Bytes, all on Fostadon.org.
And if you'd like to listen to the show live, we'd love to have you.
But it's not necessary.
You can listen to us later.
But if you want to listen to us live, go to pythonbytes.fm/live and see all the details and see when the upcoming episode is.
So, yeah.
Michael, what do you got for us?
Well, I would like to start off by telling you about another country, maybe one you haven't heard of.
Canada?
You've heard of Canada.
You've heard of the U.S.
You've heard of Germany.
You've heard of Slovakia.
You've heard of the Philippines.
Have you heard of Pi Country?
Oh, this should have a song with it.
In a Pi Country.
Does it involve a banjo?
I don't know what it's called.
I hope not.
I know.
I hope not, too.
Oh, we should have covered this on the 14th.
Anyway.
Pi Country, Pi Day, all the things.
Okay.
So, Pi Country is, it solves something that might not sound like a great big problem until
you try to deal with this and you're like, are you serious?
There are this many things.
It's similar to dealing with time zones.
You're like, how complicated it can be?
What are there, 24?
No.
And what are their abbreviations?
And what are all the different ways in which they can be abbreviated and so on?
This is that for countries.
So, it's a Python library to access ISO.
These are standards.
Country, subdivision.
What's a subdivision?
Language, currency, and script definitions and their translations for all the countries of
the world, including deleted countries that used to be countries but are not.
I would have considered those just former countries, but deleted is a very digital way
to think of it.
We just selected that part and we hit, you know, command backslash and it really deletes
it all the way.
Yeah.
Anyway, this is really interesting and it's used by 17.9 thousand different projects, which
is pretty cool.
So, here's the deal.
So, you go in here and somewhere, you can just go into it and you say pi country.countries
and there's 249 here.
And you get these, not just a list of strings, but you get rich objects back.
Like, the first one is Afghanistan.
So, country, it's a class.
It has the alpha two code, which is AF, the alpha three code, AFG.
And that's the kind of stuff I'm talking about.
That's like, why are there so many variations?
You can represent, you know, the shorthand version, like just two letters, but you can also
use three letters or there's numeric versions.
There's like the full name versus the colloquial name.
So, Afghanistan versus the Islamic Republic of Afghanistan.
Oh, this is kind of cool.
I might learn something.
Yeah, exactly.
There's a lot more in here.
And there, it has a dictionary-like access for the variation.
So, you can say, get alpha two equals DE and you'll get good old Deutschland.
Or you could say alpha three equals DEU or the name equals Germany or all these different ways
in which you can kind of query this.
Or given one, you can obviously just access all these properties.
Like, Brian, you would know that it's the Federal Republic of Germany.
It has fuzzy searching for countries.
So, I can say, give me England.
It's like, yeah, there's no England.
What?
But there's this thing called United Kingdom, which sort of has its center in England, maybe.
And that's GB and so on.
So, yeah, pretty neat.
You can say, fuzzy search for Cote and you get Cote d'Ivoire.
Sorry, folks, from there.
But, you know, you'll get, like, it'll even match when it's not exactly the right character, right?
Like, oh, hat.
I don't know what that's called.
Not an umlau, but a hat-looking thing.
But you don't have that in the search, right?
Yeah.
So, this is more, like I said, there's more to this than just like, oh, a list of countries.
And then, it's historic countries.
These are the ones.
Did they, since I read this, did they change it from historic to deleted?
I don't know.
Historic countries.
Subdivisions.
I'm like, what is a subdivision?
Of a country.
This is like states or providences.
It's not nearly as strange as it sounds.
There's scripts also.
What is a script?
It's written language versus spoken language.
Those might be the same thing, but they might also not be the same.
Like Latin, for example, right?
Oh, yeah.
Okay.
Currencies are in here.
Languages are in here.
Locales are in here.
So, if you do anything with countries, this might be worth looking at.
That's pretty cool.
Yeah.
I'm still, like, hung up on that England isn't a country.
True.
But, okay.
According to by country, it's not a country.
Okay.
And also, so, yeah, I'll have to look into this more.
Is it a subdivision?
Maybe it's a subdivision.
But also, like, where does the word Deutschland fit in for Germany?
Is that not even listed?
Yeah.
Well, also, since it has translations.
So, for example, German, if you ask a German person where they're from, they'll say Deutschland,
unless they're speaking English to people, right?
Like, they refer to it as Deutschland.
Yeah.
But for some reason, we don't agree.
We don't call it that.
We call it Germany.
Right?
Yeah.
So, I don't know.
It's interesting.
I suspect if you use the translations, maybe, and you said, you know, what is the official name of Germany?
It probably wouldn't say the Federal Republic of Germany would have that translated, right?
Interesting.
Yeah.
Like, Switzerland is, I can't remember exactly.
But, yeah, it's different.
It goes by different names and different languages.
So, I think it also has those when it talks about the translations.
Cool.
Neat.
Well, we could point to countries.
I'm trying to do a transition.
Or we could point to objects.
And does Python have pointers?
You can't really point to a country.
I don't know.
Maybe.
Point to directions.
Canada's that way.
No, Canada's this way.
Oh, man.
But we're probably pointing to different directions.
Anyway.
So, Ned Batchelder has an article called, Does Python have pointers?
And I'm like, yeah, no, it doesn't.
But kind of does.
Anyway.
I'm highlighting this because I think it's a really good article for somebody that's coming from a language that does have pointers and stuff to Python.
Because it's a good entryway into names in Python.
So, the article does Python and pointers.
But it's kind of pointing to the idea of, like, talking about the ID function.
And I know about the ID function really well.
So, if you say ID of an object or a variable name, it tells you, like, a number for what it points to.
Like, where the, I don't know, it's a representation of the memory address or something.
That's kind of what a pointer is, right?
But you can't, in C and C++ and Rust and other things, you can dereference it.
Using that, you can create a variable.
Using the address, you can create a variable that points to that thing.
And you cannot do that within Python.
So, it is different.
But also, kind of everything is a pointer in Python.
And that's sort of Ned's point, is that with, like, just normal object, we can say, like, my var equals 17.
And then we can have, if you do my pointer, it doesn't help you any.
But you can do another variable that points to the same thing, and it works.
It's when, it's just sort of how names work.
I'm describing this very poorly, but this is a good entry point into, well, how objects work.
And luckily, Ned also links to a talk he did, names that refer to objects.
And so, he did a talk in 2015, and still the slides are up in the video, but even the slides just going through it.
It's really good to understand just really how names work.
We're just, in Python, we just kind of point to things.
And so, we're going to link also to the 2015 article, Python names and values.
And really, this was the trick.
When I really could grok this thing with Python, then I could understand Python.
Everything else seems easy after this.
So, good job, Ned.
Yeah, Ned always has good writing.
I'm subscribed to his RSS feed.
I think it's interesting to consider whether Python, you know, the article, does Python have pointers?
Like, boy, howdy, does it?
Yeah, yeah.
Like, it has more pointers than C++, which is insane.
It doesn't have a wider variety of ways to, like, dereference them.
You know, it starts, like, casting a void star star to something else.
But everything, literally everything in Python is a pointer.
Even numbers are pointers.
Whereas in C++, numbers usually are value types.
Yeah.
Right.
And you can have stuff that's on the stack that's not a pointer, just has the value.
In Python, there is no way to have just a value.
Every, everything is a pointer.
Often pointers to pointers.
You know, you're traversing something to something, right?
It's like, I'm going to find the dictionary of the class.
And then I'm following that to where it points to to get to the value.
So it's worth spending some time on, even though you don't ever see a star or an ampersand in the context of, like, juggling pointers in Python.
Yeah.
And, like, vectors or lists in Python are not, they're not the plate, the start of a chunk of memory that represents all of your items.
That's not what's going on.
It's something completely different.
Forget that.
So, yeah.
Indeed, indeed.
Very good.
Well, changing gears a little bit, we'd like to thank Scout APM for sponsoring this episode.
Yes, we would.
Let me tell you real quick about Scout APM.
They're big supporters of Python Bytes, so we appreciate that very much.
So if you are tired of spending hours trying to find the root cause of issues impacting your performance,
then you owe it to yourself to check out Scout APM.
They're a leading Python application performance monitoring tool, APM,
that helps you identify and solve performance abnormalities faster and easier.
Scout APM ties bottlenecks such as memory leaks, slow database queries, background jobs,
and the dreaded N plus one queries that you can end up if you do lazy loading in your ORM,
and then you say, oh, no, why is it so slow?
Why are you doing 200 database queries for what should be one?
So you can find out things like that.
And it links it back directly to source code so you can spend less time in the debugger,
and peeling logs and just finding the problems and moving on.
And you'll love it because it's built for developers by developers.
It makes it easy to get set up.
Seriously, you can do it in less than four minutes.
So that's awesome.
And the best part is the pricing is straightforward.
You only pay for the data that you use with no hidden overage fees or per seat pricing.
And I just learned this, Brian.
They also have, they provide the pro version for free to all open source projects.
So if you're an open source maintainer and you want to have Scout APM for that project,
just shoot them a message or something on their pricing page about that.
So you can start your free trial and get instant insights today.
Visit buythombice.fm slash Scout.
The link is in your podcast player show notes as well.
And please use that link.
Don't just search for them because otherwise they don't think you came from us.
And then they'd stop supporting the show.
So please use our link, buythombice.fm slash Scout.
Check them out.
It really supports the show.
Yes, it does.
Thank you.
It does.
It sure does.
Now, Brian, let's talk about ingestion, data ingestion.
Okay.
So here's an open source CLI tool.
It's not exactly Python focused, but certainly useful for Python people.
Ingestor.
And it's straight out of the web 2.0 days because it's dropping some of the vowels.
It says copy data between any source and any destination thinking database type things.
So what you do is you just say ingestor ingest.
Source database connection is whatever.
Source table is whatever.
And then the destination is where it goes.
And all of a sudden, now you have that.
So do you want your Postgres data to appear over in BigQuery?
Do you want your MongoDB collection to show up in Postgres?
One CLI command, done.
Oh, that's pretty cool.
It's pretty cool, right?
Yeah.
So it's a command line application that allows ingesting or copying data from any source into any database.
I mean, this job probably should be a star on any.
There are, how about many, many data sources?
Okay.
Yeah.
So if we jump over here to their docs where, like, their homepage is kind of just to catch your interest.
So you can copy, I'll find the sources and tell you about them in a second.
But it says there's three ways to copy stuff over.
You can do an append, which is kind of cool.
Like, if you've got multiple data sources that are localized, saving of data, and you want to put them all into one place.
Like, if you had a bunch of SQLite files from different locations.
Say you've got a bunch of, I don't know, a bunch of IoT things.
Or you've got a bunch of servers.
And they each keep some data in a SQLite file.
And you want to put that into one big database, right?
You could do append.
Or you could say merge.
I'm guessing if the primary key is the same, it just skips it.
Maybe it doesn't update to that thing if the fields are different.
I don't know.
Or you can just wipe it free and insert.
So like a clean replacement.
Delete and insert.
Yeah.
Yeah?
Pretty cool.
And then somewhere down here, supported sources.
Here's where I was joking about the NA.
Supports Postgres.
And it has, some of them are bidirectional, source or destination.
Some are just source.
Some are just destination.
Postgres, BigQuery, Snowflake, Redshift, Databricks, DIPDB, Microsoft SQL Server, and CSV files are all bidirectional.
CSV files are bidirectional, okay?
But Mongo, Oracle, SQLite, and MySQL are only sources.
So I don't know why MongoDB is not a destination because it's incredibly easy to just have like a flat file, a flat table, no like nested stuff.
I know if you're copying from a relational database, but yeah, whatever.
Still pretty cool, I think, to be able to use this.
So if you got just data you want to keep in sync or migrate over and you're thinking of writing Python code to do it, you might not have to write any code at all.
Well, that's pretty cool.
I don't know what Snowflake is.
It's a great name.
Yeah, we're getting out of that season right now.
It's starting to be warm and summer's coming, but it'll be back in the fall, like maybe December.
No.
That's funny.
Cool.
Well, yeah, very interesting.
Speaking of command lines, I ran across David Lord's article, Make Your Terminal Nice.
And this is just sort of a little shout out because so apparently David is using he's using fish, which I haven't heard about for a while.
So nicer prompt with starship.
So nicer prompt with starship and a nicer shell with fish.
And this isn't really a detailed article, but it's just sort of like things can be nicer.
And I was reminded about this because I think a long time ago we were talking with.
Anyway, somebody else about starship.
And I was like, I should try starship.
And I tried it.
And for some reason, didn't work for me.
But I'm like this.
I think it's time to start again.
And so I looked into both of these.
I tried fish.
And I do really appreciate that it says, finally, command line shell for the 90s, which is awesome and funny.
And it's also in Comic Sans, which I ironically appreciate.
But the scripting language is a little different.
And I've got a lot of customizations for Bash.
And ZShell is very compatible with Bash.
So I usually use either Bash or ZShell.
And I think I'm going to stick with that.
But Starship, Starship's amazing.
And so I switched to Starship.
And when you go to Starship, there's an installation guide.
And really, it was so easy.
There's a macOS line.
You just curl install it.
Or you can homebrew.
I think I did the homebrew thing.
Anyway, but then how do you use it?
There's a usage of just, so I was on ZShell.
So you just add one line to your ZShell RC.
But there's instructions on how to do it within Bash or Fish or PowerShell.
Oh, cool.
It works with PowerShell.
That's pretty neat for all you Windows people out there.
So what you get, what I really like is this notion of the directory is right there listed above your command.
And then listing what I really like is what my Git branch is, my directory, which version of Python I'm using.
The example here shows a Rust.
But it shows which version of Python you're using.
And then also what virtual environment you're in.
So having, and I didn't configure that at all.
That's just the default.
And I'm like, that's good.
I'm good with that.
So I haven't configured it at all.
Just the default right out of the box.
It works really good.
So I'm pretty happy so far.
Anyway.
Yeah, I think there's a lot of options here, right?
There's on my ZShell.
There's Starship.
There's all the different shells.
These days I'm using Warp.
Warp.dev, which is pretty excellent.
I talked about that on the show before.
I kind of forgot about Warp.
We should try it.
Warp is cool.
I think the big thing, the big message people should take away from this is don't just take what your operating system gives you.
It's really quite bad.
It's not just not great.
It's bad.
And a lot of people who are like, I don't really like, I'm not really a terminal person or I'm not a CLI person.
That's because they didn't spend 30 minutes once getting it to where like, oh, actually, oh, that's nice.
And you point out like, oh, well, is there a virtual environment active?
What is its version?
And then all these other things, you know, are there Git changes?
Am I in a Git repository at all?
Are there changes?
Et cetera.
Like all those little, every one of those is just, oh, that's nice too.
And, you know, it really adds up.
Well, and I've always been one to, I mean, for my career, I'm usually juggling multiple projects, multiple branches on projects and everything.
And I've kind of been okay knowing what I'm doing.
However, recently, I just have leveled up that of using way more branches, way more projects.
And just having that information for me right there to make sure that I know what version of Python I'm using, what branch I'm on.
And having that just ever present is like, oh, my God, I don't have to think about that anymore.
Awesome.
It's just right there.
So I just hit that, hit that like pain point where having that information is helping me.
And so I appreciate it.
So yeah.
Very nice.
Cool.
Nice.
How about any extras?
Do you have any extras for us?
I'm feeling extras today.
I got a few extras for folks.
First of all, I spoke about UV or no, Brian, you spoke about UV and I just jumped on.
We both wanted to talk about it, but you had it first, I believe.
Yeah.
It was officially your topic on the show.
However, and you had Charlie Marsh on testing code.
And so I just published an episode of Talk Python having a conversation with Charlie about UV and a little bit of rough and just life in general.
But I have a big backlog of shows over there that I'm working to release because I've recorded faster than weekly release cadence.
But this one seemed very timely.
So I put it, put it to the front of the queue so people can check that out.
I can't wait to listen.
Yeah, it was fun.
Also follow up here is there's this really interesting YouTube channel.
I don't know if it's in general interesting.
Just the one I watched is called Dark Matter.
And they have like highly produced video versions of what would be a podcast, which is kind of interesting.
So they had the one with David DHH talking about the leaving the cloud, cloud fugitive.
But just like if you look at the video side of it, it's like could be a documentary sort of thing.
So anyway, that's interesting.
And we're checking out.
You want to follow up on all my leaving the cloud talk I did.
For those who like to live out near the front of the leading edge, Python 3.13 alpha 5 is available.
And people can go check that out.
So it's not quite beta.
And once it hits beta, there's no more changes.
But right now, they're still potentially breaking changes.
Things could be added.
Things could be removed.
So on.
But in this thing I'm linking to, there's a nice list of, you know, what's some of the improvements like.
For example, how exciting a preliminary experimental JIT was added, by the way.
Just like throwing that out there as if it's nothing.
Your Python will be compiled.
And then finally, this one comes to us from Pat Decker.
Target Tech.
So the tech blog at Target.
This is really cool.
Said Target posted something on their blog, which I didn't know they had a tech blog.
So that's, I guess, news.
But cool for them.
Announcing Target's open source fund.
Oh, cool.
Yeah.
And it says, we created Target's open source fund as a commitment to support open source projects we use.
In short, Target now directly donates the projects through an internal process that prioritizes representation of Target's technology team.
Perfect.
This is perfect.
Like, it says, look, we're basing this on some of the prior work that's out there.
And in fact, the success of Sentry and Microsoft's open source funds have inspired them to go further.
And then it lists projects like, you just gave a shout out to Homebrew, OpenAPI Generator, SDKman, MockK for Kotlin and HTTP 4K.
So it looks like they do a lot of stuff with Kotlin.
So they're supporting that.
But whatever, right?
You support what you use.
I think that's cool.
Yeah.
I think, yeah.
Every company.
I mean, every company, even companies you don't even think use open source, use open source.
So.
Yes, exactly.
Yeah.
There was a quote they gave in here that said, the Linux Foundation estimates that 90% of the code in production is of open source origin.
Probably, you know, using libraries based on open source.
I would imagine, you know, like the fact you use Flask would make your stuff of open source origin, I would imagine.
Yeah.
And I know that there are some wrinkles in how the money often gets distributed, but some money getting distributed is better than none.
So that's a good thing.
I'll say one more thing just to encourage other companies, people within other companies to do this.
We recognize that it's our responsibility to engage across a broad spectrum of activities.
This includes contributing our own software to open source, joining communities and patching software used by others, plus funding with money the others.
That's pretty cool.
Yeah, cool.
Well, the only extra I've got is that I have been working on a side project that I'm starting to ramp up a little bit.
And I've decided to have a start in a SAS project.
And I've started, thought I would get a little head start by using Corey Zhu's SAS Pegasus.
So I'm, I talked with him just the other day.
So his interview will be on, on, on Python test.
But as I go along, I'll be reporting how it's going.
And yeah, I'm just excited to get started.
So nice.
You're going to live blog it, blog, blog the progress.
Yeah.
It's just, it's just going to be slow going because there's a lot, there's a lot more going on in my life, but I want to get it off the ground.
Indeed.
Yep.
I know the feeling.
How about something funny?
Yes.
Let's talk about something funny.
So this comes to us from DevHumor directly submitted by admin.
This has, it's got like a kind of a cybersecurity thing here, Brian.
Okay.
So, you know, like social engineering, like, Hey, I'm from IT.
You're going to get a pop-up on your authenticator that says, you need this.
We're just checking some systems.
So if you don't mind just approving that, you know what I mean?
I know it's your personal email, but we're just working on it for you.
So anyway, here's the joke.
If a person who tries to trick others into giving them personal or sensitive information is a social engineer,
does that mean that the person who tries to prevent that is an anti-social engineer?
Well, I mean, I've met a lot of cybersecurity people and I, maybe, I think it might be an overgeneralization, but yeah.
Yeah.
It's funny.
Anyway, are you an anti-social engineer?
This time it's a good thing.
I know just who I need to send this to.
This is awesome.
Perfect.
Awesome.
Thanks.
Well, that was a fun episode.
And thank you everybody for listening and watching and everything.
And thank you, Michael.
Yep.
You bet.