Transcript #232: PyPI in a box and a revolutionary keyboard
Return to episode page view on github00:00 - Hello, and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
00:04 This is episode 232, recorded May 5th, 2021.
00:08 I'm Michael Kennedy.
00:10 - And I'm Brian Aitken.
00:11 - And I'm Annette Lewis.
00:12 - Annette, welcome to the show.
00:13 It's so great to have you here.
00:15 - Thank you, it's great to be here.
00:16 Thanks for inviting me.
00:17 - Yeah, of course.
00:18 We were on a panel together at the Python Web Conf, and that was a lot of fun.
00:23 It was like a close out the conference trivia show or something like that, right?
00:27 - Yes, that was a ton of fun.
00:29 It was nerve wracking, but I really enjoyed it.
00:32 - Yeah, absolutely.
00:33 So tell people a bit about yourself before we jump into the topics.
00:36 - Yeah, so as I said, hi, I'm Annette.
00:39 I am a Plone and Python developer with six feet up.
00:43 I've been working professionally in the web development world for about eight years now, but my interest with working with web technology started back in 1999.
00:51 It's just been a passion that's followed me all the way till now.
00:55 - Oh, that's awesome.
00:55 Did you start in Python or?
00:57 - No, I didn't start in Python.
00:58 I actually started just HTML, CSS, and as I got more eager, I just put more and more languages, and then Plone was my gateway into the Python world.
01:07 - Yeah, wow, fantastic.
01:08 - Interesting, Plone is kind of a microcosm now, so.
01:13 - Yeah, it definitely seems like it.
01:15 All right, Brian, well, you wanna kick us off with a web topic?
01:19 - Yeah, this was just announced last week, the Sphinx theme gallery, which it has an updated look.
01:26 Actually, to be honest, I didn't look at it before, so I wasn't sure what it looked like before.
01:32 But I have a new Sphinx project that I'm working on, so I was interested in this and it looks awesome.
01:38 The theme gallery has, if you go to the theme gallery page, you can just browse through and all the themes are just like these images.
01:47 >> If you want to look like Read the Docs, you can do that or you get a plain white one.
01:51 Yeah, very nice.
01:52 >> That's neat.
01:53 >> Yeah. It wasn't obvious to me at first, although it's obvious now, each theme is shown in three different sizes.
02:01 You get the full wide layout or you get the narrow layout or what it might look on your phone.
02:06 >> Interesting. This press one on the screen here, which I actually like a lot.
02:10 You can tell it's clearly responsive and adapting the design to phone, but the celery one, it's just lots of sides scrolling.
02:18 >> Yeah, and then click on one.
02:20 If you click on any of them, you get a demo of what it looks like, and right away you get some instructions on how to install it if you want to, and then a link to the documentation for the theme.
02:33 Then you also have, there's a nice kitchen sink feature, so you can go ahead and you can see all the different markup that's possible.
02:42 What I really like is there's a specific API documentation example because for the project I'm working on, I'm using it to document some code, I really want the API documentation to be really clean and easy to read.
02:56 That's the most important feature for me.
02:59 I think we're going to go with the book theme because the book themes API documentation looks pretty good.
03:03 But we're going to start with at least.
03:06 Anyway, I think this is just a really nice way to review everything.
03:10 Drop down the Kitchen Sink thing and then click on API.
03:14 >> Oh, yeah. Look at that.
03:16 >> It's very nice looking to break up the different API documents.
03:20 - So this shows you how the API of your project will be presented through the documentation, right?
03:26 - Yeah, yep.
03:27 So yeah, using the API, I don't know, I'm still on the fence about how I'm gonna put all this in, but listing all the API of the project I'm working on, it's gonna be an internal documentation project, but this is really helpful, and I really think it's really nice looking, so good job, guys.
03:45 - Yeah, yeah, that's super neat.
03:47 You gotta write in restructured text, is that right, by default?
03:50 - No, no, no, I'm doing all Markdown now.
03:53 So the cool thing is, and I probably should do a write-up of this at some point, but Paul Everett's doing a talk for PyCon about doing Sphinx and Markdown, and that's what I'm going with.
04:05 So there's, yeah, the Mist parser using that.
04:10 And then there's also a way that you can actually put Markdown in your doc strings, so you can even write Markdown within your code comments.
04:16 - Oh, that's cool, that's cool.
04:18 And Nessa, what do you think of this project?
04:19 - Yeah, I think it's really cool.
04:21 I mean, when you work with so many clients and so many pieces of thing, anything where you can get nice, clear documentation and any themes are like a passion of mine, especially starting in front end.
04:31 So this is laid out.
04:32 - Yeah, 'cause you work, that's cool.
04:33 Yeah, your work with Six Feet Up is primarily like a consulting role.
04:38 Like you guys help other people with their Python and web apps and stuff, right?
04:43 - Yes, so we get to do lots of different projects.
04:45 And the best thing about that is we're always trying to solve different types of complex problems.
04:50 So any tools that we can use or introduce them to us is a great asset.
04:54 - Yeah, very, very cool.
04:55 All right, well, this next one that I wanna talk about is near and dear to my heart.
04:59 Brian, you may have heard me talk about MongoDB before.
05:02 - Yeah.
05:03 - Yeah, I'm actually a huge fan of MongoDB.
05:05 Like our site runs with MongoDB as the backend.
05:08 And one of the things I've been jealous about is SQLite.
05:13 So if I was working with Postgres and I wanted to use say Fortis ORM, I wanted to use SQLAlchemy, and I wanted just a simple little version.
05:21 Well, I could use SQLite and then change the connection string over to Postgres and get a real proper database, but I don't have to always have that in place, right?
05:29 Various reasons.
05:30 We even talked about using SQLite as a database file format, which was super cool.
05:34 So MongoDB doesn't really have something like that.
05:37 To a great degree, there was HynieDB, which is like it, but yeah, similar, but HynieDB, I don't believe it's actually MongoDB compatible.
05:49 I could be wrong about that, but I believe TinyDB is a little bit different.
05:52 - Yeah, it's different.
05:53 - Yeah, it's a document database, but it's not just swap the connection string for MongoDB, I believe.
05:59 So let me tell you about Mongita.
06:02 I don't know how that's really meant to be pronounced, but I'm going with it, it sounds fun.
06:05 So Scott Rogowski created this thing called Mongita, and he says, "Mongita is to MongoDB as SQLite is to SQL, which is really, really nice.
06:17 So it has a cool, I don't know, meerkat type of animal or something.
06:21 Mongoose.
06:22 I'm guessing maybe that's a mongoose.
06:24 Anyway, I love, I love the cool little animals and whatnot, but it's quite new, but it's also seems to be coming along and, you know, he highlights a couple of uses here, like for embedded applications, you might use it for, so an embedded database, right?
06:39 If I want to ship an app and it needs a database storage, but I would rather use a document type of database instead of a relational one, you can use it for that.
06:47 Also for testing, this is kind of cool because it's not 100%, but it's a non-trivial amount of the underlying MongoDB Python API is implemented.
06:59 So you might be able to just swap it out and use like an in-memory.
07:03 So one of the connection strings or clients you can use just an in-memory one.
07:06 So you could write like a pytest fixture, Brian, that like loads up your test data and then swaps things out.
07:11 And then just from there on out, You think you're talking to MongoDB, but you're talking to something in memory through Mongita, which is pretty cool.
07:17 And Sam asks, can we run this in memory?
07:19 Yes, exactly.
07:20 Exactly.
07:21 I can't wait to try this.
07:23 This is, this is pretty cool.
07:24 Yeah, it looks pretty cool.
07:25 And Dean is pointing out this may be the most popular DB in the country of Mongolia.
07:30 Anyway, so I didn't get the joke at first.
07:36 That's bad.
07:40 So it's meant to be compatible with MongoDB and implement a commonly used subset of the PyMongo API.
07:47 It's embedded, so instead of having a separate database server, you can just have this, which is really cool, like for workshops and stuff.
07:54 It's supposed to be not super fast, but decent enough to work with fast.
07:58 It's all tested.
07:59 Its only dependencies are PyMongo, which is the thing you've got to replace, and then sorted containers.
08:05 And theoretically, it's thread safe.
08:06 (laughs)
08:08 Obviously, it's not a real database, so I still think it's pretty cool.
08:10 So you can come along and just say, instead of creating a PyMongo client, a PyMongo.mongodb client, you could create like a Mangita client disk or a Mangita client memory, and then just do the queries against it, which is pretty cool, there's some performance comparisons and whatnot about how it works.
08:30 And then I'm going to point out one thing that we were talking about over here recently, connection with Mongo engine.
08:36 So if you're working with an ODM and you don't want to write raw queries and dictionaries, which I encourage you not to do work with some kind of ODM, it would be nice if you could just change something and then all of your code keeps working.
08:49 So this person, Rocky Holmes comes to us.
08:52 It'd be really awesome if I could like connect this through Mongo engine.
08:55 He's like, I'm not sure what's going on.
08:56 I'm like, well, so I wrote some code and said, all right, here's all the things that have to change to plug Mongo engine directly into it.
09:04 And basically there's just certain things you have to say.
09:07 Yeah, yeah, yeah, sure.
09:08 I'll do that for you.
09:09 Like setting the host.
09:11 You have to be able to set the host 'cause the underlying library tries to set the host, but obviously there's no host.
09:15 But if it's not there, the code won't run, right?
09:17 So there's a few things.
09:18 And Scott went through and merged that back.
09:20 So now there's a subset of working with Mongo engine as well by just swapping out the client, basically monkey patching the client.
09:28 - That's so cool.
09:29 - That's nice.
09:31 - Yeah, neat, right?
09:32 >> Yeah, I've been using TinyDB in small projects, and I definitely want to try this out because the path between starting with TinyDB and then going to Mongo is a big hurdle.
09:45 But this looks like a smaller chunk.
09:46 >> This is much, much closer.
09:47 Yeah, and if you use the disk writer thing, I think it's going to save it in direct vSAN instead of JSON, so it should make it parse less and whatnot.
09:57 I haven't tried that yet, but it does store it in vSAN, which is the binary version of JSON that MongoDB uses.
10:03 So I would suspect that's a smaller, faster, lighter file format than actually going to JSON and parsing the strings back.
10:10 - Nice. - Yeah.
10:12 Pretty cool.
10:13 All right, next up is Annette.
10:16 What's your first item?
10:17 My first item is about World Plum Day.
10:20 So last week, the plum community actually put together World Plum Day and I was kind of blown away by it because it was a 24-hour online streaming event and it was held, let's just say last week, and they put together over 50 videos, 16 countries.
10:36 It was like 10, 11 languages of content, just introducing all types of different parts of Plone.
10:42 So they went through like some general interest.
10:45 They went through some technical talks, case studies, and it's all available on YouTube right now.
10:51 So you can go and watch it.
10:52 And it's a great primer if you're familiar with Plone.
10:55 If you're not familiar with Plone, even if you just want to learn some new techniques or see some case studies, they have some great case studies about different universities that they were using.
11:05 So here, they actually put together a nice list of highlights.
11:09 And of course, yeah. - Oh, that's super cool.
11:11 - So if you're overwhelmed with looking at everything, here's like a good list that you can go through.
11:16 But like I laser focused, of course, on Plone 6 'cause that is something I have been waiting to come out.
11:21 And the more like breadcrumbs they get me, the more excited I get.
11:25 And they actually did this Plone 6 introduction in I believe seven languages already.
11:30 They're trying to add a couple more so that everyone can get this introduction to what Plone 6 is going to be like.
11:35 >> That's amazing. I've never heard of a conference doing that.
11:39 Even places like WWDC or Google I/O or Microsoft Build, there might be subtitles but not different versions.
11:46 >> Yeah. It's amazing.
11:47 At the very bottom, you can see that part of the link where they actually have a couple hours of content in just Italian.
11:54 It's for everybody.
11:55 It truly is a worldwide event.
11:57 - With Plone 6, they're talking about like, Volto and under the hood.
12:03 So if you're not familiar with Plone 6, or Plone in general, it's a Python content management system, but Plone 6 is also gonna have a React front end available to you in the form of Volto.
12:16 So you'll have the Volto front end, you can decouple that and use any front end you want 'cause it has the REST API, they're making it easier to install.
12:24 So I just, I can't wait to get my hands on it.
12:26 - Okay, yeah, here we go.
12:28 We've got the, if I can pull this up, we've got the Volto, a new experience for editing the web.
12:33 Is that, this is what you're talking about?
12:35 - Yes.
12:36 - Okay, it's like turn your CMS into kind of WordPress that you write in place or something like that.
12:42 - Right, so what it does is the Volto gives you the ability to dynamically make your layout.
12:48 So they break the content into little blocks.
12:50 So you can kind of drag and drop blocks and arrange your areas.
12:54 So it takes someone who might not be really technical or not be able to do front end or such, you can kind of just drag and drop them and get that modern layout experience without having to know all of that.
13:04 But then if you have that skill, you can make more blocks, you can present clients with more options.
13:09 So you can use as little or as much as you want and you get all the speediness and fastness of a React front end.
13:15 - Okay, yeah, that's really, really cool.
13:17 'Cause there's a lot of competition for CMSs.
13:19 You know, there's Wagtail for Django and then there's obviously WordPress that seems to run way more of the internet than it should.
13:26 And you might wonder like, okay, why am I gonna use this one or that one?
13:29 This is a really compelling idea to put in front of a CMS.
13:33 And I'm sure this will give Plone a big leg up.
13:35 - Yes.
13:36 - So I guess maybe I've missed it.
13:38 Is Plone 6 something that's out already or something that's coming?
13:42 - It's coming.
13:43 So they're still in the alpha phase.
13:46 It's not completely out, but what happens is you can basically put together the Plone 6 experience by downloading the Volto front end and then also having the Plone backend.
13:56 So you have the two parts, but they're getting it to the point where it's gonna be a real easy install process where installing Plone will install both halves that you need and get you up and running.
14:06 So you can start practicing if you're an early adopter now, if you go through the Volto documentation, but then the official Plone 6 will be all ready for you packaged to go.
14:17 - Cool.
14:17 - Yeah, really cool.
14:18 Thanks for pointing out both those things, the conference and Volta.
14:21 All right, Brian, you beat me to this one here.
14:24 - Did I? - Tell us about it.
14:25 Well, I was considering covering it, but you got it, man.
14:27 Go for it, it's a good one.
14:29 - Yeah, so Brett Cannon, he gave a, this is interesting, anyway, he gave a great talk a few years ago at one of the PyCons about, they did a keynote about basically burnout in open source developers.
14:43 But this is, he wrote another article today, or it wasn't today, it was in April, but called the Social Contract of Open Source.
14:52 But the highlight I really like is view every commit as a gift.
14:58 This is a really great article.
15:00 It's some interesting thoughts on what the contract is, and the relationship, and what relationship exists between a maintainer and the users of a project.
15:10 There's a really interesting analogy that he talks about of the open-source developers, like somebody that's just giving away free software, but they just have a pile of USB drives in their front yard with a sign that says free.
15:25 You can drive by, you can pick one up, and if you need a new version, you can drive by and see if there's a new version there, and you can get one if you want.
15:32 That analogy is interesting because if that was the case, the things that you would not want to do, you would not want to go up to the door and knock on the front door and yell at the developer.
15:43 You wouldn't want to leave an angry letter in their mailbox.
15:47 >> You wouldn't egg their house because you're mad that they didn't have a feature you wanted.
15:51 >> TP their tree.
15:53 You wouldn't go down into the middle of the street in their town and start yelling about how much you hate their software or how much an idiot the developer is.
16:01 You would treat each one as a gift. It's free.
16:04 If it disappeared, if it didn't show up anymore, if there were no versions, you're on your own.
16:10 It's a gift. Take it or leave it.
16:12 He brought up an interesting quote from Immanuel Kant, which I didn't quite get, but he translated.
16:19 His translation really is, when you treat a maintainer as a fellow human being who may be able to do you a favor of their own volition, then you end up in an appropriate relationship where you're not trying to use the maintainer for something specific.
16:34 So you're not using them as a mean to an end, you're treating them as somebody that's giving you a gift.
16:40 Just I like this attitude and it's great.
16:44 - Yeah, Brett is a real thought leader on this whole area.
16:47 Annette, you work with people who are probably coming to consume some of this technology on a corporate side and they might have different expectations.
16:54 You know, maybe they're switching from Java or .NET where they had somebody to go to and ask, like, we need you to support us in this world.
17:03 If we ask for a feature for fixing a bug or something, here's our SLA to make that happen, right?
17:09 Is that something you run into, Annette?
17:11 - Well, they always, of course, they set up the expectation.
17:14 So I'd like to say at least I've been very lucky.
17:18 So like I think most of the clients I've run into do treat it like everything that we provide for them.
17:23 Every interaction is a gift interaction.
17:25 So we're very fortunate in that front.
17:28 But I definitely know, especially when you have the and do hobby programming, that is especially where you see this come up.
17:36 If you contribute anything, I always think if I ever, ever, ever want to contribute not to be scared, but if I put something out there in the world, someone's going to expect me to support it sooner or later.
17:47 Yeah.
17:48 Yeah.
17:48 I have a couple of projects that I'm like, these are really neat.
17:50 And if I put them on PyPI, that would be great, but I'm not sure I'm ready to commit the energy and time to it.
17:58 So I think putting it out there fully in that way signals to some degree, like I'm making something of a commitment.
18:05 At least, you know, some people will see it that way.
18:08 So yeah, I've held back a bit.
18:10 Oh, I actually, so that's interesting.
18:13 I was talking with Brett.
18:14 Actually, there's a testing code episode that's getting released this week with Brett and we were talking about packaging and on one of my projects, I don't, I don't list which Python version it is compatible with, but it really isn't compatible with everything.
18:27 So I, I asked him about that and he said, well, if you only like, for instance, he said, if you only want to test on three, nine and like three, eight and three, nine, just list those.
18:38 I said, well, shouldn't I try to expand it to more Python versions?
18:42 He said, if you can, if you want to, but it's really up to you.
18:46 It's your code, you can share it however you want to share it.
18:49 So that's it.
18:50 - Yeah, that's the point.
18:51 - It's kind of a freeing mindset also.
18:53 - Yeah, absolutely.
18:54 Well, nice article, Brett.
18:56 I have one more for you, and I'm pretty excited about this.
18:58 I think this is a pretty cool idea.
19:00 Brent, we've spoken before about some of the tools to allow people to have private IPA servers for several reasons.
19:07 you know, one might be, we want to be able to publish, like one of our teams creates a package that we wanna share throughout our other code.
19:15 You could publish that internally and not make that a public thing, but you know, have a private PyPI server for that.
19:21 But this is a pretty cool article.
19:23 I saw it through this place called Built in Africa, builtinafrica.io, and it's about creating a portable PyPI server for offline access.
19:34 So if you're, isn't that cool?
19:36 Also, if you're in some place where internet is not super reliable, or maybe it's reliable, but it's really slow, and you want to work with things like all the packages on PyPI, those can start to be a big problem, or especially if you have got intermittent downtime or something like that.
19:52 So that's what this project is about.
19:54 And this person, who, Vuey Sili, and Nadlav, Nadlavu, if I'm, sorry, I'm sure I'm messing up your name, but they created this thing called the Pi PI in a box.
20:07 And the idea is here is a real simple way to take a Raspberry Pi and turn it into a portable IPI server and offline caching here, I guess, of all the Pi PI pip infrastructure, pretty cool.
20:22 Right?
20:22 I apparently, I got to use cookies, but you know, it's all good.
20:25 so the idea is basically it's a standard Raspberry Pi and it's supposed to be super affordable, should be very, very little setup, and it uses a couple of cool libraries that might be relevant to people anyway, right?
20:39 So you get this little 200 gigs SD card, use mini repo, which is a thing that will clone PyPI, use PyPI server to serve up the packages, and then put Nginx in front of the PyPI server, 'cause PyPI server apparently doesn't do caching and is slow to like reread.
20:57 If you like literally cloned PyPI, it would be like a little bit hard on it.
21:00 So you can put caching in front of it for different search requests and install requests to make it much faster using Nginx.
21:06 So this article really just talks about all the things you gotta do.
21:10 You know, you start with the Raspberry Pi, you get Ubuntu on it, you configure DHCP, create an access point, you add routing to it, you clone PyPI with this mini repo library that was pretty cool.
21:23 It's just a CLI, a thing you can get, which is cool.
21:26 Then you set up PyPI server, run it on the stuff that you've cloned, and then you put up a Nginx in front of it to make it much, much quicker.
21:35 Yeah, and that's pretty much it.
21:37 You could even do like SSL over it.
21:39 And then it talks about how do you integrate this into somewhere down here.
21:43 Talks about how you integrate this into PIP.
21:45 You can pip install things and so on.
21:47 Anyway, I think this is a fantastic idea that this person put together.
21:51 And yeah, I like it.
21:53 I think it could be a huge benefit to people, not just in places where the internet is not as reliable or as good, but maybe you're traveling and your internet is super, super slow while you're out of town for two months with your family, or I was just camping with my family and there was literally no internet, no cell coverage, nothing.
22:14 And if I wanted to work on a project, it'd be cool to be able to have this if we were staying for a long time to still continue to work in reasonable ways.
22:22 What do you two think about this?
22:23 - I think it's amazing.
22:25 Like I know I've traveled a lot in this.
22:29 There's sometimes I used to take train rides that were 14 hour train rides and every tunnel, every bridge, you have no idea what your service is gonna be like.
22:36 So something like this would be so great to, when you're sitting in a chair for that many hours, you can get a lot done.
22:42 And if I had Pai Pai in a box, it would make that so much easier.
22:45 - Yeah, absolutely.
22:47 Like Sam Morley out there says for traveling, definitely.
22:50 And then this actually, I believe was sent over by Jared Chunks.
22:52 Thank you, Jared.
22:53 And he says, you know, also on an intercontinental flight or when the power goes out or something like that.
22:59 You know, there's a lot of people who are sort of living the digital nomad life.
23:03 Doesn't work for me.
23:04 There's too many people in the life in schools and stuff.
23:07 But if you were, this seems like a really cool idea.
23:09 Another thing to point out in here, there's a nice little comment that I can't make, I don't see the instructions for, but this thing is a Raspberry Pi with stack overflow and Pi PI cloned into it.
23:23 >> The two things you need.
23:27 >> Oh, gosh. If I had those two things, I'd probably really not need the Internet again for quite some time.
23:32 >> This would give it an entire new meaning to a stealth startup.
23:36 You come out of stealth mode means you literally just reconnect to the Internet.
23:40 >> Yeah.
23:40 >> I like this idea. This looks really, really useful for lots of reasons and it's not very expensive.
23:45 To the extent that it can empower people who are struggling with these things, I think that's all the better.
23:50 I definitely need to try this, especially the mini repo thing.
23:54 I was taking a look at that. It looks great.
23:56 And also it looks like you can boil it down and only like only have certain Python versions.
24:03 So if you're only going to work on Python 3, you don't need to download all the 2.7 stuff.
24:06 All right.
24:07 Yeah, that's super cool. That's a good idea.
24:09 So, yeah, this is neat.
24:11 Nice.
24:12 All right, and then you got the last one, right?
24:14 Yes, I do.
24:15 This was a fun project that I just came across browsing the internet.
24:19 It's a blog post by Kevin Martin Jose, and it was about film simulations from scratch using Python.
24:27 In particular, this goes over implementing a color lookup table to an image with Python and image processing, almost like in the film industry when you want to color grade something.
24:38 I thought, "That's an amazing project." The way this is broken down is they walk you through the pieces and build you up to getting to a more complex project.
24:49 and they explain the lookup tables while they're at it.
24:52 So the primer, I'm going to give a real quick primer on the color lookup table.
24:56 So basically you have this magical 3D cube of color or some representation of color.
25:02 And of all the colors in the world, you want to map it to a certain amount of numbers.
25:05 So I might say, if I have whatever many colors, I want to map it to just eight colors.
25:10 And I want every red to be this red and every blue to be this blue and such.
25:14 So what they end up doing is they just start They're going to build a pill and image, and they just start with a red image.
25:21 Then they make their own lookup table, and they're using NumPy.
25:25 They're using those arrays to make the reference table that they look for.
25:30 Then afterwards, they say, "Okay, I'm going to take all these red values, and I'm going to write a new method that's going to pass this image through and reapply the colors depending on what my lookup table is." In the first example, it's just a red cube.
25:44 they're using NumPy zeros, their entire table is zero, so that comes out to black.
25:49 So their little red square just turns black.
25:52 And they're like, well, that's not quite as interesting.
25:54 So they actually take a specific address in that table and they say, we want to reassign this one to green.
26:01 So the next time they apply this, it turns to green.
26:04 And then as you get through the article further and further, they take up this charming little truck from Rome image, And they say, okay, let's map all of the reds to green.
26:15 And of course, well, that means all of the other colors end up being black.
26:18 So it's like those things in Microsoft Paint, if you take a big image and you open it with two bit color, that kind of image.
26:25 - You wanna feel like you're back on a Commodore 64.
26:28 - Yeah.
26:29 (laughs)
26:30 So then afterwards, they say, okay, well, now we've got to make this a little more detailed.
26:35 So they make a more complex table and magic happens in code and such.
26:40 There'll be a link to this article, so if you want to read through it, it's actually a really interesting read.
26:44 But then afterwards, they make a bigger table, and they try and get more color, so they bring it up to, I believe, 12 representations, and now it looks recognizable.
26:54 But then finally, now that they've gotten through all of this color and the for loop where they're actually iterating through all of the pixels in the array and then reassigning it, and they use a scale, they're also using NumPy Rint, rounding it to round the scale to certain values.
27:11 So they can say, "Okay, I'm taking this entire block of color and assigning it to this color block." >> Oh, yeah, like quantizing it.
27:18 Yeah, how interesting.
27:18 >> Yeah, exactly. I think they take the table size, divide by the number of colors and then they reassign them as they need to.
27:27 But then afterwards, they actually say, "Okay, now we've gotten you through all of those pieces." They have nice side-by-side so you can see before and after.
27:37 - I noticed that about that article.
27:38 That's so amazing that you have a slider to like sort of see the image effects.
27:42 Like that's a cool blog post.
27:44 - And that's just with the identity of the 12.
27:46 It's not even that many colors.
27:48 So it's amazing how the human eye just says, oh, that looks good enough.
27:52 But then afterwards they're like, okay, now we've made our own lookup table.
27:55 Now we can download lookup tables and start manipulating.
27:59 So they reassign a value to green.
28:01 So you get that truck and they just patch green into the red areas.
28:04 And then finally they end up using a hauled clot.
28:09 (laughing)
28:13 - As I would get it.
28:16 - Yeah, so they actually, they download a PNG version of this table.
28:21 So instead of a 3D cube and just numbers, it's an image.
28:24 And then this is what I thought was the coolest part of all of this is they scroll, scroll, scroll, magic numbers.
28:32 But what they basically do is they take that image, they open it with Pill, they use the numpy array to make that an array of values that they can use against.
28:41 They bring in the image of the truck, and then they have all of this magic code there that they reassign those values one by one.
28:49 So it iterates through all the pixels, and then it spits out the filtered image, and then Pill puts it back into an image form so you can see what you got.
28:58 And I'll skip to the very last one.
29:00 Oh, did I miss one?
29:01 There you go. You can see how this is less desaturated.
29:05 >> Oh, yeah.
29:06 >> That's just that particular type that they applied there.
29:10 I thought there was one more in here somewhere.
29:12 Oh, there you go. There's the green tint, where they just added a little bit of green to every color.
29:18 It was so cool because I spend so much time in the web Python world that it's so easy to forget that Python, it's got such a wide array of things that you can do with it, and just image processing just blew my mind.
29:33 - Yeah, I agree.
29:34 This is super neat.
29:35 And it's the kind of stuff that I wouldn't do that often, but it's also really cool to see what you can do.
29:39 It's kind of think Instagram filters type of thing, right?
29:43 - Yeah, some of the image processing stuff is really cool.
29:46 I remember in a university, we had a class where we took the colors that we took it, looked at the colors that the human eye sees best, and then tried to map those two colors that different animals see different colors better or different frequency ranges.
30:04 You can translate those and highlight, translate other frequencies and shift them so that you can represent what an image might look like to a different animal.
30:15 Those are interesting things.
30:18 >> The bird eye, the dog eye, the cat eye.
30:21 >> Yeah. Well, for instance, birds and insects often see different.
30:25 Since they see different frequencies, a lot of flowers have patterns in them that we can't see because they're not intended for us to see.
30:34 - Huh, very cool.
30:36 Okay, awesome.
30:37 Yeah, Jared Chung out there also says, "Always wanna play around with images using Python, "but haven't got around to yet.
30:42 "This is a really neat example to explore." I totally agree.
30:45 And then a couple of comments just going back.
30:47 Sam Morley says, you know, about the IPI in a box.
30:51 Like for an on-system package, you could actually do this in Docker on localhost.
30:54 So if you just wanted it for you, if you didn't want to share it, that might be pretty neat as well.
31:00 And of course, if you removed all the duplicate questions and the comments saying you're doing it wrong, you could probably just fit it on a Raspberry Pi, this stack of reflows.
31:07 (laughing)
31:09 And then Kelly Paredes from Teaching Python Podcasts, a former guest here.
31:15 The super cool, share thanks, even the simple thought of turning simple pixels into another color, to be really nice for students 'cause yeah, she and Sean teach middle schoolers how to do Python, which is neat.
31:27 Awesome, awesome.
31:27 All right, well, I think that's all of our items, isn't it, Brian?
31:30 - Yeah.
31:31 Yep.
31:32 Do you have any extra information for us?
31:34 - Oh, you know it.
31:35 It was almost an extra, extra, extra, extra here all about it.
31:39 I'll be quick though.
31:40 So many of the Python things are available in new form.
31:44 Most notably Python 3.10 beta one.
31:47 I saw that in PyCoders today.
31:48 So thanks Dan and team for putting that out there.
31:51 Point that out.
31:52 But yeah, this is the first beta of 3.10, which is sort of the stable version, right?
31:57 Which is pretty neat.
31:58 Let's see, then I covered HTMX not too long ago, a couple episodes ago.
32:04 And that's a really cool way to basically add JavaScript-y dynamic front-end stuff without doing almost anything.
32:11 It's more like declarative stuff, but someone pointed out that HyperScript is sort of a companion type thing.
32:18 It's pretty new, but really simple.
32:19 You can just say like button on click, toggle this CSS element.
32:23 And yeah, super neat ways to add little bits of interactivity to your webpage without really doing a ton of JavaScript stuff.
32:34 And apparently it is accompanied with a haiku, which is always cool.
32:38 And then lastly, it's not quite last, maybe it's last.
32:41 I also wanna point out that we just released a new course.
32:43 I talked about it coming, but now it is out.
32:46 Getting started with Dask.
32:47 So if you wanna take Pandas code and run it on all 16 cores on your machine, or you don't have enough memory, but you got disk space to load up the data or you want to run it on a cluster, Dask is like the next level scaled out pandas.
33:01 So here's a free course I put together with Matthew Rockland and team over at Coiled on working with Dask and just getting started with it.
33:08 So people should check that out if they want.
33:10 And I believe that is it for all of my extra items.
33:13 Either of you, want to add anything else?
33:16 - Oh, I have something.
33:17 - Yeah, awesome.
33:18 - Yes.
33:19 So the Python Web Conference 2021 happened in March, but we're getting a headstart on the Python Web Conference 2022 and their call for papers to open.
33:29 So that's a conference that's put on by six feet up and it focuses on Python, particularly in the world of the web.
33:36 And that's actually where I met Michael Kennedy doing our panel, our fun quiz show panel.
33:40 It's also where I've met like a lot of the Pythonistas that I've come to call my friends and in the community as a whole.
33:47 So just want to say if you're interested in speaking, I will say this and it probably seems ironic since I'm on a live cast right now, I'm an introvert.
33:56 I'm really shy and I usually don't like speaking in public, but I always push myself and try and give a talk just because if you're passionate about it, you'll probably find somebody who's just as interested in and you can learn and teach both the same way.
34:09 So there's a variety of different topics.
34:12 We have speakers from all over the world.
34:14 So it's a great time.
34:16 So whether you attend or just put in a talk, I hope to see you there.
34:20 - That's a great shout out.
34:21 And this conference is quite large.
34:23 You said you're seeking 60 speakers for topics related to like this big long list that people can find in the link.
34:29 Yeah, it was like four or five days, something like that?
34:31 - Yeah, it was five days.
34:33 They did half day, so you didn't get as much fatigue.
34:35 That was really cool.
34:37 I liked that.
34:38 And four tracks.
34:39 And I know they even had a culture track.
34:41 So even if you're not technical, they're still just with the Python community and culture things to listen to.
34:46 - Yeah, yeah, very nice.
34:47 I want a second your thought about encouraging people to speak even if they're introverts or shy or they don't feel like they're ready.
34:52 A lot of times just putting yourself out there can really help amplify your career.
34:57 And it could be something like, here's how I learned to become a Python web dev and these are the things that were struggles and these are how I overcame them.
35:05 Like that might be really helpful to a large group of people.
35:07 And just putting yourself outside of your comfort zone can make a big, big difference.
35:11 And here's a pretty low stress, low risk way to do it.
35:15 - Yeah. - Yeah, fantastic.
35:17 - I guess I wanna reiterate that.
35:18 I think one of the things about either blogging or speaking at a conference or something, as a developer and especially an interviewer, I'm often looking just at the people that are better at me.
35:29 So I'm looking at learning.
35:31 So either writing or talking gives you a chance to turn around and see how far you've come and start teaching some of that back.
35:39 And I think it's good for mentally just to help people realize they've come a long ways.
35:45 So yeah, for sure, for sure.
35:47 All right, just some funny.
35:49 Do I do have some funny?
35:50 OK, so this one I found out about it because of our friend, Cecil Philip, who was just on the last episode and he tweeted.
35:57 This changes everything.
35:59 I'm like, all right, what is this about?
36:00 Says so this comes from Stack Overflow.
36:04 It's a little bit old, but it's a goodie from April 1st.
36:07 It says the reviews in are in the key is flawless.
36:10 The key is a new keyboard from Stack Overflow and it comes in this super tiny box.
36:14 and it's here to help programmers code better.
36:17 And so there's this video, I don't think I can get the audio into the stream, so you'll have to watch it, I'll link to it.
36:23 But the idea is you have this keyboard here and it only has three buttons.
36:28 It has a stack overflow icon, which is like the command or the control button.
36:32 And then it has a C and a V.
36:34 It has a really beautiful like whisper click sound.
36:38 And yeah, it says free your keyboard with the unlimited copy and paste.
36:42 The key is the name of the keyboard.
36:44 What do you think?
36:44 - Oh my gosh, that's great.
36:46 Like if I could have that in my normal keyboard, just so I know, it's like, okay, it's time for some Stack Overflow time.
36:52 Copy, paste.
36:53 - Exactly.
36:54 I mean, it's obviously a joke, but it could be kind of like, all right, I'm going into the mode, I'm using the special three key keyboard, let's do this.
37:01 - Yeah, if you could have like, whatever you highlight in your code, it just automatically looks that up in Stack Overflow, and then a key to copy the answer, the top answer, and yeah, there you go.
37:12 - Yeah, exactly.
37:14 - You can just automate all of programming.
37:16 - Yeah, you can even tie this together with that stack overflow in a box thing.
37:21 I'm not sure, I'm not a huge fan about the touch bar thing in the Macs.
37:26 They're fine, but I don't hate them, but I don't really love them.
37:28 But it seems like somebody could program one of those touch keyboards to have just this.
37:33 If it sees you're in a browser with that URL, it just, it switches to just these three keys.
37:37 (laughing)
37:40 Fantastic.
37:42 All right, well, I think that is, that's it.
37:45 That's the show.
37:46 Brian, thanks for being here as always.
37:47 And Ed, so great to have you here.
37:49 - Thanks, good to be here.
37:50 - Yep, bye everyone.
37:51 Thank you for listening to Python Bytes.
37:53 Follow the show on Twitter via @pythonbytes.
37:56 That's Python Bytes as in B-Y-T-E-S.
37:59 And get the full show notes at pythonbytes.fm.
38:02 If you have a news item you want featured, just visit pythonbytes.fm and send it our way.
38:06 We're always on the lookout for sharing something cool.
38:09 On behalf of myself and Brian Okken, This is Michael Kennedy.
38:12 Thank you for listening and sharing this podcast with your friends and colleagues.