Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book


Transcript #244: vendorizing your Python podcast

Return to episode page view on github
Recorded on Friday, Jul 30, 2021.

00:00 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.

00:04 This is episode 244, recorded July 30th, 2021.

00:09 I'm Michael Kennedy.

00:10 And I'm Brian Okken.

00:11 And I'm Brandon Brainer.

00:12 Hey, Brandon. Welcome to the podcast. Thanks for being here.

00:15 Thank you for having me.

00:16 It's really good to have you here.

00:18 You're one of the first volunteers, I'll put it as, when I said, hey, we're looking for some folks to come be with Brian and me on the show and throw your name in the hat.

00:28 And here you are. Happy to have you here.

00:30 It's very exciting. Very, very exciting.

00:31 Yeah, absolutely.

00:32 So before we jump into the topics, just tell us a quick bit about yourself.

00:37 Yeah. So I've been in software development for 10 years.

00:40 Half of it in management, half of it as an individual contributor.

00:44 About seven years of it with Python.

00:46 You know, it's funny, when I first started programming, I lived in a Raspberry Pi.

00:49 I thought Python is so confusing with not having brackets and all these spaces.

00:53 And so I don't understand it.

00:55 And now I can't go back. It's so much easier.

00:58 Yeah. Yeah. I had a similar experience coming from C# and C++ and stuff with all the symbols.

01:04 And I thought, in my mind, I thought those are necessary for programming.

01:08 Like you have to have the semicolons.

01:09 You have to have the curly braces and the extra parentheses.

01:12 Because how else will the parser and everything?

01:14 Like that's how you express stuff in programming.

01:16 And then when I got into Python, I felt a little bit weird with it missing.

01:19 But then when I went back, I felt even weirder.

01:21 Like, why are all these symbols here?

01:23 Yep.

01:23 I just learned that they're not necessary.

01:25 Why have I been doing this the last 10 years of my life?

01:27 What is wrong with me?

01:28 Exactly.

01:29 It was a really interesting experience.

01:31 Yeah. Speaking of interesting, Brian, all the stuff on Pip, quite interesting.

01:36 Yeah. So I don't know. We're doing this on Friday because I wasn't here on Wednesday.

01:43 I was in Florida.

01:44 And so I had a jet setter.

01:47 Basically, you just.

01:47 Yeah.

01:48 No, the first time I've traveled in like two years for a business.

01:52 Was it weird?

01:53 Yeah. Was it weird?

01:54 No, it's like wearing a mask all the way there.

01:57 I kind of got used to no masks here in Oregon.

01:59 But then now I guess they're changing all that again.

02:01 We're bringing them back.

02:02 But, you know, what's old is new again.

02:04 But one of the things I tried to do is I tried to work on the plane and in Python, of course.

02:10 So the problem with snakes on a plane is there's no Internet.

02:14 So I had this issue.

02:16 I had and I've already I've already put it up on the screen, the solution.

02:21 But the so my issue was I had a bunch of I had a project I wanted to work on.

02:26 It's got talks set up.

02:28 And when you run talks, talks creates for a fire in virtual environments and then fills those up with all your dependencies in your code using pip.

02:38 pip goes out to PyPI to get that stuff.

02:40 I mean, you can cache it and that does help.

02:43 And you do that locally on your machine, but it still looks out at the Internet.

02:46 And this won't work on a plane.

02:49 So I reached out to the Twitterverse and and I thought I found a solution, but I'm not even going to say the wrong solution.

02:58 Paul Gansel pointed me in the direction of environmental variables and pip.

03:03 You can just set find links to a local directory and then set with pip find links and then pip no index so that the pip doesn't even look out there.

03:13 It looks at a local directory.

03:14 So so what I did is I'm going to and I'm going to just look at I was going to go back.

03:20 I got a quick question before we go on.

03:22 OK, so it'll look in that local directory for the packages, the wheels and whatnot.

03:26 Yeah.

03:27 How do you get them there in the first place?

03:29 OK, so I got some pre work that I did.

03:31 So I'm like, OK, how do I get those?

03:33 And normally when I when I want to put something in a local directory or something, I'll just use a pip download.

03:40 You can do that.

03:41 But that's a lot of work to try to figure out what you did.

03:43 So what I did is I just before I got on the plane, I'm using the airport Internet.

03:49 I which everybody can harass me later about how that's not secure.

03:54 It's fine.

03:55 But I ran talks.

03:57 You do it at home then if you want run talks with an Internet connection.

04:00 And what it's going to do is you're going to have a whole bunch of your environments within talks.

04:05 You're going to have all your all your all Python 7, Python 8, whatever you got in there.

04:09 Or not 8, 3, 8, 3, 7, 3, 10, whatever.

04:12 You're living in the future.

04:13 Just go through all of them.

04:15 Just do a search and grab all of the what do we got?

04:18 The site packages directories.

04:20 Grab everything out of all of those and copy them to like a local wheels directory or something.

04:26 Something something outside of your work environment.

04:29 I just stuck it at the top level like users or something.

