 All right. Hello, everyone. Happy Friday. Oh, it looks like our chat disappeared I see volume at least in the OBS. Let's see if we can make the chat that come back. Oh All right sneak peek behind the scenes. Oh, wow. Yeah, just really doesn't want to come back, huh? And the wrong chat Let broadcast How's it going Paul SK and see Grover. Happy Friday Uh Not with our chat here Yeah, I'll pull this back. We probably don't need to see her anymore Connected scored this where I had this working earlier. Ah, there we are. Let's get the size fixed there Yeah, this it does this thing where it's like certain sizes. It doesn't like to show kind of just disappears and reappears At a bit of a mind of its own in the OBS Not sure how wide do we have room for let's try like that see if it's oh Thank you for the gift whoever that was Janiske that actually helps me see how wide we can go. There we go All right. Hopefully that's still legible and everything to ship of good evening. How's it going? Janiske what do we got there? Is it a Submarine or oh, it's a Minecraft. Wow How's it move? that have a The command blocks or something. I don't know. I'm not Not up on Minecraft very much Probably actually much simpler than I make it out in my mind. That's pretty cool looking though. Did you make that? Okay, let me get the make let's shuffle a couple more of these around so I can see both of the chats How's it going DJ Devon good afternoon and happy Friday Beata said to Friday, excuse me to Friday coffee. Yeah, apparently, huh? It's a to coffee Friday for you How's it going and happy Friday? Happy to two coffee day as well. I Was a three coffee Friday for me. I had the morning coffee The mid-morning coffee and the afternoon coffee was my coffee regimen today All right, I think we're about ready to get going here Got both of these so I can see him. Let me see what this other mention is Up with near docks playing with text scale, which is really cool Using bitmap tools You scale the different sizes, which is actually really cool Somebody was asking if this was possible and the first answer off the top of my head was no It's not possible, but there is actually a way there's bitmap tools It just needed a bit of tinkering to work with text and near doc actually went ahead and Hacked it up for us. Got it going. Which is actually super cool Cool. Okay, so let's get this show on the road. So hello Hello, everybody. First of all, welcome and thanks for tuning in. My name is Tim I go by foamy guy on github and discord. This is the deep dive program on This program. We're gonna be looking at circuit python related stuff. Sometimes we are working inside the circuit python core Sometimes we're working inside of circuit python libraries. Sometimes we're working on projects other times. It's documentation or infrastructure The kind of common thread that brings everything all together that I work on here during these streams this weekly program is It's all related to circuit python If you are new and don't know what circuit python is You can learn more at circuit python.org. This is the main website for the project If you hear any loud crashing in the background, that's my cat running back and forth as fast as you can all the way across the entire house So don't mind that Circuit python.org again. This is the main website for it This is basically basically a implementation of python that runs on tiny computers called microcontrollers If you do go to circuit python.org and click downloads, you can see a bunch of different pictures of them I also have the camera pulled up here Where I have a feather esp 32 s2 tft device. So this has a built-in screen It's got the feather form factor and this is one of those microcontrollers. So this thing here It's kind of connected to the other board We'll take it out just this bit right here Technically the the real brain of it is inside this on this one. This is a microcontroller It can run circuit python Which what that means is that we're able to load python code onto this just like it's a thumb drive Save our code and it will execute it for us and that is what circuit python is all about is running python code on these microcontrollers I'm gonna pull this back To make sure I get it plugged in right there So that is the high-level look at circuit python what it's for that sort of stuff if you are interested in the circuit python project again circuit python org you can learn more I'd also encourage you to join us down on the discord if you Look down This way nope wrong way this way if you look down that way ADA FR you dot IT slash discord is on the screen there That is where you can join us during this program the live chat that is right below me down there That is on the discord in the live broadcast chat room The one below that is YouTube which you can join us over there as well If you want to join the discord though You can join us in the circuit python dev channel and the help with circuit python channels as well as many other channels all throughout the week So if you want to get involved in circuit python development You have a project that's using circuit python if you want to ask questions about it If you have a problem you want to get help with that sort of stuff You can head over to the discord join us there and there are lots of great folks in the community who are always You know chiming in on the discord with all kinds of different stuff. So head over there come join us and we'd love to see you Circuit python is an open-source project it is You know out all the development takes place out in the open on github However, I will say it's primarily funded from a financial standpoint by this company Adafruit. This is their website adafruit.com That is of course the channels that we are streaming on right now or the Adafruit channels on YouTube and Twitch and such so definitely a huge thank you to Adafruit for You know making circuit python possible by paying the folks who work on it If you want to help support the project, but you're not interested in getting involved in development One of the ways you can do that is just by purchasing hardware from Adafruit They sell the microcontrollers just like this one that I have back here So feather tft microcontroller is an Adafruit product in this case as is this one in the middle here with all the Neopixels on it and in this case the one that they are plugged into in fact is also an Adafruit product a feather tripler So they sell all kinds of stuff Including the microcontrollers themselves and all the stuff that you can plug in hook up to the microcontrollers and do fun stuff With so head over there get yourself some toys Thank you for shopping at Adafruit.com again just to reiterate because they are paying the folks who work on the project Including myself for that work. So a huge thanks to them and huge thanks to everybody who purchases hardware from them Getting into the specifics of the day, how does circuit python differ from micro python? That is a very good question. I Am not the best one to answer. I think there is Where have I seen that there is a better? There is a better answer than that then I can give you Written somewhere Here we go Check out that page which I'm dropping in the discord link there has differences section One other place that might be good to look this this one is perhaps a little bit harder to dig up But maybe somebody could help you if you have trouble There was an AMA on the python reddit. I think last year for circuit python day, so 2021 This would have been circuit python day. I would have been August or September last year I forget which month it was in but I want to say August There was an AMA that included Scott the lead developer of circuit python that also actually included some of the micro python Developers as well. This was a question that was asked there and they both got a chance to answer it So that's also a good place to go Where you could actually get an answer that comes from the viewpoint of Scott the lead developer of circuit python as well as You know some of the micro python developers I don't recall exactly who or how many of them were there But that's a place to look as well for a more expanded version of the differences between them I think I could think of is it's more specialized for microcontrollers in tiny tiny packages Yeah, that's a short question with a long answer. That is definitely true near doc. It is. Yeah, I would say the In my mind the highest level difference that at least is most important to me Which like, you know, this is my opinion here, right? So Take it for what it's worth the the most important difference for me is about the How easy it is to load circuit python on a wide array of different devices And then how easy it is to run your code just by opening it up as a file on a thumb drive saving it and then having it run Right away that that quick iteration of just saving your code and having it run not caring about drivers serial ports None of that stuff just open it up like a file any text editor you want save it Boom it runs That is one of the core things in my mind that stands out as the difference now that being said I will say also I don't have that much experience on micro python truthfully the vast majority of my experience is on circuit python That is really the main thing I could speak to Maybe micro python has some possibilities to do that kind of stuff these days as far as I know though That was a thing that workflow was originated in circuit python Let me catch up on the chat here can scale fonts down. Yes, it can scale fonts down as well Well, okay first important thing to note. It's not scaling the fonts per se. It is scaling bitmaps It can scale bitmaps both up and down though So if your bitmap contains font you can scale it down now I have no idea like at some point it will become illegible You know, I have no idea at what point that is so I don't know how far you can scale it down before it's difficult to read Do you have to load it each time manually or does it stay on the device and run each boot? Somebody might have answered this in the chat already. This was a couple of minutes back But just in case not it does stay on the micro controller each time you do not have to reload it Once you save it It is stored on there Just like it's a thumb drive that you opened up a file and modified it and then saved it Once you do that it is saved on there and it will just automatically rerun whenever the device is plugged into power Fractional bitmap scaling will be very useful. Yeah, I totally agree and and that's in there today That's in bitmap tools roto zoom. So that is possible to use today. It's just a bit of an advanced feature I can drop code iterations for the win. Yep, so much faster than waiting for the compiler Circuit Python is by far the most fun language. I've learned yet. I would second that as well same for me most fun language That was floored That one second cat taking the opportunity while I'm busy here to be up on the counter, of course. He is a Little fuzzy, but Scaling fonts with pixelation down is a given just having the capability now is awesome. Yeah Didn't need it a full pie to learn to work on a Pico W. Yeah, the Pico's are great The the price point of the Pico's is difficult to beat and power as well It's a separate project with different goals and development cycles Talking about the test. I did. Yeah. Yep. We were talking about that left picture is a little blurry Yep, did you you did go down? Did you go down one or is the smallest one one? I guess the smallest one It looks like is one. I Can't actually tell how's it going David Essa Happy Friday okay I think we're caught up on the chat now. So thank you to everybody for coming to watch and hanging out in the chat Thank you to everybody for Talking hanging out. I'm saying hi having fun What I want to get into specifically today is a continuation of some of the stuff that I've been working on the last couple of weeks It is specifically we're gonna start with the pixel map So for folks that might be new if you don't know what's going on with this Pixel map is a helper class that is used for Neo pixels which are RGB LEDs in particular It's really good when you have neopixels in a grid such as what we have right here in this little feather wing plug-in We have a four by eight grid of neopixels the pixel mapper class makes it so that you can Set up your mapping and then sort of manipulate multiple of these RGB LEDs as though They were one so for instance if you wanted to turn all of this row right here on at once onto the same color Pixel map will allow you to kind of treat all four of those as a single Neopixels so you set it up once and then you just say turn my first row red You don't worry about it after that, you know how many pixels or which ones are all that it kind of stores all that for you In particular what has happened is this class used to be a Python helper class it was inside of the LED animation library And I'm saying used to be as though it's in the past tense The truth is this is actually still there part of what we're going to be doing today though I think will be PR this to remove it from here So this is actually the place where it exists today is inside LED animation inside helper There is this class here pixel map The thing is though this has now been implemented inside the core or I should say at least some portions of this not the entire thing mostly the portions that can Gain efficiency by being in C code instead of Python So there is now a core version of pixel map and what we are working on today is further integrating the Python layer because we still need a Python layer as well to bring in some of the functionality So we're gonna be working on integrating the Python layer with the new core object And I'm stalling a bit here. So I'll pull this up. It's just where we're trying to go This is the change inside the core that added the pixel map class in there Jeff originally worked on this. So thank you to Jeff. Thank you as well to mark gambler who helped me finish it up Mark implemented the get slicing which was really nice because I think that was probably beyond my skill set a little bit So I was happy to get help on that. So thank you You know loads to mark for Implementing that get slicer and it turned out it was much faster than the Python implementation. So that's good that we got that This is now merged in and so that's what we were working on in Even more specific What we are gonna do is actually work on these two issues which mark left for us So problem with individual pixels set to true We're gonna try to recreate this problem. We're gonna try to figure out what the problem is we're gonna try to fix the problem To start with I have a feather tft because this is merged now This one in the core We should be able to just go get a build from circuit python org I Should not need to make a custom build although if we run into trouble. I will Go back to making custom builds, but I think we can go here. We can go here absolute newest Let's go with pirate. Let's grab the newest one. Oh, we don't want to bend though. I do want a uf2 Okay, I am gonna go to bootloader mode on my device Except for my device is not plugged in which Severely inhibits its ability to go to bootloader mode. Let's plug it in Let's let's also press this button so that it's actually plugged in Let me catch up here. Oh my god, tiny. That's so awesome Let's see the picture there the left photo is a little blurry. It's gonna be Is this gonna get rolled into the display over bitmap fonts to make it easier? I don't know for sure the small one is 0.65 and it says a lot of eligible narrow dock reports that the small one is Allegable at 065 It I mean it's in display. I oh now it's in technically it's in bitmap tools is the function that makes it work I would say the best place for it is probably in bitmap Label, however, it's also weird bitmap label is intended to be the same as label just a Different internal implementation, but the same API If we changed one ideally we'd want to change both But it would probably be harder to or more complex at least to do it in the regular label rather than the bitmap label It would be cool if that were built in I will say that for sure. I'm definitely open to PR on display text to add that functionality for sure Doesn't matter if it's illegible. There's still uses that's true Yeah, like if you want like runes or something on the on a tiny page or something in a game Here we are with the new and old lingo. Yep, that's true We got the new and old lingo coming back so many new devs helping out lately bill 88 T doing some great stuff Jeppler's been on fires and Scott's back last couple of weeks. Everybody's on a rampage squashing bugs. Yeah Made the modification in bitmap label. We need a fontio module. There is I think there is a fontio module But it doesn't Is there? Am I thinking of does that exist? I'm second-guessing myself actually exist fontio. It sounds familiar. Maybe that's a CPython thing This search page Search page kills me. I always forget about this a little slow fontio. There we go. But this is Blinka core low-level usage So we have fontio, but it looks like it's meant for not really End user usage. It's like internal more so I guess probably bitmap font The the library Wraps this. Yeah. Yeah, okay Yes, we do have that But the the thing is that Bitmap tools is really for scaling bitmaps. It just so happens that Bitmap label has a bitmap. So it's it's not that it scales the font specifically Just that it's scaling the bitmap So I did download my uf2. I did not successfully get to bootloader. So let's actually try that again Okay, now we're on the bootloader. We'll copy our downloaded uf2 It's here. I want to make sure to get the uf2 not the bin copy that I have a lot of things connected This is the one. That's the device though. Did I think just disconnect that one? Probably disconnect this one too, but I guess I'll leave it for right now This is always going to be going back to here, huh? Yeah, I will disconnect it. Okay. I am also gonna get the example for You get the example for this or should we use the example from LED animation or I guess ultimately we're gonna be running the code that Mark gave us here Actually just creating Okay, let's start. Let's actually start with the example though. Let's go there and go examples There's a lot of things that happened. I just heard a cat jump down from the counter We're not on the counter. Where are you buddy? What was here? Okay, yeah, this is the test for display root group change Let me keep that actually It's in the it's in the PR anyway, but you don't have a copy anymore Get up with another browser somehow Yeah, we do have Fonteo, but it just doesn't do anything with scaling In fact, I don't think it does anything. That's like user-facing really. I don't I've never actually used it I don't think Those ones get super tiny Jeplin might have narrowed down the hard fault on the s3s. Sweet. You have a screenshot. That's true. We do it's It's tricky though because our screenshot library like It works best if you have an SD card Is it needs a place to write the screenshot too? And if your thing is mounted by default then it won't be it'll be read only to the code So it can't say the screenshot So then you either got to have the boot pie that makes it writable or if you have an SD card That's where it's like easiest if you have like pie portal or a tft breakout that has an SD card on it then The screenshot is like super easy to just save onto the SD card However, I will say then still like it is kind of a pain to actually get to your image because you got to take the SD card out Put it in a reader plug the reader into your computer. There is no like pass-through Kind of thing. Although I think Dan was maybe working on that at one point. I don't know if I'll PR it needs more work to fix the position and stuff if you want to throw if you want to If you will if you would go ahead and push a branch and ping me with a link to it I will happily work on it one of these days I don't know if it'll be today or tomorrow or or when I will get to it But if you push a branch, I will definitely pick that up and try to finish it off at some point Near a dock for the scaling stuff. I do with fun I do is that you load a font has the size you need already. I think that's true Yeah, that's kind of the that's kind of how it works by default in display I always like you load it the font you want at the size you want But I mean it would still be nice to have dynamic scaling There are times where you want like one and a half size, you know one and a half times the size so I don't know. I think it's worth it as an option to have even though it's not Even though you have a better ability To fine-tune your size by actually just using a custom font and creating it at the size you want like you'll have a better ability To fine-tune it and get it looking good But some people want something that's just good enough right if I can make it one and a half times And it looks good enough then some people are cool with that and it will be something they use Let's let this run so we're not gonna have bored neopixel though So we're gonna have to figure out what pin our neopixels are on in order to do that I'm gonna go look at the learn guide for the feather wing If two feather wing has the built-in of of course it has yeah, no anti-aliasing that's true. So it'll be hard cut Johnny Bergdahl, how's it going Johnny Bergdahl over there on YouTube. Thanks for tuning in Glad to hear that you are feeling a bit better from before Let's look at neopixel feather wing feather Guess I don't remember the pin number so it may be configurable to I guess We'll look for sample code actually is probably Just way to find out Actually say sample code. Okay. I don't know I figured this out last time. Oh You get to choose Right, no idea though. What is that on ours? And so someday SD cards might show up nice That'll be the pass-through thing will be really cool if we ever get that that's gonna be super awesome That will make working with an SD card like a million times easier with that because you won't have to like unplug Re-plug. Okay, so it's on We're like upside down and backwards here, but we'll try to work this out. So we're on the fourth pin around the fourth pin from This side on the short side of pins So short side of pins one two three four Looks like pin six No module and they made it for pixel map. Oh, that's fair. I guess It's not in the bundle yet. So circup won't work So I'm just gonna copy it if we could only use MTP Yeah, I personally I kind of like local storage better. I know MTP is nice because it Allows multiple things to access it at once. I guess I'm kind of partial to local storage though Because I remember back when Android was more commonly local storage And I thought it worked a lot better honestly on Android when it does MTP connections I find sometimes the files don't Update right and I also find sometimes like right-click context menus of a couple of actions that I normally Imable to use on a on a local storage or on a regular directory. Don't work on MTP Which is like it's minor stuff, but it's like stuff. I'm used to in my workflow And I've also I've had it like lie to me about the files kind of where like I'll create a file But it won't show up on the other side yet and I get to like not trusting that the files It's showing me are actually current and accurate Which always like as soon as I start seeing that kind of stuff I get I get skittish about The whole format or the whole device or stuff I It is convenient to be able to access from two places at once though access from both sides is really nice but if the trade-off is like More consistency and being able to have all those right-click actions I probably swing towards that flipping the switch back and forth isn't too bad my mind Grab pixel map. There it is Time for flash No corruption perfect that screenshots of the weather station unplug That's true. Yeah, pixel perfect. Yeah, it'll it'll I mean it's essentially just outputting the bitmap that is showing on the display All right, that is working now. We got our single row on I think I don't know Did it I don't remember what all this one does does it run through yeah, it runs through a couple of them here Okay, but then specifically what we're after is these individual pixels, which I thought I had tested individual pixels at one point But we must have somehow Broken them after the fact I guess let's get the reproducer code that Gambler has graciously provided Which is pretty much just individual pixels true basically do all this Offloading all Q-Spy would free up stuff too. It should be nice might eventually see You have twos so big it becomes a necessity Offloading Q-Spy visual pixels Indices must be of type tuple Which is coming from line 124 inside of a knit call is coming from inside of a knit Let's get a look at what it's actually has here. It's interesting. That's not what I was expecting I guess it I guess it makes sense though, right? This is the whole strip fair enough Ranges is actually the one we want to print ranges. That looks better. I think That the problem is that these need to be tuples on the inside here. Hey, are they becoming lists though? Let's kind of step through this Inside of a knit individual pixels it defaults to false So first we're gonna want to find some if statement. Let's check in if it's true It's set right there. I actually don't have an if so it must be somewhere inside expand ranges. Yeah, there we go So it says if not expand pixels So we have expand pixels true. So we're not doing that and a close it which means we're gonna be doing this if If is instance self ranges zero int Then ranges equals Yeah, fair enough. I think this should be a tuple, but I Don't know. Do we need to do it this way? Or do we need to do it some other way into object not iterable? I mean, I guess we could do that that feels kind of weird though, right? Can I do this? Didn't save. Oh, I did control shoot. Let's do as it's control I think yeah, that's true if it ain't broke a little priority right now This these must be a type to pull so we're closer. We are closer. I was thinking that this It's kind of what we want, but Still actually not working. I wonder does it need to be a tuple all the way on the outside too? Yeah, there we go Now it didn't crash. We do need to check if it worked though So what what did we actually do here? So we did zero one two just a zero one two three four five okay, so Let's let's change it up a bit actually let's go five Do we do it backwards? Let's do it backwards so we can tell if it's actually working or not Yeah, because I think we can't I don't think we Necessarily could know for sure if it was working if we don't do these in a different order Let's also do a random one like 30 make sure that saves and runs, okay So then if I go like my map Zero one so so if I do zero it'll give me the pixel whose index is five Say blue let me also do a pixels that fill zero to turn everything off when the Code first runs am I covering that? No, that's pretty good Would that make sense as index five zero one two three four five? Yeah, so it must be this is zero here That's five. We could we could verify that by going Pixels zero. Oh, you know what though? We got green. Oh, I think I said it to green actually Like I said blue, but set it to green. This should be this one. Yeah, if our theory is right Okay, that's good. So our map looks like it's working. Let's check a few more things in it though And so this would be back to index five This would be index four on the strip Pass it up. Okay, so let's run through and do all of them. Let's also add a fill inside of here so that They'll turn off in between sweet I think actually green was easier to see wasn't it Index 30 would be second from the end because index 31 would be the end. It's good there. Oh Let's see here. I heard a sound. I think it's the sound of a plane flying over my head. Oh Yeah, we get some loud planes here from time to time to And def expand ranges. Did pie charm add a dot dot dot or is that actual code? Question. Let me look pie charm added that. This is this is the fold thing actually code folding So whenever you have a block of code like this It will give you these little arrows over here if you click that arrow there It will collapse that bit of code and then the dots represent the collapsed code. If you click on them, it'll Expand you can also expand it by clicking the plus over here And you can do that for any block so we could fold the whole function here as well It will like fold that thing down and technically all the code is still there This just makes it so you don't see it as you scroll past just helpful if you have a really big file and you Scroll up and down in it That appears to be working fine. Is there anything we would want to do differently? I mean these are weird how they have the comma, but that's just how tuples are represented. I think Should we try Should we try the list one does it make any sense to go back to doing it this way? Does that? Change anything really? I don't actually know Collapse miss that better safe than sorry And I still say okay. Yeah, no it doesn't like this way So it does it really wants those to be tuples. Is that the best way to make them into tuples is by doing it like this? I always found it weird how they have ones with a comma after like that But I guess that's what represents a tuple because if you didn't have that comma then it's just a number inside parentheses Which then means we end up with one tuple instead of a tuple of tuples Yeah That's what we need. We should make sure the list works actually as well because the list this was Possible in the old version. I'm pretty sure Let's actually make sure that works Don't actually need parins for a tuple. Yeah, but can you do that with one? What if I don't have a second thing? Yeah, I don't think it can be like that. Can it always have a trailing comma Doesn't I mean pie charm at least doesn't seem like it wants to let me That's the space and it doesn't I don't know how I mean how would it know right? It's gonna think this is the first thing in the list and then this is the next thing in the list well, I guess the What do they call that expansion or I don't know what they call that where the for loop is inside of it there It's correct Yeah, I mean it makes sense to me I get it, but it doesn't seem to work. Well, it works like that I guess okay, it works like that, but not when it's in the This like iterator expander do Hickey thing here That is interesting actually I didn't know this syntax was valid be honest that I did not realize I've always I have always seen it more like that. That's interesting and make the function of it Makes it the function call the function call to come has different meanings. So you need the parentheses Well, I mean this one's not a function call though. It's a It's like the value before the four for this expander thing. I mean tuple. I guess it's a function call here, but tuple in the tuple function. We're passing just a list and Then inside the list. That's where we have the this iterating expanding thing Comprehension list comprehension they call that I think in Python. Oh, I see I see. Yeah. Yeah, I gotcha I'm with you there. Okay, so yeah in the second in your second example You'd pass one parameter. That's a tuple in the first example. You're passing two parameters that are both ends I see It's an inconsistency in Python syntax. I gotcha for the for loop there Rehinder thing comprehension rather Let's make sure list works here Doesn't oh, but that is weird because we get the same thing here. Do we isn't that the same thing? Or is that maybe that's from last time. Okay. Yeah, I guess that's from last time Actually didn't make it to the same place 112 113 Okay, let me let me double-check. Let's make sure we do want to be able to support this before we change it So the way we're gonna check that is by making the old version of this Which we're gonna do by Are we gonna do it? We're gonna do it by doing They're gonna do it by doing this pretty much one I mean, I guess we want almost the exact same thing is all this suppose Okay, it's not actually possible in the current one Let's like do some double-checking on that though. It's not really the one we wanted Had enough head scratching over errors while I copy pasted something from inside a list I didn't remove the comma and I wondered why it's a tuple They're like a comma B equals a comma B function Right this one doesn't just hard code them. They come from these. What kinds of things are they? Oh? Grid map. Okay. Sorry. This is actually what we want That does not make any sense. Why are we getting closure? Of course, it's not just a thing. What is a closure? How do I find out what kind of value it is from PHP still have a hard time not calling them arrays tuple dict Stuff switch List yeah, I don't know. I call my race sometimes list Mr.. Ray, I kind of use them interchangeably list an array that is like what do you call a multi-dimensional array? Yeah Two-dimensional array two-dimensional list. Oh, I cut this out of here. Actually, hmm You go back to main mapper Takes two parameters. So it's like returning a function instead of a It's not actually like making a list or a tuple. It's returning a function. I don't know how do we find out what type it is It's not I mean, I guess it's the type function I suppose but Oh, does that get used? Okay. Yeah, no, I thought there was there is code here. That's supposed to make list work Wonder why that doesn't work. It's also interesting. What is length of a closure closure has no length How does that work? Are we going into here? I don't think we're getting into here. I don't know why I just changed this here. That was silly I wonder why it doesn't work is usually followed by a series of prints. Definitely true Definitely true. I feel like this should be making list work, but It is actually not working and then the other thing that's weird about this is I feel like these two together should be making it So that closure doesn't work, but maybe I don't understand how closures are Honestly, I didn't even know Python had a concept of closure. I thought that was a JavaScript thing I've never heard that in the context of Python before 109.110 This is the wrong one looking in the wrong thing My version that's on here might not be real Yeah, I think I was using a version that wasn't real. I think I was using my like partially edited one from last time Which means we haven't really been testing What we thought we were testing Closure is a local namespace of a function. It's kept in memory after the function returns Because it returns something that refers to something that was in that scope You usually find it when you define a function inside another function and return it that in fact was the exact case that we That we found it in here. Okay, this succeeds. Yeah, okay, so Lists are legal under the old version of pixel map So we do want to be making it so that lists are legal under the new version as well No, that's right. It does not work under the new one, but does work under the old one Line 113 Let me get to here So we did find the list, but then it still failed when it went inside of here into object is not iteratable How's it going Axel Magnuson? Excuse me. I think that's not even the first time I've done that. I apologize for getting that wrong every time Axel Magnus And then Axel Magnuson I always try to contract the Your last couple of names together there. Anyway, though. Happy Friday. How's it going? Thanks for tuning in. Hope you're having a good day So we I mean, this is weird how we're stacked tuple here truthfully, but let's try to walk through You know boy and stacked the comprehension as well. This is getting crazy in here Into object not iteratable. So I think this is a problem with The fact that this is list that that this outer thing is a list and that the inner things are not lists I bet you This actually works if you do it this way But that's not we don't want to make them do that. We don't want to make people do that We should support this as well Does it work we'll go I'll set a breakpoint in the debugger step through it and I'll go add an echo out here Yeah for PHP to print. Yeah, it could assumes a list of tuples When it finds a list. Well, it assumes a list of iteratables is the thing Yeah, it's a it's assuming the things inside are also iteratable. So we're going Yeah, basically we need one more. We need one more logic in here for we need to we need to We need to check if the inner one is An int or not. All right, if it's not an int then do this Else if it is an int and this is the first one in the list So we are assuming that all of the ones in the list are the same Or I just heard a cat jump back down from a counter back there You have your in in your you have or in your if instead of and I think and is what I want either I mean, I I grant it could be done that way. I could rearrange some more of the logic and it could work, but I don't Think that's how I want it. I think in my head. It makes more sense this way But but we'll see too. Maybe I do this and it doesn't work and then starts making more sense the other way We want to go here if if so that the first one is an int then what we're gonna be doing is just Honestly, just calling tuple on ranges, right that back on so we can make sure it's actually working. Oh, I didn't save it Like so we can find out that it's actually working anybody. No, okay There we go. Oh, oh it re-ran. Okay. I see. Yeah, looks good. Okay. I think that's the fix we want here We don't need the prints anymore You the prints anymore and more prints grab this I Go to pixel map But it's here like that. That's wrong. I was wrong this There we go. Let's see here then if on line 111 should have and yeah, I could the lines are probably different now But yeah, I could have changed the and to down on the other one as possible Rearrange some of it. I think this covers all of our cases too though. I'll retest all the different cases as well after this And after or it doesn't make sense otherwise. I'm sure I think this covers all our cases though I think this covers all our cases. I'm gonna save that for now What I'll do is I'll make the test script actually try a few more things. So let's go Let's do a couple of these. Let's do this here. First of all, we could do the old version as well In fact, oh, this was ranges. We don't actually need that. We should make this a function All right, so theoretically this should just do the same thing twice visually We don't have let's put a fill between though Actually, I have fill in the beginning of here So that should work and then we can just add all of the different cases here, which will be good for testing anyway These are all individual pixel tests. Try a non-list a little error. I Will try so this will be a tuple and then we'll try something even further away from a list afterwards Although it's worth noting. I'm pretty sure tuple and list are the only well tuple list and then I guess the closure if you do it The right way Are the only supported ones the only like a valid ones? I guess so like a string or something should It fail in some way. I assume because it'll try to turn them into ints We want to rewrite the map every time I think that's fine. Yeah, like this will override the old one there That's okay, though Again, this should ideally this is just gonna do the same thing four times, but it's really testing the different ways Do the with ranges test? I think this is actually defaulted to false or a call, right? I'm just gonna do three on this or no, I guess I'll try to do all four This one will look different. This will do Full rows at a time. I believe but it should do hopefully Just towards the end though. So we got to watch our other four first Nice Okay, it's working good. Is a different color for each test we could Well, we could but we'd have to change this I guess Blues actually a little hard to see so I guess I'm gonna use maybe yellow also on the camera that is To the naked eye. It's not really that hard to see but the scale thing in that branch along with the test file in the examples Thank you. I appreciate that. I should pronounce like moons on It's on actual Magnus moons on. Thank you. I appreciate the Knowledge and I apologize again for having it wrong this whole time I think because I don't think I ever did pronounce it that way before moons on Old style seems slower That is that should be true. Yeah, that should be true the new one is more efficient and should be faster at some stuff Yeah, we're not doing like full-on You know printing the times or whatever so we don't know the exact Exact timings, but that is true. The new style should be just just a tad faster I mean, it's a fair amount faster. It just depends how much you use it How big your grid is that sort of stuff? I think so ours is still fairly small and we're not doing that much with it So we did speed up some I would imagine we did some measurements on that I did like a maybe two weeks ago a lot's changed since then though, truthfully. I Don't know that those measurements are necessarily like As relevant anymore because we've changed around the libraries and stuff a bit more since then I have no idea what will happen And then after all the maintenance maintainer of the Swedish translation of circle Python trophy Definitely get a trophy for that in my book Do not know where can I get it you can get all of the translations on circle python org Easiest way probably is is the easiest way the oh The drop-downs. Yeah, they do have drop-downs actually so you can just choose the drop-down So if you want to use the latest stable, which is 733 which is actually fairly out of date at this point Truthfully my recommendation probably just go ahead and jump to 8. I imagine we'll be making that stable pretty soon But you can choose your Language here so you can do speedish. Yeah, and thank you definitely hug report to Johnny for B&R Swedish language Sort of aficionado basically I think I don't know if Johnny is the only one that submits Swedish But I know Johnny is a big part at the very least perhaps even the only one submitting Swedish translation So definitely thanks for that. So we did crash when we tried to use the string and it was line 73 which was the new style one and it says pixel map Has no attribute ranges which is not necessarily how I expected it to fail truthfully I guess the thing is though that none of these were true. Therefore, we never set ranges Therefore when we went to here, we didn't have ranges. So I suppose that does make sense Let's see how it fails with the old one. Basically our goal is to make it fail mostly the same way You are the only one Also the fastest translator. Yes, we just I think was I believe it was our first full one. Is that right? You'd know the history better than me, but Definitely always I'm seeing your PRs go by to update stuff. So you're definitely Definitely on top of it Lots of examples in there too. Very nice near duck. We're looking at using that for sure Need more than one value is to unpack. So we Doesn't fail the exact same way but it does still fail You know, honestly, I think what would even be best is This I think is actually best Although now we're back to still testing the old one. Let's just a new one See our new exception here. I feel like the correct way to write this code is to try The nested iteration first catch the type error try the other one etc without explicitly assuming it's any particular type. I mean, I'm Open to that. I would say like maybe leave a review or make a PR to change it I think this is the way I read it the first time because it's the way that it makes sense in my head I'm Not like dead set on doing it this way But this is the way that it makes sense in my head and the way it did the first time I wrote it out I'm definitely open to critique open to reviews open to suggestions Not sure I understand exactly what you mean But if you do like a if you do it as a review a suggested change or whatever Then it will be nice and clear. I think probably make a lot more sense in my head Yeah, I'm definitely open to open to whatever. This is just kind of the way that it The way that it crystallized into my mind when I was writing it And then we do get the type error this time and we would get the same thing if we did like just a number by itself or Function or an object or a dictionary or Anything that's not a list or a tuple basically where those rows are much brighter. Oh interesting Did not actually fail that time. Well, I mean it failed obviously, but it didn't fail the same way It was a bit odd, isn't it? 111 into isn't subscriptable. I see So maybe we do type check first and then maybe we should be type checking first at the very least for the valid types and Then worrying about what to do in each case Because we should throw out an int before we Even try to do anything else on it, truthfully It's not either of those then we just raise right here. I think you don't need that Only accept lists and tuples. So if I run it like that, we should now get our actual exception Like the okay, let me see this way. You could use it with say by to raise or any other iterables that she didn't anticipate By the nested iteration first catch the type error by the other one How would it work with a bite array though? What would it do? I guess Or what does the old one do? Should have maybe been doing old style first. I suppose it doesn't matter too much. How do you make a bite array? spider a function List after our first list here. See what we do when we get to there It's object not iterable 74 Yeah, I mean it doesn't work the current version the the old version the version in LED animation doesn't work with a bite array I'm not opposed to making it work with a bite array, but I think like I'm not necessarily trying to do that on the first pass I'm really just trying to match This one on the first pass and then adding functionality as far as different types being more gracefully handling different types I'd be happy to do but I think like it's a follow-up. I want to just hit this one first and then Worry about the stuff that's different. All right, so now this will make sure that the int What we got there will give us the our new exception Is an exception handling slow and CP compared to what yeah, I guess question to an if statement Another language is there's a lot of processing like collecting the stack trace. I Wouldn't know to be honest I know we don't have as much going on for the stack trace Truthfully because you can't have like the trace back module To get it after the fact, but I have no idea about speed in terms of which one would be faster what I do know Like I mean, I would say I I think my understanding is that it's more, you know, quote-unquote pythonic to do the try accept right to Try the thing and catch the error rather than like checking the type first and then not doing the thing if it's the wrong type I do think that's more pythonic so to speak Sort of best practices ways, but I Don't necessarily know anything about the speed one way or another Okay, that is now giving us correctly what we want And then this I mean it should be for any Should be for any wrong type of objects Doesn't matter anymore what it is Anything that's not a list or a tuple now will return this but like said I am open to in the future Supporting other types whether it's byte arrays or you know another one that would probably be pretty cool is Micro lab arrays like indie array or whatever it is from you lab From NumPy essentially That might be a cool one as well. I'm gonna take byte arrays and put it down here I'll keep it in this file. I'm just gonna put it right below the other invalid ones since it's technically invalid right now Get rid of some of this stuff. We don't really need a lot of this Not end up using this I guess we could get rid of that that stuff. I guess I'm typing the big Python Now has to abstract the base classes and let you check whether it's iterable without explicitly checking if it's a list I don't think that exists in pieces in size or a Python. Oh interesting Check if it's an iterable type without actually knowing for sure. It's a list. That's pretty cool. It'd be a be a nice thing It would be a nice thing to have for sure though I've got to go now. Thanks Tim by all. Yep. Thanks for hanging out Dave. I appreciate you. Hope you have a good night and all that Let me Fix this because obviously we don't want that just hanging out here. Do we? Thanks YouTube. Oh, we're getting better. We hide the names now. Okay. Well, yeah, actually unironically. Thanks YouTube We're moving in the right direction. Okay That was one of our issues and I think we got that knocked out we now match the old version in terms of Accepting a list We also did check with ranges instead of individual pixels. Make sure we didn't break anything there Does not appear as though we did So I think we can PR to do this one other question though is do we want to? Just make one PR to cover both of these things and I think we might as well I don't think we need to make two PR. So we Well, so I guess one thing is we want to take we want to take this version and this needs to go to the repo So far the only difference is in the constructor Correctly handling the Lists in the type, but then the other change will do is actually on the get slice I think we just do this Theoretically that should work now Although I had to undo and redo apparently Now the thing is though. I'm in the repo. I actually want to be over in my device. Whoops. I'm out on this channel Yeah, I don't have I don't think I have the ability to add mods or anything I'll say it's it's dwindled a bit like we we got that stuff, you know knock on wood I don't want to jinx it, but we got that kind of stuff a little bit more frequently in the past So I'm glad that it's dwindled a bit and I will say I am legitimately glad like props to YouTube legitimately For making it so that the name actually disappears because like it used to just Keep showing the person's name, which like they put bad stuff in their name too. So Hiding their message and continuing to show their name was pretty useless in my opinion. So props to them for actually making it better I've been frustrated in the past by YouTube's moderation. So this time they did actually improve it Thank you for that to them. We'll never see this. I'm sure but In the bottom of my heart, I do appreciate it. They are moving in the right direction. Hopefully we'll keep getting even better In order to test this I am going to Print new style map. So when we end here, the last one will be the one that is on I Think what I want to do is go actually f string So we don't really care so much about testing the getting on the old versions Oh, this is not a slice though. We need to be slicing actually. Hmm. How do you get the full slice? Is it just zero colon? It's actually gets easier. We're just gonna do zero colon Slice the whole thing there and we'll see every pixel. Yeah, we don't care so much about the old style Do we I mean, I guess we might as well should we have the speed of this statement worry about it's the speed of this instance Yeah, that's true I mean if it's in the it's still overall it's gonna make the whole thing slower if it is slow it down that way but See what we get here. Oh dear. Cool. Yeah, so we got the same things Every time which is good. That means the new version is working the same as the old version Exactly what we want and the new version is now using This use get Use get so I just modified this in the library, which is not at all what I want Let's just undo all of that back to here Okay, um, I think we're good now on both of those and we just want to run pre-commit and then Push it make a PR out of it You printed the same thing over and over again because you forgot to change from new to old in the slice thing Print slice thing. Oh Yeah, thank you. You are right. I appreciate the heads up on that Yeah, I totally was not actually testing what I thought I was testing, huh? Oh, we do have actually a slight difference Which is that one's a tuple and one's a list Do we care about that? I don't know that we do I will say that's also coming from the core now So it's a bit harder for us to really manipulate that and so these all go new new version old version new version old version So the new version is returning the tuple and the old version actually was returning the List I Believe that's okay though and honestly if it needs to change it would have to change inside the core But a lot of stuff Used to support both tuples and lists and now in the core it only supports tuples In the Python layer I have added a bunch of stuff to make it support lists also But the actual core class itself the new thing that was added pretty much as tuples only So it does actually kind of make sense that the new version would be returning a tuple and not a list here The old version had a lot more stuff with lists going on Eggman character You don't need the zero you can do the You can do a slice all with no zero so what the is it any different? It's not any different interesting I did not know Thank you. See Grover and Nair dock both Always down to learn some new syntax. Yeah, I had no idea that you could do that one without a number on either side I knew you could do a number on either the left or the right or both and those all have different meanings I never knew you could do it without one though It's pretty interesting. Oh, I'm on main. I should be making a branch here. I have no idea I don't even know what's going on with this Only guy only we're in need to add a remote. Oh You're fruit slice is useful for making a copy For assigning the whole list without replacing it making a copy. Oh, I see So if you made a second variable and you use that full slice, you'd then have two Okay, you have two lists that you can then modify independently Whereas if you just go like list two equals list one, then it's like reference or whatever. They'll both point to the same one I guess Interesting so it's like a it's like a clone kind of thing going on there. That's Interesting new branch So what do we did the individual pixels and then we did the Get slicing would be kind of a long branch name truthfully. Maybe Maybe we'll say Issue one and two. Maybe we'll say issue one and two from a different main Pre-commit run all files Got a fail. Oh, that isn't not what I wanted back consider using a generator a Generator, I don't know what it wants me to do here. I had one like this before actually with pilot as well I think if anybody knows like what syntax it's hoping that I'll use by chance I'm definitely open to a point in the right direction because I'm not really sure Why like what pilot wants me to change to do here? Generator Consider using a generator instead of Goopal and then a list comprehension Actually left out a layer there. We actually have a list inside there Is it mad because I put the list there? Oh, I didn't save hold on hold on hold on didn't save Okay, it does make it happy. Does it actually work though? I think we left it on repel right? Yeah Well, I'll look at the code and make sure the Heart we changed is actually getting used Yeah, it does look slower though. I will give you that yeah, it does. I mean it feels it's a very slight but just a You know a half a beat or whatever. It just feels just a tad slower on the specifically those last two the The rose. What was that code we actually changed though? All right, this is in expand ranges and it's It is whenever the first thing so it's individual pixels is True and the first item in the ranges is an int. So yeah, I think we did actually do that. Yeah, I think I Definitely should have been Oh that we executed let's just double check though Just make sure we see that get printed Yeah, it actually gets on all of the first several Consider this a equal. Oh Too slow scroll up a bit equals one two three B equals a oh Interesting, I didn't know you could use it on the left side of the assignment as well actually so a Slice equals four five six It'll print four five six Okay. Yeah. Yeah, so they're linked together. I guess in the okay interesting Find a picture of Mega Man character. It'd be fair. I didn't know his name I burger I Never I didn't get I didn't play much Mega Man. I never had a Sega when I was a kid I had a Super Nintendo and then I eventually got it in 64 And then like it's kind of I think I had a Wii as well But I kind of fallen out of video game consoles by that time But yeah, I didn't I didn't get the Sega line So I never had Sega Genesis therefore I didn't play a lot of Mega Man I think maybe there was Mega Man for Super Nintendo maybe but I don't think I had it Telly as it turns out It is the perfect mascot for the empty slice though. I will give you that he's like he's perfect for that The glyph square brackets colon reminds me of an item from the game Thexedur You turn it on its side. Yeah, that's very similar Thexedur I'm not familiar with that one. I'm curious though. See if we can find the Here that's looking like that Wait, this does I will say this does look a lot like Mega Man a bit doesn't it seems very thematically similar for sure I've passed by one of them Like there's so there's lots of different kinds of things you shoot in this game. It looks like These ones are kind of similar. I think there's been a couple of I'm guessing these are different versions And I had never heard of this game Thexedur was this on I mean the graphics look very basic was this like an Atari game or what was this what was this originally played on You know signed slices convenient for inserting additional items in the middle of the list too because it doesn't have to be the full slice It'll just replace the part with new values. Oh interesting so you can replace like Indexes like two three four out of the middle of the list without well, that's kind of cool. I didn't know that either But there so we should be passing great Run we should be passing. Okay. Let's make sure we've got a thing extra in our commit. So I'll commit this. I'll make a PR I will talk about what I'm gonna work on tomorrow. I think and then I'll probably wrap it up for the night So if anybody has questions comments anything you like to say you're asked now is the time to do so I'll wrap it up here in just a few minutes First though, I'll make sure this looks good to push which I think it does PC. You say G Excuse me PC PC J. R and Tandy. Okay, there's our get item stuff and our Made pilot happier Although it is interesting that we did change from list to tuple here. I did not I Don't remember making that change specifically, but I guess we did yes we did And then the stuff that fixed our I don't know though this this one feels wrong to me. I don't Did we change this today? Yep, I'll be around tomorrow morning 10 a.m. Central time. I'll be back streaming tomorrow And I'll talk here in just a minute about what I'm gonna do tomorrow Can't shake the feeling I mean it is 139 which is the line we changed so and we did test it Let's just make sure the version on our device Has that Yeah, I had the extra print, but it does tuple. Okay interesting. I totally Don't recall changing that from List to tuple there, but I mean I'm we must have cuz We got the new one so so it's good. We tested it out as well. So should be working good use core class get So this is a slicing Getter fix individual pixels mode Those are pushing Make PR from it operation Operation oh wow ouch. I just had a really weird like hiccup thing going on there Like inhaled at the same time did not feel so good Anybody else as well if anybody has a device that has a grid of neopixels or just multiple neopixels in general And is interested in helping us out by testing this Always happy to have stuff tested in PRs if you're not a member of the review team yet You can still test it out just leave a comment on this page to let us know that you tried it Let us know what device you did it on if it worked if it didn't work if you had questions if you had trouble Whatever right just if you want to give it a try let us know in the comments there Definitely appreciate it anybody who wants to do that for us Yeah, we got this in so I'm not gonna wait around to see if it passes the actions tonight What I will do though is set the stage a bit for tomorrow's stream So tomorrow morning 10 a.m. Central time. I'll be back on my own channels streaming for the You know sort of Saturday morning coffee stream. I don't know. I don't have a I don't have a catchy name or anything unfortunately But you know, we'll play with some more circuit Python stuff I'll be back tinkering around with stuff. Happy to have folks come and hang out Drink some coffee with us Specifically, I think what I'm gonna get into tomorrow is related to the other one of the two Core PRs that I've been working on lately. So One core PR was pixel map the stuff we just looked at throughout this stream another PR in the core that I've been working on lately much older, I guess, huh? Let's play a show API This is the other Kind of main effort that I have been working on lately This one is also another change inside the core. This is changing the display IO API This is also now merged into the core as you can see here What we have left to work on on this effort, which somebody a few weeks ago reminded me of I don't know if that was see Grover or who that was thank you whoever it was though Yeah, I apologize if I'm wrong, but Somebody reminded me a few weeks back. We maybe Dexter. I want to say actually it was Dexter We have not touched or thought about at all Blink a display. Oh So I think tomorrow what I'm gonna work on is implementing the new API for display IO, which is the Display dot root group equals property instead of the old method, which is the display dot show Function We're gonna be working on that inside blink a display. Oh, because now that it's merged in the core We want to update blink a display. Oh as quick as we can at least to try to make it match the core API So I think that's what I got going on tomorrow if anybody's interested in that kind of stuff Linux level blink a display. Oh, you know using circuit Python display. Oh code on Raspberry Pis and Linux computers, that's what I'll be playing with in the morning tomorrow Thank you to everybody for watching Appreciate everybody who's here watching appreciate everybody Who's in the chat hanging out saying hi helping out with stuff asking questions all that kind of stuff also appreciate everybody Who's just here lurking that's totally cool as well Watching along appreciate everybody all the same So thank you all for watching. I hope everyone does have a good night and a good weekend and all that stuff I will catch those of you who want to follow along tomorrow with me on the morning stream Otherwise, I will say farewell and I will see you next