Python Bytes - #405 Oh Really?
Episode Date: October 14, 2024Topics covered in this episode: Briefer: Dashboards and notebooks in a single place Introduction to programming with Python setup-uv HTML for people Extras Joke See the full show notes for this ...episode on the website at pythonbytes.fm/405
Transcript
Discussion (0)
Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
This is episode 405, recorded October 14th, 2024.
And I'm Brian Ocken.
And I'm Michael Kennedy.
And this episode is sponsored by Scout APM.
Please listen to them, their segment later in the show.
And if you'd like to connect with us and ask us a question or submit an article, you can find us on Mastodon, on fastodon.org.
We are at mkennedy, at Brian Ocken, and at Python Bytes.
And if you see all three of us,
it actually gets to us really a lot better.
Or you can email it to us.
There's a contact form on our website, pythonbytes.fm.
If you'd like to watch live, you can join us on YouTube
and go to pythonbytes.fm slash live.
Be part of the audience or watch old episodes.
It's a lot of fun.
We love getting questions in the chat.
And also, finally, if you'd like to get all the links, just listen and enjoy the show while you're listening and then read the links later.
You don't have to write anything down.
Just join.
Go to pythonbytes.fm and get on the links later. You don't have to write anything down. Just join, go to pythonbytes.fm,
and get on our mailing list.
Go to Friends of the Show,
or just say sign up for newsletter,
and we'll send you a weekly email
with all the links and all the topics from the show.
So to get started, Michael,
that was a long intro.
Maybe it could be a little more brief with you.
I'm going to try it.
I'm going to keep this one brief, okay?
Okay.
Briefer.
Let's talk about Briefer from Briefer Cloud.
So this is new to me.
Obviously, 98.4%, according to the last survey of our listeners, know about Jupyter and Jupyter
notebooks.
Okay.
Right?
For those of you who don't, notebooks are a way to sort of explore data, mix in explanation graphics along
with code and analysis. And by far, Jupyter notebooks are the most popular way to do notebook
type programming, but not the only way, right? We've talked previously about Shiny for Python,
which is a really cool option. But today I want to tell you about Briefer. And my theory is the
name comes from the thing that delivers a briefing because it's
about not just exploratory data notebooks, but it seems to be even a little more focused on
delivering a dashboard experience that non-developers, or at least not the person creating
the thing, comes to look at. They can just sort of explore it as an interactive webpage. Okay?
Okay.
So it is, I'll give you their little spiel.
It's dashboards and notebooks in a single place.
Create powerful and flexible dashboards using code, beautiful Notion-like notebooks, and
share them with your team.
And yeah, that pretty much sums it up.
So I believe this used to be a commercial product.
Still is a commercial product.
Don't get me wrong.
It used to be exclusively a commercial project because they have a big banner at the top.
Briefer is now open source.
Go stars on GitHub.
And let's see how many people have.
3.3 thousand?
That's a respectable amount of traffic, right?
That's pretty good.
But if you go to their web page at briefer.cloud,
you can see a little bit more of like,
what the heck is this thing about?
So multiplayer, as in multiple people can work on it.
And I think one of the things that's unique about this compared to, say, a Jupyter Notebook.
So, for example, suppose I want to talk to a Postgres database or something like that as part of my data that I need to pull back.
Well, you've got to connect to Postgres in your notebook.
And you've got to put your password and your connection string in your notebook.
That's not necessarily ideal.
You might be able to pull in, I'm sure there's a way to pull in environment variables or something like that.
But it's not super easy, right?
So one of the deals I think here is you connect a database.
And then you write Python and SQL to query the database and transform it into the right shape and filter it and so on.
And then you use this tool to create visualizations and dashboards
and reports, data apps and so on out of it.
It's like you configure the system
to know about your data connection
and then just any notebook can talk to the database
or something along those lines.
Obviously, that's not a totally universal use case,
but that's the idea, okay?
And it also came out of Y Combinator.
Like I said, I think it was
primarily just commercial at first and then expanded so yeah it says connect your data
source run some queries run python code using your query results as data frames and then share
your results so they've got some cool examples in here they have AI because Y Combinator and it has
to apparently, but these
are good looking things. And then you can have notebook styles and you can create a dashboard
where you put like different charts and stuff next to each other. And then they're just web
pages that people can check out. This is pretty neat, right? I like it. Yeah. I mean, then you
publish it to the web. So the thing to know is if you look at pricing, there's two options,
paid and not paid, right? So open source, self-hosted, free, install it from GitHub, off to the races.
Then there's community, which has a free one, a pro, and enterprise.
This is not any sort of ad or anything, right?
But I do think the fact that it's open source and it has these cool features, sort of executable Python, is pretty neat.
There's some more cool Python stuff about it here.
I can't remember where I was reading it.
Oh, yeah.
You can also put like little sliders and date pickers and stuff that will, as people interact with them, right, it'll update what happens. But you can also, somewhere along here, is it a schedule?
Yeah.
You can schedule your Python blocks to run on a recurring schedule.
So if it's got to go, yeah, it's got to go pull i don't know daily information from some
csv source or who knows right yeah so yeah anyway that's what i got people can check it out and if
you're over here of course there is a docker compose.eml so if you're going to self-host it
you can just docker compose it to life nice Well, I know that school started last month for most people.
It's been going on for a while, but it's still kind of near the beginning.
And I was thinking about students and thinking there's a lot of people
learning some new web stuff.
And so I picked a couple topics around learning new things.
And we're going to start with Python.
So I got this from from uh forgot his name all
right ready um jose blanca um and i think he's the dude that wrote it um that yeah um it's
introduction to programming with python but it's all web-based i kind of and it's uh it's it's
kind of nice all web-based and just um it's just a free kind of a basic intro. And I think it'll be more than enough for
a lot of people to get started on there. Like they're taking some programming course and we're
need to know a little Python for a course or something or a new project. So why there's a
few things that I like about it. One of them is it's not a complete overview. It does not try to
says doesn't try to cover all every detail of Python language, just what a beginner
might need to start the journey. And I know there's a lot of great training tutorials,
especially over maybe at TalkPython training to get started. But if all you got is no money
and a web connection, I think this is maybe something to just check out. I want to point out a couple other features.
It's running, if we scroll to the bottom, it's running Corto, which I think we've covered this, Corto publishing system.
I believe that we have.
Yeah, that comes from the Shiny folks as well.
Some people make Shiny for python that i mentioned before um well it's based on that with a corto live extension that allows python to run in the browser using pyodide um and uh and at the
bottom we can see a github link so this whole thing is open source that's the kind of thing
that is intriguing to me uh the whole project's open source so if you want to uh like if you
wanted to have an internal training for your company or for your
own, like individual teachers wanted to customize this for your own class, you could, you know,
fork this and do your own thing, which is, I kind of love that. And I wanted to, I was curious about,
I was curious about what it's running. So I went over and I looked at the Hello World. So we go to Hello World.
It's the first time you get to actually play with the code.
And because it's Pyodide, you're reading about Python,
and then there's these little code run blocks,
and you can just run stuff.
And then you can start it over and do it again.
But you can also just blop some new stuff in there.
So I just blopped import sys, print sys version to see what Python version it was running.
And it's running 3.12.1.
I guess I would have been surprised if it was already running 3.13.
But 3.12.1 is a bit, I kind of expected something a little newer than that.
Anyway, it's still pretty, it's better than 3.8, everybody.
But yeah, 3.12.1, not bad.
So just to be able to just sort of run a few things.
So what all does it got in it?
If we go to the intro, there's a, I forget what I was reading.
Never mind.
It just, Python's used everywhere.
We love Python.
And if you're, if some of the courses are out of reach for you, or if you'd like to
have something to, on the go, this might be something to look for.
Or especially, the real thing I was thinking is people, like teachers, trying to customize
their own introduction or different things that they're trying to teach using Pyodide.
This is a good example.
Yeah.
If you don't want to start with, let's begin with what a virtual environment is and your
path and that kind of stuff.
Yeah.
Well, that, and also just if you'd like to write your own online tutorial book for a
particular topic that you're covering.
I was thinking of seeing if I could do some of this stuff for testing concepts
um that'd be kind of fun yeah because i'll tell you i i um i know some folks that do research and
work with teachers like middle school teacher type folks and they were choosing some kind of
programming language to work with with their students and they decided they're like oh we
should use r because r will install on Chromebooks more easily than Python.
By the way, I sent a message, no, no, that's actually, you can install them both.
However, if you're using iPads for school or Chromebooks,
your web browser works just fine, right?
Yeah, with something like this.
It's a really good option.
Yeah, exactly.
Or a lot of other new platforms.
And these, so we'll see more of this stuff coming along, I think.
So it's good.
We absolutely will.
Cool.
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
thorium 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 healing 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 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.
There's something on their pricing page about that.
So you can start your free trial
and get instant insights today.
Visit pythonbyst.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 pythonbytes.fm slash scout. Check
them out. It really supports the show. So remember I talked about trying to be more efficient on
pypi.org and not just especially under Docker and containers, not just blasting it every time. Like, hey, my requirements
or my pyproject.toml
or whatever results
in 200 dependencies downloaded.
And let's start fresh
every time I do a build
or run a PR test
or something along those lines, right?
And I wrote that article
on my website
that talked about
several different things.
How do you install Python using UV?
How do you make,
how can you set up caching both for pip and for UV to make that better? And we both said, well, GitHub is probably
the most, probably the worst of all of these things. Like, and I think you even mentioned
that. Wouldn't it be awesome if GitHub would actually just realize, oh, you're getting
something from PyPI out of CI. Let's just give you the one we got like the other half a million times today
or whatever, right?
So all of those statements remain true and valid.
And I definitely encourage people to check that out
because I feel like we could just do a lot better
and not just destroy PyPI
in terms of traffic and financial bandwidth.
But what I wanted to bring up was someone in the audience,
I think it was Henry Schreiner, but I'm not 100% sure, pointed out that there's this thing called setup-uv. I'd never
heard of it. Mostly, I don't do much with CI, GitHub CI, that kind of things. Personally, it's
just, I don't know, it just doesn't fit into my life. It's not a requirement I got to do a lot.
So I just don't play with GitHub actions that much. But this is a GitHub action. If you go to the thing, the repo I'm linking to, it says, use this GitHub action
with your project. Click here. But the idea is it will set up a GitHub action workflow for both
installing a specific version of UV, managing the UV version, and managing the caching of all the
things it downloads. Isn't that cool? Oh, that's very cool. Yeah, exactly.
So it says it will install a version of UV and add it to your path.
Thank you, that's handy.
Cache the installed version of UV
to speed up consecutive runs on self-hosted runners.
That's kind of nice.
It'll potentially, optionally,
persist the UV cache in the GitHub Actions cache.
That's what I'm talking about, where you can get it to say the second time your CI runs, if it's still the same requirements.
Both, this is good on PyPI, I mean, gentle and kind to PyPI, but it also means that it's faster.
You don't have, if there's some kind of source distribution that has to do an install or something like that, you know, some of these dependencies are slow to install if they got to compile,
but once they're cached, they're super fast.
So this will make your PRs
and all of your CI just run faster.
So I think that's great.
And then there's some other checks,
but you can come down
and basically specify a particular version.
You can pin it to a, what is that, a minor version,
like a 0.3, whatever latest.
You can have checksums
and you can even
set up caching with your GitHub
Actions. So that's about all I know
about this. But I know people who do a lot
with GitHub Actions will probably be able to take this and run
with it. And I am
with Rhett Turnbull
says, I haven't tried UV yet
primarily because I didn't want to mess with
uploading GitHub Actions. This will be very
handy. I have been using UV but I have been, I haven't added it to any of my GitHub action of the projects.
So, yeah, I'm definitely going to check this out.
Awesome.
Hey, Rhett, glad to hear you like it.
Okay.
The last topic I've got is I was thinking, thinking again on the people kind of starting things new,
maybe possibly students is learning some HTML and especially I was,
this is nice.
I wanted to highlight HTML for people.com and it's nice.
It's just sort of an online book.
And I,
I just noticed that the,
the phone on the there's, there's a great image on the front.
The phone on the desk is at, the time is 4.04.
Nice.
I think that's funny.
Although they should have made it two o'clock for 200 okay.
I mean, you want to start out on a positive note.
Yeah.
But that's really clever.
I like it.
But it's just a really well-written website, and it's really clean-looking.
But I was looking through the introduction, and it really kind of reminded me how I learned HTML.
So I learned HTML way back in the old days, in the 90s.
And we didn't have a lot.
There were some HTML generators, but we just wanted to.
I wrote most of my HTML by hand just in a BI or something and probably Emacs at the time.
But anyway, so this walks through actually building a website like it walks through doing a website, adding content.
It does talk about maybe using a better text editor. If you're just using
just a basic text editor, there are better ones. Talking about style, adding an about page,
a blog, a resume, some great stuff for especially college students to kind of do something nice
in raw HTML as a website. There's even some bonus chapters on,
it had some simple CSS that it was including,
but basically customizing the CSS
that was included in the course.
And then also covering some CSS basics
because that isn't new since I,
when I was back in the 90s,
writing HTML, no CSS there.
But now it's almost,
it's essential that you learn at least a little bit of CSS along with your HTML.
And maybe you're not going to write a pure HTML website, but especially with things like static generators or templates, there's a lot of HTML we still write, even if you're not writing raw HTML webpages.
So going through a tutorial that just talks about the basics of HTML,
I think it's a great way to get started.
Yeah.
I love it.
And that's great.
It's got a little bit of a hat tip to Kenneth Wright.
Although I don't know if there's any connection,
but you know, for human sort of thing.
I noticed that if you go to the bottom,
you have GitHub stuff for finding, for getting the source code.
And if you need it offline and stuff, for getting the source code,
and if you need it offline and stuff like that.
Yeah.
Oh, cool.
That's neat. And it's got a Creative Commons license.
Oh, interesting.
Yeah.
Non-commercial.
Attribution non-commercial share like 4.0.
International license.
It's one of the longer Creative Commons licenses I've seen,
but very nice.
Yeah.
Cool.
CC by NCSA 4.0.
I'll have to look at that one. i don't exactly know what all that is uh
yeah yeah uh anyway right i love it that's a good one extras extras extras i don't have any extras
do you have any extras uh just a couple real quick things so uh last time i think it was last
time recently we spoke about something we must replace micro whiskey with something else and i
just wrote down some thoughts and some links and some alternatives on my blog about that.
So people can check that out if they're interested.
That's a brilliant idea.
Some of the stuff that we talk about on this episode or this podcast, we could write blog posts about.
Sometimes I just want to shine a light on something.
And we did that to put on the podcast.
But, you know, the entire world doesn't necessarily listen.
They should,
but they don't really can find it.
I know it's so odd,
Brian.
I did meet somebody once who didn't listen to the show.
Okay.
Well,
I know you got it something else,
but I wanted to say,
um,
if you,
you could be a,
a good friend to all of your rest of your friends.
If you share this podcast with them.
So yes,
absolutely.
Absolutely.
All right. So people would check that out if they want to follow podcast with them. Yes, absolutely. Absolutely. All right.
So people would check that out if they want to follow up on that.
Also want to give a shout out to Carlton Gibson.
He's one of the co-hosts for Django chat, but that's not why I'm shouting him out.
I am because he created an extension for Django, Django unique user email.
So by default, the Django user model,
I believe, requires you to have a username
in addition to your email.
And it's the username that's unique,
not the email that's unique,
which is kind of weird.
Anyway, Carlton fixed it.
So there, I fixed it.
And he created this login by email
with your default user model for Django
by making auth.user.email,ail the database deal unique with a key constraint.
So anyway, not a whole lot to add to that.
But, you know, it's got steps on how to install it as a Django app and make it go.
But I think this kind of feels like it should have been there all the time.
So well done.
Same as required.
Certainly.
Certainly does.
You know what else is required?
What?
A joke.
Yes. Let's do it. Now, this what else is required? What? A joke. Yes.
Let's do it.
Now, this one is kind of a choose-your-own-joke.
I didn't pick ahead, but what I found is a source of many jokes that I can foresee coming at some point here, Brian.
Okay.
I found the practical dev on GitHub has created an O'Reilly full-res covers for a whole bunch of O'Reillys.
You know what these are, right? Yeah, they're like mock, like fake O'Reilly's. You know what these are, right?
Yeah, they're like mock, like fake O'Reilly books.
Exactly, exactly.
So let's check out the ignoring deprecation warnings one,
see what that one's like.
So maybe they'll just go away on their own.
It's a sleeping cat that says ignore deprecation warnings.
Nice.
What do you think?
That was pretty good, right?
I like it.
Yeah.
Plus I like cats.
I do.
Cats are nice.
I'll see if I can find.
What about this one?
This one says, is that a camel, I think?
Does it run?
Just leave it alone.
Writing code that nobody else can read.
The definitive guide.
Oh, really?
Oh, funny.
And the Definitive Pearl book had a camel on the front.
Right.
Let's see.
I'll find,
I'll find,
oh, how about the big
regex by trial and error one?
If I click this button,
does it give me the full view?
Nope.
Okay, so this one is
combining slashes and dots
until a thing happens.
Expert. Regex by trial and dots until a thing happens. Expert.
Regex by trial and error with a very curious giraffe peeking around the corner.
Adding slashes and dots, yeah.
Until something happens.
All right.
Well, that's what I got for you.
You all can poke around in there.
Maybe we'll come back some other time in the future and grab a few more good ones.
Buzzword.
Like buzzword first.
I mean, that's buzzword first.
Development.
Fashion forward development. Buzzwords first. Design. I mean, that's buzzword first development. Fashion forward development.
Buzzwords first design.
I love it.
That reminds me of design by, or is it resume driven design?
Yeah, that's it.
There you go.
That's right.
So nice.
Well, good jokes and good talking with you.
Yes, as always.
Talk to you later.
Yeah.
See you later.
Bye everyone.