04:32 I stuck it up there.

04:33 And then and then you can then that's everything because, you know, you ran it and then go ahead and set up these environmental variables.

04:40 I actually just stuck the environmental variables in my in my my just in a little script to set them while I'm while I'm developing.

04:48 Yeah.

04:49 You know what I learned that was pretty interesting that the activate script for a virtual environment, you can put environment variables in there.

04:57 So you could have like a offline virtual environment and an online virtual environment and those could toggle different environment.

05:03 Just which one you activate will just make this happen.

05:05 Yeah.

05:06 Yeah.

05:06 So this and that's one of those like it's all virtual environments all the way down.

05:11 It in the environments are the virtual these environmental variables have to be set in the environment that you're running it in.

05:18 So they can be set in the virtual environment that you were using to run talks, even though talks will generate others.

05:24 It just it works right.

05:26 I don't know how it works, but it works.

05:27 Anyway, this super helped me out.

05:29 And then when I went to.

05:30 Yeah.

05:31 So then grab all those, throw them in there and then use the find links and no index and it'll it'll just work great.

05:37 The the thing that the reason why I think I didn't find it at first is that the note within the pip documentation just says everything that's a flag within pip is also an environmental variable.

05:50 It just so if you searched for it, you probably won't find it.

05:54 It just has this comment that says all command line options can be set as environmental variables using all upper scores under uppercase and then underscores instead of dashes.

06:05 So that's a cool tip.

06:06 Yeah.

06:07 Yeah.

06:07 Yeah.

06:07 Brandon, what do you think?

06:09 Yeah.

06:09 At first, I can confuse a little bit about why you wouldn't just pip install before you got on the plane.

06:13 But I've never actually used talks to do any testing.

06:16 So it sounds like that installs in a different directory.

06:19 So when you do your talks runs that it needs to reinstall them.

06:23 Yeah.

06:24 It creates a new virtual environment.

06:25 You can tell it you can run it ahead of time and you can tell it to not install those.

06:29 But I was messing with my talks, my environments.

06:32 So I really wanted to make sure I could clean them out.

06:35 So you can, I think this is, I mean, yeah, there's probably other cool solutions, but this is what I used.

06:40 Oh, it's interesting though.

06:41 It creates all the virtual environments.

06:42 So each different, like 3.7, 3.8, 3.9, 3.10, they'll all be different virtual environments that it runs your tests in.

06:49 So it's always one of those things that we depend so much on the internet to do our job that when you don't have it, like, what do I do?

06:55 So that's, it's interesting.

06:56 Yeah.

06:56 And that's like, you know, 20 hours of work I would have lost if I, so anyway.

07:03 Yeah, this is, this is very cool.

07:04 Nice, nice tip.

07:06 Especially the environment variables just for pip.

07:08 Like you can change the verbosity or the mirrors or all sorts of stuff, right?

07:12 Yeah.

07:12 All right.

07:13 So this time I have an extra, extra, how many extras?

07:16 Let's see.

07:17 I have eight extras.

07:17 Extra, extra, six times extra.

07:19 I hear all about it.

07:20 So I'll be kind of quick, but they're all kind of interesting.

07:23 Okay.

07:23 I just want to give a quick shout out to VBrownBag.

07:26 I did a talk over there on Pydantic.

07:29 So a 45 minute presentation on Pydantic and how you can do all sorts of cool stuff with that.

07:34 We've already talked about why Pydantic is excellent.

07:36 So very, very neat.

07:38 Check that out.

07:39 And I also want to give a shout out to an episode that I did that I think is on Talk Python that I think is going to be really useful for people.

07:45 It's about building little automation tools.

07:47 Instead of trying to build big apps, maybe a little app with rumps that runs up in your menu or a little app that you can do a bunch of stuff and it'll generate a query for some other platform that's not like SQL, but think SQL-like type of things and so on.

08:03 So I had a bunch of cool guests.

08:04 I had Rusty Gregory, Kim Van Wijk, KJ Miller, and actually Rivers Cuomo from Weezer on the show.

08:09 He's doing amazing stuff.

08:10 So people should check that out if that sounds interesting and inspiring.

08:13 That sounds so cool.

08:15 I can't wait to watch this.

08:16 Yeah, this is going to be one of my favorite Talk Byland episodes in the near term, I'm pretty sure.

08:20 Okay, enough of my stuff.

08:21 On to the six other things that we haven't done.

08:24 Remember we had Shari Eskenes on the show a while back?

08:28 Yeah.

08:29 That was really fun.

08:30 She talked about a bunch of great things, but she also did a day in the code, I thought, like storybook for kids.

08:36 So her storybook for kids, which I know you and I both got a copy, right, Brian?

08:40 Yeah, it's actually pretty cool.

08:42 Yeah, I like it.

08:43 Yeah, it's cool.

08:44 So think like a big, large picture book that tells a story, but about programming for kids rather than, I don't know, like a day in the park or whatever.

08:51 So that book's actually out.

08:52 I just want to, that'll be a link in the show notes.

08:54 If you've heard that episode and you want to check it out, you could actually get the book now.

08:57 We talked about GitHub Copilot and some other things like that.

09:02 I want to give a shout out to another tool that's kind of like this, but way more tamed down.

09:08 And it plugs into all sorts of different IDEs called Tab9.

09:12 We talked about Tab9.

09:13 I don't think I, I don't think I have either, but it's actually really well developed.

09:18 It's got a ton of different platforms.

09:20 For example, if you go over here and check it out, it's like, well, what do you want?

09:24 VS Code.

09:24 You want PyCharm.

09:25 You want WebStorm.

09:26 You want Atom.

09:27 You want Emacs.

09:28 You want RubyMind.

09:29 You want Vim.

09:30 Straight Vim.

09:31 Yeah.

09:31 Straight Vim.

09:32 Yeah.

09:33 And so this is a tool that you plug into your editor.

09:37 Well, a Python, that's offensive to have JavaScript.

09:39 Excuse me.

09:40 So you can come down here and it will help basically look at your code, look at the keyword arguments.

09:47 And instead of just giving you autocomplete for the symbols, like functions and fields and stuff,

09:52 it tries to kind of bring it together.

09:53 It's not GitHub Copilot in the sense that it's trying to pull other people's code and inject

09:58 a bar.

09:59 It's not like stack overflow, copy and paste with a tab type of thing.

10:02 It's looking at what's on your screen and trying to pull it together to like complete

10:06 a little bit more.

10:07 So if you have like a username equals quote Brian, and then you call a function that takes

10:11 a username, it'll suggest you pass in that variable value.

10:14 Go on.

10:14 What do you think?

10:15 Actually, I definitely want to try this.

10:17 I think this having a smarter code complete, that sounds just like about the right level

10:23 that I want to try first.

10:24 So yeah.

10:25 Brandon.

10:25 Yeah.

10:26 Yeah.

10:26 I actually had this and GitHub Copilot on at the same time.

10:29 Oh my gosh.

10:30 What happened?

10:30 It's a disaster.

10:32 But yeah, I like this because as much as I like VS Code, I'm a huge JetBrains fan and

10:39 the fact that you can't use it in PyCharm or anything else like that is very disappointing.

10:43 So yeah, I agree with that.

10:44 Yeah.

10:45 Well, I think I want to get like five AI coding systems together and they can just mob program

10:50 by themselves.

10:51 Exactly.

10:54 So when I look at this stuff, one of the first things I think, okay, it's using AI.

10:58 It's taking, it's like I said, it's taking the stuff out of my code and then applying the

11:04 AI to that.

11:05 Does that mean my code is being passed to somewhere that I don't want my code to be?

11:08 It's so somewhere.

11:10 Yeah.

11:11 Here you go.

11:11 It says your code is yours and yours alone.

11:13 It runs locally without sending any source code anywhere.

11:16 You can even work on a plane, right?

11:18 Anyway, I ran across this.

11:20 I was talking to the folks from there and I thought this is pretty cool.

11:23 I'll give a quick shout out to that because the AI coding assistants are all the rage right

11:27 now.

11:28 Is this a paid thing or a free thing?

11:29 Yeah.

11:30 It costs money, but there is a free version.

11:32 So you get like what they call basic.

11:34 Bad suggestions for free.

11:36 Yeah, exactly.

11:37 Like every 10th is a bug, but the other nine are really good.

11:40 No, I'm just joking about that.

11:42 I don't know.

11:42 But yeah, there's a free one and then you can pay for more.

11:45 Brandon, do you do the paid one?

11:47 Do you know the difference?

11:48 I just use the free one.

11:49 I assume that there's probably, like I said, better models and I think there's like a limit

11:54 to the amount you can do with the free one.

11:55 So it just stops working.

11:56 You actually have to do the work yourself.

11:57 Yeah.

11:58 To be fair, it doesn't look expensive.

12:00 So no, no, it's reasonably priced.

12:02 Yeah.

12:02 Yeah.

12:03 It's 12 bucks a month for the paid version.

12:05 I always feel like when people are like, oh, well, I'm not going to pay, you know, $10

12:09 for this thing.

12:10 It's like, this is your job all day.

12:11 How much can you actually make from this job?

12:15 Like if this could, you know, save you an hour, surely.

12:17 Anyway, that's a different discussion.

12:19 Speaking of discussions, following up on one of our episodes with Simon Wilson, who talked

12:25 about Apple Photos and SQLite and using dog sheep and data set to analyze it.

12:30 Rhett Turnbull pointed out a project that he created that will, says macOS photo pack.

12:37 Oh, the OS X photos, Python package exposes all of your data to your Python apps.

12:42 And the next release will provide the OCR stuff out of Apple's vision framework.

12:48 So people have been tracking that there's some really exciting stuff coming to the Apple

12:52 photo, you know, iOS, et cetera, where if you take a picture of something, then it automatically

12:57 do OCR and you can actually select and copy the text out of say a sign in a picture and

13:02 paste that somewhere.

13:03 So that'll be stored in the database.

13:05 And apparently this thing will give you access to that text.

13:07 Oh, that'd be cool.

13:08 Can I get that in my car so that I can just have somebody else reading signs for me?

13:12 That'd be sweet.

13:13 Someday perhaps.

13:14 All right.

13:14 So Rhett, thank you for that.

13:16 Okay.

13:17 The last, three things really quickly.

13:19 I released three, packages to PyPI last week.

13:23 two more related there around taking HTML and templates, either Jinja or chameleon,

13:29 one package for each language and trying to reuse them in like really clean, simple ways.

13:34 So if you've got like some fragments, say like the example have on the site is a video

13:38 app and it's got like a thumbnail of a YouTube video, then the title of the author, and then

13:42 the number of views.

13:43 And if you want to show that all over the place, you could either copy that code and

13:47 replicate it.

13:47 Or with this inside your template, you just say render template or render partial.

13:51 And you point at some HTML fragment bit and it'll apply your model to that sub thing and

13:56 allows you to basically create functions that return HTML inside of your templates.

14:01 That's neat.

14:01 Yeah.

14:02 So it's super, super simple.

14:03 So like for the videos, you have like literally this little render partial, you know, quote,

14:07 shared video square.

14:09 And you pass the video over a really, really nice.

14:11 So there's a Jinja partials for flask people and there's a chameleon partials that does

14:16 exactly the same thing for pyramid.

14:18 And then last thing, adding the chameleon template language to FastAPI so you can build proper

14:22 web apps.

14:23 I published that.

14:23 It's been around for a little while, but I finally published it to PyPI.

14:26 So you just put a little decorator onto a FastAPI function and it becomes a HTML endpoint

14:32 rather than a API endpoint.

14:34 Have you just, have you been using chameleon longer?

14:36 Is that why you're more comfortable with it?

14:37 I know.

14:39 I probably have been doing more chameleon than Jinja, but I do a lot.

14:43 But the thing that I really, really like about chameleon, let's see if I can find an example.

14:48 It'll probably be good enough.

14:49 But what I really like about chameleon is that it is valid HTML as it is.

14:54 Whereas with Jinja and the Django framework and a bunch of other frameworks, Mako and you

15:00 know, you go into other areas like Razor and ASP.net, all of these are nice, but they all

15:05 have HTML, HTML blocks of code, blocks of code, HTML block of code, HTML, right?

15:10 This is all driven through attributes, like view.

15:13 So like here, if I want something that's a loop, I can just say talcol and repeat as an

15:17 attribute.

15:18 Or if I want, yeah, things like that, right?

15:20 Or you do condition, you say talcol and conditional and you put it in there.

15:23 So this is actually 100% still valid HTML with just attributes that don't make sense.

15:27 So to me, it just feels cleaner.

15:28 That's why I like it better.

15:29 Yeah.

15:30 Okay.

15:30 Yeah.

15:30 I kind of tore through all those without giving you a lot of chance to talk about them.

15:35 But anyway, that's my extra A time.

15:37 Yeah.

15:37 I like it.

15:38 Thanks.

15:38 Cool.

15:38 All right, Brandon, you're up next.

15:40 Yeah.

15:40 So this is something I came across on Twitter and I signed up to do it.

15:44 So it's Kegel's 30 Days of Machine Learning.

15:48 Basically what it is, I guess if you don't know what Kegel is, it's a place for data

15:53 scientists to find and publish data sets.

15:55 They have online Jupyter notebooks that allow you access to free GPUs and things like that

16:00 to run your machine learning models on.

16:02 You can collaborate with other data scientists and things like that.

16:05 And machine learning is one of those things I've always kind of wanted to get into, but

16:08 I've always been a little scared.

16:09 I'm not sure the 100% of the resources to go to.

16:11 So I saw this 30 Days of Machine Learning.

16:13 And what's nice is they give you an introduction into Python, the things you need to learn from

16:18 Python to know how to do machine learning.

16:20 They show you how to build models in their Jupyter notebooks.

16:24 And yeah, so you go through that.

16:26 You learn some basic and intermediate machine learning concepts.

16:30 You get some certificates.

16:32 So if you want to post those like you know, with your resume or something like that, you

16:35 can say, hey, I did some learning with Kegel.

16:37 And the cool...

16:38 I haven't done any of this, but I suspect that if you ranked pretty highly on Kegel and

16:42 then you put that on your LinkedIn profile or you're trying to get a job that, I mean,

16:45 that speaks pretty well.

16:47 Yeah.

16:47 Yeah.

16:47 I would think so.

16:48 And I think the cool thing is like at the end of it, there's a competition that they

16:51 have with a...

16:52 It's like teams up to three.

16:54 And it's like only people that ran through the course.

16:57 So you're not competing against people who have been doing machine learning for years and

17:01 kind of give you a little bit of that taste into what machine learning competitions are

17:04 like.

17:04 So I think it'll be interesting.

17:05 It'll be fun.

17:06 Are you going to do it?

17:07 Yeah.

17:07 Yeah.

17:08 Nice.

17:08 What I think is valuable here is the constraints, right?

17:13 You know, you have...

17:14 Here's your data that you're going to be working from.

17:15 Here's the type of problem you're solving.

17:17 And so often when you're a beginner, whether it's machine learning or web development or

17:21 whatever, it's really hard to know what is the right sized problem to attack.

17:25 Yeah.

17:25 It's so easy to go, well, that's too small.

17:27 That's not interesting.

17:27 Or wait, all of a sudden I tried to build Instagram and I got stuck or whatever, you know?

17:31 Yeah.

17:32 And I think it's nice, you know, if they give you the data, like, yeah, I think a lot of

17:35 times the biggest part of machine learning and data science is cleaning the data and making

17:39 sure you have the right data and the right attributes to look at.

17:42 Hopefully they walk you through how to, you know, they should walk you through how to do that

17:45 and kind of give you a taste of how to do that.

17:46 It'll be a good learning experience.

17:48 I suspect this is free.

17:50 Is that true?

17:50 Yeah.

17:51 Yeah.

17:51 That's true.

17:51 It's free.

17:52 Yep.

17:52 All you need is a Kegel account.

17:53 Yeah.

17:54 And it starts August 2nd, which like four days away.

17:57 So don't hesitate.

17:58 Get in there if you're going to be part of this.

18:00 This sounds neat.

18:00 And there's this, but even if somebody doesn't want to do this, Kegel has a lot of learning

18:06 opportunities for people that want to sort of learn the tools.

18:10 It's an interesting resource for learning how to do this.

18:13 Yeah, absolutely.

18:13 Cool.

18:14 That's a great pick.

18:15 Brian, you're next, right?

18:16 All right.

18:17 Yeah.

18:17 So been testing a lot.

18:19 More testing.

18:22 So one of the things, I had a project that was set up to use talks, but I also early on

18:30 when GitHub Actions came about, I put it up on GitHub Actions too.

18:35 But I was trying to understand the workflow a little more.

18:39 At first, there were a lot of resources.

18:40 And then I came across this recently, just this weekend, this week, last week, building

18:46 and testing Python.

18:47 It's part of the GitHub Actions guides.

18:50 And it's actually pretty great.

18:53 And it goes through a whole bunch of stuff.

18:56 I mean, it's around a set of docs that talks about Python, Ruby, Java, a whole bunch of other

19:02 things.

19:03 But within the Python space, it really is a full setup of how to run this yourself.

19:11 The reason why I brought this up is I wanted to, hopefully people are using talks.

19:16 I love talks.

19:17 One of the reasons why I like it is because you can, it's kind of like a CI system, but

19:22 locally, you can sort of run through making sure your installs work, your builds work, and

19:28 all your extra tools that you've got hooked up.

19:31 One of the problems is you just got your Python, whatever, version 3.9, 3.8, whatever installed,

19:35 and you run your test, it runs on that.

19:37 But you want to kind of exhaustively go, I want to test on all the versions that I, in theory,

19:41 support every time.

19:43 Yeah.

19:43 Or you might have an error in your PyProject.toml file or your setup.py, and you're not seeing

19:48 that because you're not completely, you're not rebuilding it.

19:51 But talks will do that.

19:54 But so will CI systems, but it's kind of nice to have it set up both.

19:57 But if you, and the directions here are how to, it starts with directions on how to run,

20:02 you know, pytest and to install dependencies and build and lint and run pytest on your project.

20:09 But if you already have talks set up, this is sort of a duplicate effort.

20:13 But if you, I think you want to jump down to the talk section of this document because it shows you

20:19 just how to run talks directly.

20:21 And it's a, it's a smaller setup.

20:23 And essentially what GetUp Actions is doing is setting up a Python or a Python environment

20:30 and then installing talks and running your talks environments.

20:34 And so you're, you're, you're having that same code from your talks any file running within GetUp Actions.

20:40 And it's really nice.

20:41 I like it because it's going to try to do the same thing locally as it will in CI.

20:44 Yeah.

20:45 The one change I want to mention to flag out, and I've got, we'll have this in the show notes,

20:50 as I've modified this example because hopefully I didn't, it didn't make sense to me at first.

20:57 This, the example, the show is on push.

21:00 So when you push to a branch, it'll run these actions.

21:03 But you also want to set up a pull, on pull requests.

21:07 So just add pull underscore request right next to push.

21:11 And then, so when people do pull requests to your project, it'll run your talks also.

21:17 And then also if you want to try to run 3.10, and hopefully you are right now because 3.10's just around the corner,

21:23 add 3.10-dev into the Python list.

21:28 Oh, dash dev.

21:29 Interesting.

21:29 That'll run the RC, huh?

21:31 Yeah.

21:32 Well, I don't know if it's the RC or the, I think you can do RCs also.

21:35 But dev is, I think, close enough.

21:37 And you don't have to muck with it all the time.

21:39 Is that like the latest build 3.10 or something?

21:42 I think so.

21:42 I think it's just the latest 3.10 build.

21:44 And then at the bottom, there's like this thing that talks E dash pi.

21:48 And that dash E usually means run the environment, run a specific one.

21:53 But I didn't set up a, I don't set up the one that just says pi.

21:57 I usually say pi 3.7 or pi 3.8.

21:59 But I got some help also on Twitter to understand this.

22:04 What that does is it just will pick the one that's valid.

22:08 And I tried it out and it works.

22:10 If you do this code, it'll run the correct one.

22:13 Very nice.

22:14 Very nice.

22:14 Out in the live stream, we have Felix.

22:16 Hey, Felix.

22:17 Says, I love talks to you using it for my strong typing package.

22:20 And it's awesome.

22:21 And welcome, Felix.

22:22 Yeah, we covered your strong typing package a few weeks ago.

22:24 That's really good.

22:25 Yeah.

22:26 Oh, and then Oli says the machine language course sounds good.

22:31 So thanks, Oli.

22:32 Yeah, absolutely.

22:32 Yeah, absolutely.

22:33 Yeah.

22:34 All right.

22:34 Well, Brian, you spoke about the stuff on the plane.

22:37 And I've got an alternative solution for you.

22:41 Okay.

22:42 This is really interesting.

22:43 This one comes from Patrick Park, this recommendation.

22:46 And it's called Python-Vendorize.

22:49 So vendoring a dependency in Python means instead of linking to the package you get from pip,

22:55 you just go, I'm going to find that code and just jam it into my project and just pop it over.

23:00 Right.

23:01 Which is a bit of a hassle because then you've got to like keep syncing it and stuff.

23:04 But for small things like, you know, six, unsync, you know, like things that are one file

23:09 or they're just pure Python and they don't have many dependencies.

23:13 You know, what's, it might just make sense if there were an easy way to just make that

23:17 like a subdirectory sub module of your package.

23:20 Then when somebody runs your code, they don't have to pip install anything.

23:23 No virtual environments, nothing.

23:24 Right.

23:25 And so with this Python-Vendorize, that's what you can do for pure Python packages.

23:29 So the idea is if you've got some code that has, you know, lightweight dependencies, you

23:36 know, I don't know if I'd do this with something like Flask that depends on Vixoig, that depends

23:40 on who knows what, right click and so on.

23:42 Like you don't, I wouldn't necessarily go too deep, but for things that are smallish, what

23:46 you can do is you can set up a vendorize.toml file.

23:49 And then in here, just list the packages and you give it a location.

23:52 You say, I wanted to go for my project into underscore vendor in this example, but that

23:56 could be whatever.

23:57 And then you just run vendorize Python-Vendorize in the working directory where that, that

24:03 HOMO file is.

24:04 And what it'll do is it'll actually copy the package details over for that project.

24:10 And then in your code, you just say from underscore vendor, import package name, six requests,

24:15 whatever.

24:16 That's interesting, right?

24:18 Yeah.

24:18 Yeah.

24:19 So then you've got a program or a package really that has effectively zero dependencies, even

24:26 though you're still using some of these third-party libraries.

24:28 Do you know if it'll re-download, if you run this again, will it re-download them or, you

24:33 know?

24:33 I would, I don't know for sure.

24:35 And I looked, I didn't see anything in the documentation one way or the other.

24:38 It is honestly a little sparse on documentation.

24:40 This is an interesting idea.

24:42 And actually, and it often, like this does happen whether people like it or not.

24:46 And it's a completely legitimate according to a lot of the, I mean, the, the licensing,

24:53 right?

24:53 Yeah.

24:54 And for, but for commercial projects, this is very common that I, I don't want to go out

25:00 and pull things from pip all the time.

25:03 I want to just have things local so that they're, they're just built locally.

25:07 Right.

25:07 And it might not be for, just to avoid the, the pip install.

25:11 It might be that you want extreme control over what's shipped and you don't want something

25:16 that might happen to that package coming down through pip and breaking your code.

25:20 Even if you pin it, you know, you might want to just have more control over it.

25:23 Right.

25:23 Or a decision that somebody takes the project in a completely different direction that you

25:27 don't want.

25:28 It's like, it's like, this is a very hard fork sometimes.

25:32 Yeah.

25:32 I suspect rerunning Python dash vendorize will redownload it, but I don't know for sure.

25:37 Brandon, go ahead.

25:38 Can you pin versions in this?

25:40 Well, it looks like the packages in the, vendorize.toml.

25:43 It doesn't say that you can do versions, but I would be guessing, I was guessing here.

25:48 I'm thinking that you can probably pin them, but.

25:50 Yeah.

25:50 I'm just guessing that it passes whatever that string is over to pip and.

25:54 Yeah.

25:54 Yeah.

25:55 So yeah, that's what I was thinking as well.

25:57 So probably you can.

25:58 We'll have to try it out.

25:59 Somebody can tell us if we're wrong.

26:00 Felix is right there with you, Brandon, asking, do you know when you specify a version?

26:04 I don't know.

26:05 Like I said, it doesn't say in the docs about it, but yeah, it's, it's a small project,

26:10 but I think it's an interesting idea.

26:11 And it could be, you know, if you just have these real simple dependencies and you're like,

26:15 ah, we're going to have to create environments and have all these complicated instructions because

26:18 of, you know, a few little files, like just here's a nice way to do that.

26:22 Obviously you can do it yourself.

26:23 Right.

26:23 But here's a more repeatable type of way.

26:26 Yeah.

26:26 Cool.

26:26 All right.

26:27 Brandon, take us out.

26:28 What's your last one?

26:29 Yeah.

26:29 So there's a newer project out there called Supabase.

26:33 I feel really weird saying the name Supabase.

26:36 You got to get, you got to say it with an attitude.

26:39 It sounds like a car audio product.

26:41 I'm going to go put a Supabase in my car, but basically what it is.

26:44 Sorry.

26:45 When you're doing a clear, it's like.

26:47 But yeah, so it's, they tout themselves as an open.

26:53 Open source Firebase alternative.

26:55 So if you've ever like done a lot of JavaScript or been friends with JavaScript developers,

26:59 a lot of people use Firebase because it provides authentication.

27:02 I believe they're like more of a NoSQL database.

27:05 Yeah.

27:06 Real time updates.

27:07 So if you subscribe to database changes, your app will change based on if it, you know, something changes.

27:14 So what Supabase is doing is something kind of similar, but they are running basically a Postgres database for you.

27:22 And then they've got different open source projects that are wrapping it.

27:26 So they have the authentication part of which they have to have a wrap around the GoTrue library from Netlify for handling authentication.

27:33 So if you want to have authentication for your app, you know, you can easily do first name or email password.

27:39 Just email that sends like an authentication link to the email.

27:42 They have an extensive list of OAuth 2 providers.

27:45 So if you want to add off to it, they handle all that for you.

27:48 Yeah.

27:49 So the main idea of this database is kind of like I want to have a front end JavaScript framework maybe hosted on the back end by Python.

27:57 But then I just wanted to have like a database access over an API, just like the entire CRUD story.

28:04 Right.

28:04 Yeah.

28:05 And all of a sudden you run into all these challenges of offline, of authentication and stuff.

28:10 And that's what this is mostly focused on, right?

28:12 Yeah.

28:13 So they have a package they call it where it gets, if you can use it, called Postgres.

28:18 Oh, I can't say it.

28:19 It's a wrap around Postgres that basically gives you an API to your Postgres database that you don't have to write.

28:26 And they implement that in a way that, you know, you can just, like you said, make those HTTP calls to write, read, to basically do your CRUD operations to your database.

28:35 And what's nice is whenever you update your database, they automatically generate the API documentation for you.

28:40 So you're not writing any controllers, any services or anything to do that.

28:43 It's just provided by them.

28:45 And like you said, it looks like definitely a JavaScript thing, but they're actually just released a Python library for it they shove up right now.

28:52 Supabase.py.

28:53 Py.

28:53 Yeah.

28:54 So your snake has base.

28:57 Anyways, so it's currently, I believe, in alpha.

29:02 So I wouldn't suggest using it in like, you know, enterprise application, but it's definitely something to try, you know, play around with.

29:08 If you want a simple way to do authentication, access to a Postgres database.

29:12 And what's nice is, you know, if they give you the Postgres database, but you don't actually have to access it through their terminal where their UI, you can connect to it through, you know, whatever you use for your database.

29:21 And yeah, going along with the no internet development, they also have a Supabase local that you can run locally.

29:27 So you don't need internet to do your development.

29:28 So if you, you know, lose power, you want to get on a plane or something, you can still do your work.

29:32 Yeah, this is, this is super cool.

29:34 And I, one of the things that's interesting here is the subscribing to the real-time changes, right?

29:39 That's, that's pretty unique, especially over a remote API.

29:43 So, you know, if, if you've got some front end and you want everyone to see those changes, possibly, guess you could even do this in like a Qt or a WX Python app or even a terminal app.

29:54 But you might even want to just say, I've got a FastAPI app and I'm going to fire up a WebSocket there.

29:59 So all the clients just get that, the changes streamed down.

30:02 So, you know, the changes streamed to you and then they kind of like multiplex on out to all the people watching.

30:07 That'd be neat.

30:08 Yeah, I was thinking something like, I was curious if you could set up like an AWS Lambda.

30:11 So where something changes and you need to send out of a notification email or something to get hooked up to that and it would just kick that off for you.

30:16 Oh yeah.

30:17 So things like that.

30:18 Yeah, that's a good find.

30:19 I had not heard about Supabase, but it does look super.

30:22 Yeah, it looks really useful.

30:24 Actually, do you know what the story is?

30:26 So when I'm looking at over here, they talk about, okay, so here's how you specify your API endpoint at app.supabase.io.

30:34 Is there, and it's in this open source thing, but there's probably some database as a service or something equivalent that I maybe sign up for or I pay for.

30:42 Do you know what the story is around that?

30:43 I don't know.

30:45 I mean, surely they are not running the database for the world for free.

30:47 They got to charge at least bandwidth.

30:49 Yeah, so that's the interesting thing.

30:51 So there's a, their pricing model is a little confusing.

30:53 I know that I feel like they've gotten some funding and I don't know how they, they're going to plan to make money with it because the pricing that they have is like $25 a project a month.

31:02 And that gives you unlimited API calls, real-time functionality, eight gigabytes of database space.

31:08 I mean, I don't know who they're using for their database provider.

31:11 I can't imagine they have a data center somewhere where they're running it, but.

31:14 Yeah, it's probably on top of some cloud somewhere.

31:16 Yeah.

31:17 They do have a zero over, of a zero dollars per month version.

31:20 Yeah.

31:21 Yeah.

31:21 That's cool.

31:22 So I see a project I'm going, so.

31:23 Yeah, very nice.

31:24 That's an excellent one.

31:25 All right.

31:25 Well, I think that's it for our six items.

31:27 Brian, you got to think, actually, you want to throw an extra, you want to throw out there for everyone?

31:31 Yeah.

31:32 I mean, we had Simon Wilson on recently and he just released a post about the baked data architecture pattern.

31:40 And that's, if you know what he's up to, this isn't surprising, but it's a nice write-up.

31:46 Baked data is bundling a read-only copy of your data alongside the code for your application as part of the same deployment.

31:52 And it's just an interesting and neat write-up and it's good to go have a read.

31:58 Yeah.

31:58 It says most dynamic sites keep their code and data separate.

32:02 Code runs on the server and it's stored in like Postgres or Mongo.

32:04 With baked data, the data is deployed as part of the application bundle.

32:08 Interesting.

32:08 Okay.

32:09 Yeah.

32:09 And then also on the live stream, Tim Pogue is doing real-time research for us.

32:13 Thank you.

32:13 It looks like you were able to do a pin similar to, as you would with PIP, with the Python vendorize.

32:19 So, yeah.

32:20 Awesome.

32:20 Thanks.

32:21 Appreciate that.

32:21 Brandon, anything else you want to throw out for people while we're here?

32:24 No, not really.

32:26 I guess maybe do a little bit of self-promotion if I could.

32:29 I'm currently working on a side project called Released.

32:32 It's at released.sh.

32:34 Basically, what it is, it's working on a tool to automate release notes for companies.

32:40 I've noticed a lot of places, when they have releases, they need to go out and curate all these release notes and have somebody manually do this work that takes hours upon hours every release.

32:49 So, I'm going to try to automate that and make it easier for people.

32:53 That looks like a great project and nice web design.

32:55 Well done.

32:56 Thank you.

32:56 Thank you.

32:57 Tailwind CSS, if you haven't tried it, give it a shot.

33:00 I'm hearing good things about Tailwind.

33:02 I'm hearing so many good things.

33:04 Must learn.

33:05 All right.

33:06 Speaking of must learn, one must be cautious when learning, it turns out.

33:09 Because if we study the circle of AI life, there's this great cartoon here on devhumor.com.

33:15 So, there's the circle of AI life, and it's got these little pictures of how humanity progresses.

33:20 So, there's some two humans sitting here analyzing neural networks.

33:24 It says, human researches AI.

33:26 And then they're like celebrating near a quantum computer.

33:29 Humanity perfects AI.

33:30 Then AI perfects itself with lots of lightning.

33:33 AI enslaves humanity.

33:35 There's pyramids.

33:36 A solar flare disables the AI.

33:38 And then there's humans worshiping a sun god.

33:40 Humanity worships the sun god.

33:42 And we'll start over.

33:43 There's our joke for the week.

33:47 It's good.

33:48 Thanks.

33:49 Awesome.

33:49 Yeah, yeah.

33:50 It's a warning.

33:51 It's humorous and ominous.

33:54 The singularity is coming.

33:55 Anyway, thanks, Brandon, for coming on the show.

34:01 It was fun.

34:01 Yes, thanks for having me.

34:02 Yeah, it was great to have you here, Brandon and Brian.

34:04 Good to chat with you all.

34:05 Thank you, everyone.

34:05 Bye.

34:06 Right.

34:06 Thanks for listening to Python Bytes.

34:08 Follow the show on Twitter via at Python Bytes.

34:11 That's Python Bytes as in B-Y-T-E-S.

34:14 Get the full show notes over at pythonbytes.fm.

34:16 If you have a news item we should cover, just visit pythonbytes.fm and click submit in the

34:21 nav bar.

34:22 We're always on the lookout for sharing something cool.

34:24 If you want to join us for the live recording, just visit the website and click live stream to

34:28 get notified of when our next episode goes live.

34:31 That's usually happening at noon Pacific on Wednesdays over at YouTube.

34:35 On behalf of myself and Brian Okken, this is Michael Kennedy.

34:39 Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page