 All right. Happy Friday to everyone. Let's see. I'm going to get a few things straightened out here, and then we'll get this dive on the road in the ocean. Get this dive in the ocean. Let's go with that. Looks like we got sound, so I just need to get some of this stuff out of the way, and the chat's going here. Happy Friday, PaulSK. How's it going? Nice to see you, and see Grover as well. Okay. So introduction for anybody that might be new. My name is Tim. This is the deep dive program on this program, this live stream, weekly live stream that occurs at this time. We are working on various different things related to Circuit Python. If you are brand new and you don't know what that is, circuitpython.org is a good place to learn more. The high level view of it, the 50,000 foot view, if you will, is that we have Python code that runs on these tiny computers. In this case, the computer is inside this main ship here. There's a whole tiny computer inside this thing, and we are writing Python code that executes on this computer, and it can interact with other things by virtue of all these different pins. So there's all different shapes and sizes of these devices. You can see I have two different ones here, Raspberry Pi, Pico W, and in this case a Feather ESP32 S2 with a TFT screen on it. So these ones are fairly similar in size and shape, but there are lots and lots and lots of different form factors of these things. The thing that ties them all together into this program, though, is that they all run Circuit Python, all the ones that I will be working with. So we're writing our Python code to run on these things. Again, if you're interested to learn more, circuitpython.org, that's a good place to start. Also, join us over in the Discord. We have a Circuit Python dev channel if you're interested in actually getting involved in the development. It's an open source project, so all the development and coordination occurs out in the open on GitHub and Discord. Or if you have a Circuit Python device and you're having trouble or you want to know how to do something that you don't know, there's also a help with Circuit Python channel over on that Discord where you can get help or any kind of information you need for whatever you're trying to do, be it a Circuit Python project or help contributing or with infrastructure or just help hooking up your project or whatever. So head over there. If you are interested in being involved in the community, Adafruit, this is their website, Adafruit.com. Adafruit is a hardware and software company based out of New York. They are the company that is primarily funding the Circuit Python project. It is an open source project, so anyone is allowed to use Circuit Python, anyone is allowed to make a device and port Circuit Python to run on that device, free of charge. But Adafruit is the company that is actually paying the folks who work on the Circuit Python project. There's a team of folks who work on the project full time. There's other folks like me who work on the project part-time. Adafruit is the one paying us to work on it. So if you just like the project, you're not interested in maybe developing or anything like that, but you just like the project and you want to get yourself some neat toys, if you purchase hardware from Adafruit.com, that is indirectly helping Circuit Python because of course they're, you know, if you're paying them for products and they're paying us and the folks who work on the software, then that's what makes this whole thing go round. So thank you to everyone who wants to purchase hardware from them. They of course sell the micro controllers such as the ones that I had back here. They sell both of these devices. This one in fact is an Adafruit manufactured device as well. Whereas this one is third party, that's a Raspberry Pi. Although they do sell them Raspberry Pi Pico. So yeah, thank you to Adafruit. Thank you to everyone who purchases hardware from them. And so jumping into it for the night, let me also catch up here. Hello from Sweden. One hour to Christmas. Oh wow, Merry Christmas, I should say, then Axl. That's awesome. How's it going, Blaze and Biata over there in the YouTube chat? So diving into today's topic, what I want to look into is kind of hot off the presses, so to speak. This is relatively new stuff that changes the way that we will store essentially like secret variables, environment variables, things like tokens, passwords, you know, things like that that are secure that you don't necessarily want to have in your code. So, you know, those of you that work on CPython might be aware of the idea of an environment file where you can put your, you know, environment variables, your tokens, and your login information, your authentication details, and things like that. In CircuitPython, we have recently changed the way that this works from, well, it's actually, you know, a flurry of activity has occurred. Like originally we used a file called secret stop pi. There would be a dictionary inside of there you would put your, you know, for instance, Wi-Fi username and password or your API tokens for whatever services you want, put those in your secrets pi file, and then you import that dictionary and you access those variables off of that secrets object. This was kind of the way that it was done for a very long time. More recently, we got a .env file, .env, and we got the ability to read .env files. They have a particular format. I don't know the format, like the syntax off the top of my head, but if you search .env, this is actually a larger project, right? This was not specific to CircuitPython. We just, you know, we got an implementation of this .env. So we were able to read from that file. This kind of started to replace the idea of secrets.py. But even more recently, we decided to switch it up to actually Toml for a few reasons about differences in the syntax, being able to use certain types of strings and how certain stuff interacts with creating the file. It's actually, I guess, a bit difficult to create a .env file in some environments because some OSs don't want you to just create a file that starts with a .. So they make it a little bit more difficult than it should be to do that. And so a switch was warranted. It was discussed during the weekly meeting a couple of weeks back. Toml was the choice. The new implementation is in for settings.Toml. And importantly, there has been a new release. So we can download this and try it out. So this is actually the first time for me accessing settings.Toml. So my aim is to kind of just see, try it out, make sure everything is working how I understand it, get it running on one of my devices. In particular, another thing I want to also try it with is on the Pico. I think maybe there is Web workflow on the Pico now. Pico W, I should say. So that should go along with this. If that is indeed implemented now on the Pico, then I'll give that a try. And then after that, the next thing I want to get into is actually like the GIST API. So GIST is a text storage thing owned by GitHub or hosted by GitHub or whatever. And I would like to try out posting data into GIST from CircuitPython, maybe using that as like IoT logging with the logging library and stuff like that. So we'll get into that later on. But first things first, let's look into the new settings.Toml. And so the way this works is we need to have a, well, first of all, we need to have basically brand new CircuitPython. So I am going to head back to circuitpython.org. I'm going to go to downloads right here. My device is a Raspberry Pi Pico W. Probably Pico W will come up, right? So Beta 6, I believe is where this got added. I could be wrong about that. I'm not 100% certain, but it's certainly very new. And Beta 6 is the newest one. So that's what I'm going to download. You can't have comments in JSONs. In Toml, you can. Good question. I do not know. Yeah, you cannot in JSON. That part I do know. No comments in JSON. Although worth noting, our secret pie, it was Python. So you could have comments inside of there. Although JSON was proposed, I think I proposed using JSON at some point. And that is definitely one of the biggest downsides of it, is no comments. Which I do agree with. And that is a bummer. Toml? I don't know, actually, though. Toml, can we have comments? Well, let's check here. Does it say on the page? So this one, yeah, comment. Looks like it does. Yeah. Nice. And then I don't know about .env, either. Although I probably won't look too much into .env since it turns out that we changed it up to Toml, anyway. So I'm actually not super familiar with the Toml syntax. It looks like it's basically just key values on new lines and then subtable that's down here. Although I don't know, I think, yeah, only root table can be retrieved. So essentially, I mean, it's almost like .inf or whatever, like old configuration files, where it's key value. It's like you can do spaces. Tim is above. Oh, okay. Just, yeah, okay. Supports utf in various ways. New lines, escape codes. Okay. .env. But to start with, we're gonna just put that on the device. I'm gonna do the pico w first. Actually, it's a bit tricky because does the double tap reset? Well, there is no reset, right? Double tap reset I think would work, but I don't actually have a cowbell or anything on it. So there is no reset button. So what I'm gonna do is actually, I think you can hold boot while you plug it in. Is that right? Who knows? It's plugged in. Yeah, I think so. Oh, ouch. And I guess let go. Yeah, there we go. That is pasting right now. Zoomably. There we go. I'm gonna scooch the camera just a bit here. Angle it back this way. Is the focus still live? Yeah, okay. I think we should be on to the newest version. Let's not open secrets for one thing. Check boot out. Okay, there we go. Eight beta six. So I will make a settings.toml. Settings.toml. We'll put some key values into here. I'll just put some kind of bogus ones to try it out. Let me fix my chat here. We'll say maybe hello message equals deep divers. Then I think it was just new line, right? Yeah, it looks like new line. Another one. So then let's say number value equals, can you have hex in here? I don't actually know. Maybe we should do an actual number though. It's color value green. It's kind of the best majority of what I would be interested in is strings, numbers. Colors would be a nice touch if it works. That's all I really am interested in having myself. So then what is inside code right now? This is like trivia. Web server trivia, I think. I'm going to get rid of it. And now to read our toml file, we can go, I believe, import os and then os.getenv. And then do we need to give it a key? I guess it looks like we probably need to give it a key. Let's see if it prints anything if we don't. I'm curious if we get the full dictionary. No, okay, required argument. So let's go. What did we put in there? Hello message. Hashtag comments. So same as Python, which is nice. Okay, there we go. So we got hella deep divers out of there. Let's check our other two. Number value, color value. I think you can do octal. Oh, interesting. Octal. Looks like both of those worked. I don't know the color hex is off the top of my head. So let's also go hex. Is that right? That's not right, is it? Oh, it is. Okay, yeah. Yeah, so it didn't put the leading zeros. Cut off the leading zeros, but we did get our green there. Okay, cool. Octal? I don't know. Is it octal value? How do you do that one? Is it O? It's like, like to type in that string. This is probably just out of date stubs or something. Oh, one, one is nine, not 11. Only integers supported by string two, O L, CRTOL, O zero, no OB, no O underscores. Let's say that on the page. Got this. I don't know if that's right. Is there a, I don't know, is there, does that actually work? It seems to work. I didn't know this existed. I don't think I've ever used an octal number that I can think of. What a hex, a lot of binary, a lot of base 64, a lot of base 10. That is pretty darn straightforward. Next thing I wanted to look at was the web workflow, web workflow. So for that to work, we need these things. We also need these things. I'm going to put these as blank and then I'll fill them in and we won't be able to look at this file on the stream anymore, but I'll show you at least what it's looking like before those are filled in. Or default 80, that's probably fine. Yeah, we'll do that password. I'm going to try to follow, I'm going to try to follow when you are using your HDD and when you're changing files on the device. We talked about this before, where to develop your code and the reasons for not doing it on the device is very hard to follow all your clicks, which I'm pointing out when you're on your HDD and when you transfer it to the device and when you develop on the device. Yeah, I'll try to, I will try to point that out right now. So I am actually, I am editing code directly on the device right now. I'm editing it inside of PyCharm. And PyCharm is also showing me all of this code up here, which happens to be on my hard drive, but right now we're not looking at any of that stuff or just say we're not doing anything with any of it right now. And then CircuitPy we have right here, which is the CircuitPy drive of right now, the pico w, just plugged in there. And in this case, Code.py, which I edited here, that is on the device and settings.toml as well, that is on the device just in the root of Code.py. And I will try to call out when I switch back and forth to stuff on the PC. So I will save that, it will be on, it will be on the CircuitPy drive, but then unfortunately, I got to pull this over to here for a moment so I can fill in some of these details and then we'll close this one and I won't have settings.toml open anymore, since it will have my stuff in it. Actually, I think I have some of the same stuff in here. But yeah, I do, I do switch back and forth a fair amount, especially if I'm working on a library, like working on a PR test or anything like that, then I am constantly bouncing back and forth for sure. Web API password. Actually, I'm going to add another one while I'm here, which is going to be a GitHub API token. I have no idea if it's going to work or not. Oh, actually, yeah, I'm not because I don't see it in there. Maybe I can plug this one in and plug in my feather, look inside of secrets on there, which I also can't show, so there's nothing else to see. But if I can find it, we are going to put a GitHub API token into settings.toml as well to use once we get started with gist or so I don't know if this token is live or not. So we'll find out. Get a new one if not. That's there, save that, close everything, close this, close this, close this. That one's fine. Yeah, that one's fine. We're back. Octo was very useful for working with a front panel manually operated boot loader switch array on many computers like the DEC PDP series. Do you think a Python environment like this would be convenient for working with a separate multiple microcontrollers aside a main board slash chip? Let me see. I'm not sure if I understand the question. Do you think a Python environment like this would be convenient for working with a separate, i.e. multiple, assume that's what you mean they're kind of like so separate slash multiple microcontrollers aside from the main board and chip. So if I understand the question, it's essentially like if you had multiple microcontrollers that work together inside one project or something like that. Do I think this would be a convenient environment, the Python environment? If you mean like my editor, the PyCharm editor, I am certainly biased. I will be totally upfront about the fact that I'm definitely very biased. But I think PyCharm is a good editor for anything that involves Python. So yeah, if you have multiple microcontrollers and you're writing Python code for those microcontrollers, if you have, let's say two or three of them connected at once, PyCharm is fine for that. Just a moment ago, you all were not able to see it. You can actually see the remnants of it right here. I actually had two devices connected. And the second one just shows up as CircuitPy1. You can also rename these so they show up as whatever name you want to keep your stuff organized. And you can open files on each one, edit some code, save it, it saves to the right one. You don't have to worry about what's where and all that stuff. It keeps track of it for you. So personally, if that's what you mean, like this editor, do I think it would be good for editing on multiple devices at once? I do. But like I said, I am definitely biased. I use it daily. I use it for my day job. I use it for CircuitPy1. I use it for fun projects. I use PyCharm and similar IDEs for a lot of stuff. And I have for quite a while. So I've also just grown accustomed to it in a lot of ways. So we should be, I think, automatically connecting to the network now and theoretically having the web workflow, I think. However, I don't know... How do we know the IP? That's tricky. We don't have a way to know the IP, do we? So CircuitPy1.local is supposed to work, I think. Is that right? Let's look for the web workflow. I could be wrong, too. Maybe it's still not working on this device. I think we have a better chance if I can find the IP. Maybe we should use this. I will say I haven't used specifically code.circupython.org before. I've only done it with the one that's built-in. Wi-Fi.radio. Thank you. Another reason, if you're interested in more reasons why I think PyCharm is helpful, a good IDE for this is the terminal. You can have multiple tabs here. So you could have different serial connections to different devices. Right now, I just have the one connection to my one device, but you could have as many devices as you have. You could have different tabs here and be serial on all of them. Import Wi-Fi, print Wi-Fi.radio.ip4, address, IP4. Maybe it's v4. We'll do some dirs around. Yeah, there it is. Okay, v4, 132. We need to do this here. Let's just say, oh, maybe this, did this do HTTP? I don't actually know. Let's go straight to the IP for now. 32. But then this is HTTPS, HTTPS, but it redirects. Hmm, whatever. Redirecting. Just wants to redirect. I don't know. Let's see. How can we not do that? Port 80? If I say port 80? But specifically HTTP. This redirects me right there. It's able HTTPS everywhere. Is that a, if I have that enabled? Just browse through this one here probably. Is that a setting or is that an add-on? I don't think I enabled that. I will say I use HTTP for local host servers all the time. I don't have any issue. This one is different though because it's not actually local host to the machine. I think it's on by default. Firefox, preferences, privacy, scroll down, maybe find, yes. It is currently don't enable HTTPS only mode. So that's cool. Unfortunately, it's just not respecting that, I guess. Used to be an add-on, but I believe it was integrated. Maybe, I think the thing is it got cached or whatever, right? I think it's like, now it's cached to redirect or whatever. I think if I would have done it explicitly the first time, it might have worked. No, I don't know. Is Chrome any different? This one at least seems to think that it did. Clear caches or new private. I tried private. That one didn't seem to make a difference, but we'll try Chrome here. That one seems at least one step further. However, we did still not get, do I need slash code though? Does it still have an index page? Home or anything? Maybe it's not actually on the PicoW. So I'll tell you what I'm going to do at the same time here. I'm going to copy this, copy of it here. I did just copy a copy of settings.toml from my PicoW to my local computer. So now I do have a copy of that settings.toml on my local computer. I don't want to open it up, but I do now have a copy on there. So what I'm about to do is actually switch to the feather and just see like maybe I'm misremembering. Maybe the PicoW doesn't actually have web workflow yet. I'm pretty sure the feather does. So we'll test that out as kind of a sanity check. Or maybe web workflow doesn't work with Toml. That could be possible too. I don't actually know. So that's kind of what we'll discover here. HTTP 132 should get you to the, okay, so there should be, okay, so if we can get everything working, we should see the welcome page if we just hit the root URL. FeatherTFT doesn't come up as FeatherTFT. This is a S2, although I actually have an F, an S3 on my desk as well, finally. Bootloader. Web workflow works with Toml in beta 6. Okay. Web workflow was added in beta 5. Okay, so we should be good on the PicoW. We will sanity check this and then get back to the PicoW because I do want to try it out there. I appreciate the confirmation, by the way. Always good to know the thing you're headed for at least is intended to work. Should look through release notes more carefully maybe. Okay, there we go. So now I have, now the Pico is unplugged and the feather right here is plugged in. I'm gonna, I gotta move this back because I'm gonna copy that settings Toml over to the feather now. And while I do think PyCharm is pretty nice, one of the things that it does is when you copy paste a file, it opens that file. Of course, I don't want my settings Toml file open. So, move that back. But now I now have a copy of that on this device as well so that we could access it using that OS.GetEnvironment. Theoretically, so this one also has a screen which should also show its IP address. If we stop taking it over with this stuff, one thing, oh no, it did actually work. Okay, I got 113 it looks like we might be able to focus it a little better. I'll play about as good as it gets. It's like 113. That's interesting. Oh no, it's redirected again. That was interesting. It like loaded some more after it failed. Oh, there we go. So that works for me in Chrome on the feather hitting the IP address with HTTP. For whatever reason, Firefox, even though that thing is disabled, just does not want to go directly there as HTTP. Takes an extra second to load this time. Is it still going to fail? Unable to connect. Did connect over there that time. Strangely, it seemed to like finish right when I clicked through here. Just weird. Yeah. I don't know. That was very odd. We did eventually make it to here though in Firefox. Maybe I should have stayed in Chrome though or maybe I broke it by switching. If I send it a request while it was already in a request. It takes a while for the pages to come up. Yeah, I have seen that before. Or if we can get this back. Files there. I'll just stick to Chrome it seems. We didn't. We didn't have the HTTPS issue, but we also it seemed to load faster a couple of times. I tried it. So you're wearing mittens. Is it really colder in the States than it is here in Sweden? Not even a thousand miles from home. Yeah, I have. So I have finger finger. Fingerless gloves. I have gloves with the fingers cut out right now. So I don't know the. I definitely don't know the weather in Sweden. I think you're probably much further north than I am. So I would expect the average temperature where you're at to be colder than the average temperature where I'm at. That being said, it is winter here and even more specifically we're actually in the middle of our first like real winter cold snap. So the temperature right now where I am at is outside, let's say, which is important. It is nine degrees, nine degrees Fahrenheit with wind and the wind chill makes it feel like below zero and it's actually probably the hottest part of the day right now. It was actually much colder than that today. It feels like negative eight Fahrenheit right now because of the wind outside. 13 miles per hour wind. Yeah, we had basically all day it felt like below zero, like below negative five. Honestly, I don't think we ever got past that for the fuel temperature. So very cold where I am at today. We got a little bit of snow yesterday, not too much, luckily, but very cold. Coldest few days of the years so far by a pretty good long shot of the season, I should say. I don't remember back to January. Maybe we got colder back then but IP address I think is most direct. Host names will have to get translated. Yeah, I know like I'm pretty sure is it circuitpython.local I think is supposed to work. I have not had success with that one personally. I tried it a few times. Maybe I got it like once but I think the majority of the time I tried this one I did not have luck. I'm good with direct though. So I will switch back to the Pico. I'll put the camera. Negative five here in Chicago land feels like negative 29. Yeah, worse in the more northern states. Yeah, my partner at work is up in Michigan and the worst of it I guess is coming to him today. It's like mainly the same storm. But yeah, he was having the same kind of deal where like wind chill temperatures were like negative 20, negative 30. Have you ever tried my app for the web workflow? Haven't had time to work on it lately. I'd love to know your opinion, though it's possibly annoying to launch on Linux as you need note. The, do you mean the like library management? It's like a web interface for circup kind of kind of situation. Is that the thing you're talking about? Let's see. So we'll assume that we're on 132 again. That seems fairly safe. Should I put the HTTP back? Yeah, let's do it. There you go. So you just obviously have to put your feather in, put your feather out, do the hokey pokey a little bit, and then just plug your Pico back in and you're good to go. It's an app that finds and connects to the web. Oh, okay. No, I have not used that. Let me try it though, because I am interested. I have used disco tool a little bit, not as much as I should though. I should get more into it, truthfully. Okay. Let me, this one over here. Okay. Why do we have this over here now? Let's use the web workflow. The main code is now for the electron app. There's no guarantee that it'll run in the browser anymore. In fact, browser security features make it prelude to that. So I finally gave up. Yeah, browsers are tough for that list of boards connected to respond to interesting multiple ones can respond to that library installer. So you would clone this, you would do, so I should, I have, I think I have NPM, if not, I can install it. I think I should have it though for work stuff. Let's go. Got me with the, you got me with the bit bucket special right there is what I call that where it has get clone in the in the copy. I always, I think I'm always copying this and I write my own get clone. But inside bit bucket, they actually put that in there. This time I don't know why I saw it because it's in the read me. I don't know why I did it anyway, but on that and then NPM install. Let's open this one. I'll open it. I like getting this stuff just instead of using the terminal over there by itself. Let's get it to where we can see the files and everything. I will get from this one just because that's next door. I guess device workspace is now too. What was this called though? Circuit Python. Sometimes this needs to refresh and clone in the right space. Webpacker. Is that it? Oh, isn't it? Was it? Was it? Okay. Packager. So we go into it, which this is where that will spawn. We go NPM install, NPM start, install. I don't actually have NPM. I'm surprised. Do I have node? Yes. Surprised by that, truthfully. I will install it. That's the old name. Binary is for Mac and Windows. I haven't figured out how to do it on Linux when browsers decided not to display it. Should be created a lot of confusion. Yeah, I would agree with that. I dislike the design choice of browsers to magic that away into a button in an icon or whatever. Yeah, should just show you the full URL, I think. They did not ask me for my opinion. Do I need node as well or is this going to get... Oh, it looks like some node stuff went by. This is probably going to get node for me. I'm actually surprised. I guess I just didn't get it on this computer yet. Must not have gotten it on this computer yet. Well, I'm running out of those things. Slowly but surely. You were in fewer things that I run by where I'm like, I don't have that installed yet. Oh, that's interesting. Got a little snake loading thingy there. Hope it runs. I mean, it's very, very likely that my environment's wonky if it doesn't run. I don't know. Do you need special PC specs to code with Adafruit? Good question over in the YouTube. Generally speaking, I would say the answer to your question is no. You don't really need special PC specs. One of the best things about Circuit Python, in fact, is that the devices show up as a thumb drive. Is it thumb drive? I don't know why it asked me for that. That was just my computer being weird. The devices show up as a thumb drive and you can edit the code file with whatever you want. If you're already familiar with the text editor, you can use it. If you're not familiar at all, there's one called Mu, which does not require a very fancy or fast or expensive computer. You can use relatively low-end hardware and you should be able to edit your Circuit Python files just fine. I will say if you're interested in contributing to the extent that I do, working on repositories, working on building Circuit Python, building the core and stuff like that, a faster computer with more RAM is certainly a helpful thing. It will help you be more efficient, but it's not a requirement, right? You can just as easily do all of the same things. Certain ones of them will take more time, but there's nothing that you just subjectively can't do. Unexpected, not where we even made it to here, exposition, code mirror build, help or build, unexpected token. We can try to find the log. Anything more helpful in there or is it the same stuff that it prints? This is another place where I wish the text would just stay. This is a text, but not really, but kind of, but not really, kind of, not finding it though. It just doesn't find anything because now it's like search and search is a different thing. Somehow there is a way to type into this, but I don't know what it is anymore. That frustrates me as well. That's basically the same thing, the same argument as the browser in my opinion. Making this thing not writable even though it's an input is essentially the same concept. They're simplifying text inputs too far to the point where they're no longer helpful, in my opinion. Interesting, there's two different ones. Why this copy is like this sometimes. Non-completed verbose, complete error log, bug log. Isn't that the one I did? Yeah, that's the one I did. I think that's a very appropriate question, truthfully. Okay, we did get the same error. I'll check the other one. You know, I guess the new one, I really wish I could open this. I guess I can like click through here, but it's like, I don't understand why. I don't know. Honestly, I'm probably missing something. I don't know. I don't do JavaScript, like Node.js building enough to really be able to troubleshoot it, but I'm guessing that there is like something I'm missing. I mean, let's make sure I actually have node. Really, I would need node. Like, guessing that got installed. Yeah, apt. So, I don't know. We'd have to dig a bit further. Code mirror? Missing a code mirror? Unfinished? Refine? You want a hijack? Yeah, no worries. Log, build helper. Extensions? They're like a top level extensions thing? I don't know. CM build helper. Code mirror build helper. Does it seem like maybe code mirror? It could be if that's a thing that needs to be installed. Maybe we're missing that. Use move for most of my circuprath I'm programming. Started to use VS code for a couple of large projects. Nice. Yeah, we have a lot of folks. I've seen several folks mention they like VS code, and I don't have anything against it. I just have been using PyCharm for a long time, so I kind of just got grandfathered in, so to speak. I just keep using it, because it's easy to keep using it. But lots of folks really like circupython. I mean, VS code as well. Your layout's already set up to work that way. It might be missing let me, sorry. From my experience using bare SSL, completely different library and scene language, but it might apply here. How to apply certificates for HTTPS in order for certain things to work within a browser? Your layout's already set up that way. Might be missing. You need to set it up to work with HTTP like what AnikData was saying. How's it going, DJ Devin? Hey, I got, I did get the cowbell. Cowbell sequencer came the other day. I got it open. I have looked at it. I have gazed in amazement at the both the front and the back, honestly, of the PCB. So great job on that. I have not built it yet, but that is like starting in the next couple of days here probably after Christmas when I've got some time off and I'll be home be getting down on the soldering with that one. So thanks again for offering to send that, by the way. Definitely really appreciate it. Once I get it together, I will spend some time on stream playing with it. I don't have an easy way to do the soldering and stuff on stream with camera and everything, but once I get it built, we'll do some coding. We'll tinker around with it on stream. So yeah, I would definitely need certificates and stuff like that if we wanted to do, if we wanted to actually access it via HTTPS, we would for sure need some additional setup. In this case though, I am just trying to do HTTP and we did it. We eventually got it there. In fact, can't use move at the moment due to unexpected Mac OS incompatibility. There's in a fix. There is a fix in the works so real soon right now. Yeah, I heard issues about Mac. Yeah, I do think they mentioned I think during the most recent weekly meeting, I think somebody mentioned a new one was updated somewhere. I don't know, like it might, you might not be able to actually get it automatically or something yet. I haven't followed it super closely, but I remember hearing about that a couple of weeks back, the issue with Mac OS causing trouble with writing or something like that. I did remember hearing that about that. Been trying to cram a six month Google IT. Oh wow, six month course into six days. So far I've done 15 weeks worth of course and I've done it in two days. My goodness, that is a lot of IT coursework. That is a lot. How come I can't edit? Oh, right. Yeah, yeah, yeah. Subject that. Do I need to refresh this page then? Plus save. So now if we go back, how do we get, there's a serial? Yeah, there's our edited code. So that does appear to be working now, which is pretty awesome. So I think I will, should we keep using the web workflow? So one thing I've never used is code.circupython.org. Is it, I don't know how this part works though. So this, do I not need to load this page first slash code? Should I, can I go just direct here slash code? There's also this state path. No, I don't know what all this stuff is. This is also a different name. Oh, 301232 something. Oh, if this stuff works. Yeah, I think I may not just don't know how to use this part of it. And then I think the local thing just doesn't, so something about my network. Oh, now we made it here. Okay. Something about the dot local thing my network doesn't jive with very well. It seems like nice. All right. Let's give it a try. We'll give it a try. I'll switch back to PyCharm if we run into trouble with this, but I'll, I'll try this out like this. This will be interesting experiment to try just using the editor in here. Like I said, I haven't used code.circupython.org before. So I've never used this one that's like kind of halfway reskinned or whatever. It looks like a more complete editor than the bear bones one that we saw back here. I will have to jump a bit back and forth though because where I want to get to is doing gist stuff. So the start let's do bear bones. Let's try to make a gist slash code. Thank you. Only discovered the symbol for it wouldn't work. So we're at pre shipped them. Oh, yeah. And I'm not worried about that. I'm excited to build the thing and just use it for the sequencer bit. Documenting a work around. One more about Linux administration in the past two days than 10 years. Let's take in determined to try to finish before Christmas. Dang. Did write some code for the cowbell. Stuff near dock work. Wrote is way better. Nice. Let's get that loaded up. Is that on GitHub somewhere? I didn't see near ducks shared, but I have been absent from the discord in the past couple of days, truthfully. All the things still running 10.11 or 10.12 for Mac OS versions. Gotcha. So we're going to need to make a post and we're going to need to edit some header things on it. Yeah. So let's try to do that to start with. I'm actually going to go to the request library requests circuit Python is inside of here. Example there will be something that has a post will do. So do I need to, yeah, you still need to set up Wi-Fi inside your Python code. Does using Wi-Fi from the Python code mess up the web workflow? We will be doing secrets differently. Your ducks version is the current version in your GitHub. I see. Use the same chaos, which is like toggle. Nice. Interesting. Okay. I'm going to just get up to the actually I'm just going to take all of this. We'll cut out the parts we don't need some stuff like secrets. We're not going to do this anymore. We are going to have import OS. We'll just get rid of this print. We'll just say connected. Oh, highlighting is a little bit wonky in my case. Probably the dark mode is maybe throwing it off some connected. We need the IP. We already know the IP, right? It's going to be the same as we have probably. All right. So here we do need different things. And in my case, they're actually just the same as these. Let's see. No, you cannot have a web workflow and Wi-Fi encode. Just don't start server. Oh, you can. Excuse me. You can have web workflow and Wi-Fi encode. Just don't start a server on port 80 or change the default. So change the default port if you want to start a server on port 80. Okay. So as long as we're doing outgoing traffic, we should be able to make requests out to the Internet and get data back. And I'm not running a server other than the web workflow. So we should be good there. Let's see if we get connected. HTTP bin.org slash post. Maybe I'll look into that one as well. I'm interested in if any of these, like, text posting services offer an append API, I would really love to be able to append some new data to a file without having to send a full new file. Just do the post for now. Control S doesn't work on this one. I'm going to add that. And that takes you over to here. Okay, there we go. So we sent the data to the server. That seems to have worked. Get back to our editor here. And then let's say just the highlighting seems like it doesn't work for my color scheme or something, I'm guessing. When I do multi lines, it's fine. But oh, oh, interesting. That deleted the third line too. Okay. So I'm curious about using one of these, like, paste bin type services as a as logging for an IoT device. I was messing with the logging library in MQTT last week. And it got me thinking about, like, using gist or paste bin or HTTP bin, these kinds of things as as output for a logger, essentially. So if you have a remote IoT device that's not easy to get to us beyond, you could still have it like outputting data for you somewhere. outputting logging information in particular, ideally, as long as the network is not messed up. Just send it directly to API GitHub gists is the base URL. And that's saying that we're going to send a post, we're going to need to presumably set up these headers, which is, I think, do you pass headers in here, maybe? And it can be just a dictionary. Ours will have all of these things. I'm just going to actually take them like this. Oops. Oops. I don't know what I called the API token. I mean, this one should, like, give us an error of some sort. We got a syntax error. In fact, before, sorry, headers. Oh, needs to be a stream. We'd actually want to be saying, oh, yeah, this is actually syntax error also, right? Headers, we need to fill in control s. I want to get control s going. Expected key value for dict 31, the key value. Expecting E colon value for dict 31, the like new line or something. Why in line 23 say connected? How do you know that you're connected? I think if this, I think if we don't get successfully connected, this will raise an exception, I believe I could be wrong about that though. But that's what I think. That's the way I think it works is this would raise an exception. Therefore, if we get to here and no exception has been raised, then I think we know that we are connected. I could totally be wrong about that though. But that's my understanding. One of the exercises in Windows PowerShell took 45 minutes. Same thing in Linux took five. Thanks. Will there be an exception if yeah, I'm definitely very confused about this dictionary one. I feel like, oh, okay, well, maybe we is this is this I see. Okay, okay, okay, authorization. Okay. That one was definitely messed up. Okay, Jason post URL, not defined because I changed it to base just URL. Actually, we'll we should get an error back from GitHub like unauthenticated or something. I'll need to actually fill in my token ethane here. Actually, oops, actually this year. There we go. So I'm sending some data, year data line 50. I used to being in the same tab. It might have gotten, I don't know, print the whole thing, not bothered with trying to access one specific bit out of the control s bad credentials. Okay, that's what I was expecting bad credentials. So in order for that, I do need to do the token. But then your script crashes. That's true. Yeah, it would crash if it didn't get connected. And if I were making this as like a real script to use in a real project, I would be catching that error and retrying and restarting and doing stuff like that. In this case, it's just going to be a test basically for this. So I'm not bothering with any of that stuff. If it does crash, I would just control C control D. But that is definitely a good point. If it were like, you know, final project, or if it were just going to be somewhere where it's inconvenient for me to control C control D it through the repel, I totally would add like some try catches and some extra logic like to basically make sure stuff is working how it's intended, instead of just going on. So what's the easiest way to do this? I think you have multiple files open. Yeah, I'm going to pull this over to here because I need to look at the Toml file again. It doesn't let me open it actually. It won't let you open files that aren't .py. Seems like I can't open settings Toml problems parsing JSON. Now I think I just didn't send the data correctly. I think we can put a find would you add new data came in late what's the goal of just API request so ultimately my goal is to in first and foremost just play with the just API see how it works because I haven't ever done it before. The thing I have in mind to do with it from circuit Python is try to use it as an additional logging handler. So last week we looked at the logging library and some PRs that added the ability to do multiple handlers and then some examples that did a MQTT handler and it got me thinking about whether we could have a handler that is a you know it sends logs to gist or paste bin or things like that. So that's my ultimate goal is to try to create a new file in there and then ideally I want to be appending new stuff into it. I don't from what I can tell I can modify a file but I would need to send the rest of the body again so I got to look into that that part of it for sure. Else is not defined. We have JSON that's not valid. Python like how most py emojis are read like raspberry. I had new data to it rather APIs than data to it. I'm not sure what you mean. Oh I've missed one actually are you going to take ownership in chmod just to look at the file. Not sure I follow chmod. I mean it will be the only the file will exist inside gist and it will have the default permissions however it gets set up based on I assume my token or whatever. I don't think I'll need I'm hoping that I won't need to mess with permissions really. Do we have any other true falses nope okay so let's try that again posting data. Okay we got back this thing which has a bunch of stuff in it the easiest to read in this format so what I'll do is go to here single quoted like it's Python not Python not JSON. It appears to have worked I think guessing this is successful. There's a lot of stuff here I have not looked through all of it. I assume if we got an error we would not have received so much stuff comments works description get push URL there's our URL right there it was an API URL though HTML basically the same but just instead of API there we go okay revisions if I revisions revisions we might actually be able to take advantage of or logging just are not private anyone with the URL can view it yes thank you very good good point excellent point in my case I am intending for it to be public I'm not I won't put anything private in here very very very good point though yeah especially if anyone is ever going to try to use this with the logging thing like this like obviously anything you put into here is you know not only going to the internet and thus like you're sharing it with the third party Microsoft but by default it may in fact be be public although they do have private just these days possibly you could somehow make it private instead but then you I mean you are still sharing it of course with Microsoft the third party and then anything on your network that could see the see the traffic potentially as well and if you don't go out of your way to make it private then it will probably be public by default or else that's what you should assume so don't put anything in there that is not intended to be shared publicly first time you get a proper key value response yeah check just yep okay so now we need to update though because we created one so the thing is like we don't want to create a new file every time we print a log we need to be able to update the file so creating is working oops I'm gonna go back here back here what I'm gonna do is basically say creating can you do like control I'm just gonna get rid of data this one we don't need this okay I will have to be right back in just a minute I gotta run to the restroom I'm not gonna make it it's gonna try for a minute but I am not going to so I will be our be just a moment so updating is different we're gonna need to give it the ID at some point we're gonna need to work out like I guess what we'll do maybe is like so ultimately my intention is to create a handler much like the MQTT one and I guess what we'll do is probably when you initialize it will create the gist with a file in it and then whenever you emit a new record we'll try to just update that same file so like if your device restarted this would get re-initialized you'd get a new gist but if your device just stays on and keeps running then it will keep adding to the same file that's my goal hopefully should be a third choice where secret just are truly private yeah yeah I do not know which is default but I have seen that option doing it through the front end for sure but this is my first time messing with API so it's definitely safest to just assume that it will be public update so here we need to pass it the ID is there control D no node ID is this the ID right here it's actually the same URL just with this added on but it's all right so we are not going to update the description we want to update the file only interestingly you can have multiple files inside one gist which I didn't realize maybe we could have it do that maybe we have a single gist but you get one new file each time it's a instantiated that could mean that our ID stays the same which would be nice you could just hard code it in your settings file or something no private repos were an option not like every use maybe if for teams for proprietary stuff yeah yeah github I think it initially I think they didn't but I think they do now have private ones ID yeah would not be good so do we it's basically just the same data again but we don't we're not going to do a description this time we're just going to go files just a dictionary read me md object content new content inside of this file so we would theoretically timestamp it as well so uh investors headers will be the same give it a try hashtag draft different than any other cloud services oh I really flip the scrolling here no private data maybe stuff you're working on all right quite ready to go live smaller companies use github infrastructure I mean it's relatively cheap I think to pay for the base level as well to and it is a lot of work so so I will say just anecdotally right I don't have that much experience but anecdotally the company I work for we we hosted our own git lab for a little while somebody that I worked with wanted to set up a git lab and host that and we stored our code inside of there and it was actually a lot of work once that person left then it fell to me to like maintain that and I was like why are we doing this instead of using someone who has all of this infrastructure and like keeps it running for us and I migrated us out of git lab so that we were not hosting our own anymore and it's like I couldn't believe like just how much was involved with only the infrastructure of storing your source code and when it goes wrong you're kind of stuck it's no good I definitely walked away from that very much valuing letting somebody else be good at version control system and then I just want to use theirs yeah I do not want to host it I think it's good to have a backup like to download a copy of all your stuff every day or whatever like make sure you have the latest version cached somewhere in case Microsoft goes away or something is definitely also a good idea but managing that server yourself is way too much trouble for what it's worth so yeah we have this should not be json response well it's I guess should be but we need to do this first I control s again with that promise parsing json assume we get the same thing again yeah we got it twice in fact promise parsing json way I gave it invalid json I'm guessing I will say there are a lot of we were talking about pie charm earlier and I am certainly very spoiled by a lot of the features in pie charm as far as editing code and stuff I seem to have a syntax error here not quite jumping out to me my guess is that if I were in the full editor it might become more apparent I guess our problem is actually just that we need to dump this right json dumps surprise that didn't fail with a worse error actually because that implies we sent something to the server I'm surprised that we managed to send something to the server that it was unable to parse I wonder what on earth we sent because I mean it was just a dictionary in python so like it's up to request to decide I guess what it would do didn't call json dot dumps I wonder how it's in it so theoretically we should see this here now yeah okay I could get behind this editing the file this way so at first I was worried like if you wanted to append to the file you'd have to like first do a get request to fetch the current contents and then add your new stuff to the end and then post the whole thing back as long as revisions are stored here though I actually don't mind just updating it one line at a time and as you update it the current file only ever shows the most recent thing logged but the revisions continues to always show you the history or do we want to try to make it work with append even if just for the exercise maybe it's a good idea does it call string it could yeah I don't I do not know I'm curious I don't even know what what that would do the local editor so this one is the code dot circuit python dot org it is like quasi local it's part of it's hosted from the device I think you need internet access still though as well I think it's pulling CSS and JavaScript from circuit python.org I'm not actually a hundred percent sure how it works and which things come from where but I do think some of this does come through the internet happy holidays how's it going ask Patrick yeah thank you happy holidays to you as well and everyone else watching too I believe the editor is code mirror and that's the one that I use as well in the app yeah it's pulling from cp.org okay yeah yeah I made a version at one point that it embedded more of this but it was it made more sense to not to keep the one that was fully embedded like super bare bones and then it can like call out to the internet to fetch the more fancy versioned one every time I drop into the stream I learn something new nice happy to hear it um back to here so let's try it you know I think the revision actually is probably might be the best tool for what I was originally imagining but I am curious let's see if we can get the contents let's see if we can actually append to it see if we can actually append to it I think that would be nice if that would eventually stop working because whoops oh I don't know what I just did it was not nearly as bad as I thought it was though though my highlight works to oh no it doesn't there we go okay that's what I was trying to do tabbing oh no you can't tab sadness we'll just keep doing the same file for now so it'll be old content new line new content like you wouldn't uh you wouldn't use it for a real-time sensor temp sensor but sensor updates every five minutes yes yeah something like that is what I'm imagining yeah not certainly not printing like multiple times a second or something I'm thinking like once every few minutes max honestly maybe even slower than that like once an hour or something or or I mean really my my mind you know in my mind's eye so to speak it's like when something goes wrong this is like an IoT device which is on the wall or whatever somewhere and it's like if it's not working then you look in the gist and see what the last thing that it printed was like it's got errors or whatever it will hopefully print to there but yeah certainly not like real-time feeding sensor data back that is not my intention to use the use it for I need to look at contributing to cpu or web editor that'll be easier than contributing the circuit thing I yeah I agree I need to look into this as well one of the things I there's a few things already that I know like control s keeps getting me I would love for this to handle control s the the built-in one does um so that would be really cool and I think I added that to the built-in one so that I have the JavaScript code for it somewhere roughly speaking I'm sure the save process is different but all right so this is going to be ready to post back so theoretically if we do the we do what the comments say we should be able to do this let's look forget it just so this will be the same URL so I think let's change this to um I called this update URL let's call it actually gist URL all right let's start with that do not need to send it any data this time keep going back to there let's actually put that back off for now though let's just get first because we need to make sure like we need to get our content I assume it's going to be in this object but we need to figure out where in this object connected in print oh we didn't call the function fair enough that's fair that is fair technically I actually I passed I passed this in and then we just did it here instead I guess we should put this like that do that there uh let me catch up there uh for me say for me did you say ctrl s and ctrl q uh no ctrl s is supported in the local one the like this one if you go into here this has ctrl s and it works I added it to here uh this one does not seem to have it though when you do ctrl s it prompts you to save the html page uh ctrl q I'm not sure about ctrl q what does I don't know what ctrl q would do that one I don't know about I would like to get ctrl s in this one though so somebody at you no near somebody mentioned I think it was near back mentioned a few minutes ago about getting into developing like contributing to this portion of it that's what I was talking about as well I would love to figure out how to contribute to this portion and implement that ctrl s to here learning a lot of great stuff on home assistant lately good idea iot that can actually talk to maybe even a really old iot device to make it smarter by 3v plus have their official high yellow hardware ctrl q undoes ctrl s interesting undoes it what does that mean like essentially ctrl z and ctrl s like undo the last change and then resave the the undone change undoes ctrl s ctrl z I would argue should be undo doesn't handle ctrl r which is a carriage return without line almost every program I'm aware of uses z for undo ctrl y is sometimes redo yeah or ctrl shift z is another one that's frequently used if they allow third once low ctrl codes okay let's see if this actually does get our data ctrl s stop serial ctrl q restart serial we were talking about different things uh yeah I do I think we are talking about different things I'm thinking ctrl s in the editor in order to save the code like I'm basically wanting if I were to press ctrl s here I'm wanting it to pretty much click this button essentially update data is not defined oh okay I cut this out of the wrong one we were supposed to cut this out of that one yeah ah see like right there I just pressed ctrl s like instinctually cannot help it I pressed it trying to get it to save but obviously it doesn't get a click the button there we go okay so we got our data I will need to look in this data to figure out where the actual thing we care about is the files read me content I don't know why this is not getting better uh formatted but that's what we're at so if we said print paste on response files read me obviously we would change the file name here to a log file of some sort but content that should be the old content if everything works right oh if everything is actually going to work right but I'm going to do that anyway add the new content to it so we don't actually need to do that um technically that's going to get done right there so it doesn't need to be its own step and then theoretically we should be ready to paste back old content new line new content so if that actually works then I think we're good here I will save it once without the post back just to see if it did actually work for fetching the content yeah so I did cool okay so that it should work if we turn this stuff back on data here response json print it we don't necessarily need to keep printing the whole response really we care mostly about just successful or not but that's fine for now let me catch up here okay there we are so control z is the one I was thinking of from you guys talking about the editor yep uh not serial yep uh it's so confusing to mix control codes for editor commands with serial control flow uh I would agree although I don't know that much about it I think hopefully a bit of that's over my head on that note what is control shift z you're really supposed to do in the first place you know I program I I prefer programs that do control why because I get them and I end up messing stuff up if I try using control shift z usually then I get into a state where I can't get undone back to a state I want usually somehow even though it doesn't make sense and again control c is usually copy but in rebel yeah that's true it is interesting control c how naturally control c is like for copy but also for you know stopping inside terminal you scroll highlight and right click or is it left click most things on a mac never realized control c is problematic shortcut but yeah yeah and the serial usually control shift c will work in some of them uh if you're in in really really nice ones like pie charm if you have in here you can actually just control c regular all control c will work in here if you highlight stuff and it will keep it straight as well because you know if you highlight stuff control c will copy it but if you don't highlight stuff then control c will send it so it's like it's really smart about knowing which one you're trying to do inside pie charm terminals there is a context right click does have copy and paste in it as well I think mu uses yeah control shift c that's what terminal does as well that's what like this terminal here if you want to copy out of it it's control shift c but pie charm actually is just control c which is one of the nicest things one of the things I like most about its terminal specifically inside of here it's affected it treats it as normal just control c so it looks like this succeeded let's go look at our thing here we should have a couple of lines in here now in fact yeah we have three lines well two lines we have two lines and one of them is new hmm actually we got both of these but our new lines are not working do those need returns also I'm so not used to to editing in here do we need oh oh oh okay whoops yikes okay I just pressed refresh do we need this also and also does it come first or second are in usually right click the rebel and move muscle memory helps prevent me from trying to throw yeah that's true yeah if you're not used to it the control c will will will wreck you pretty good raspberry pi os apps are very inconsistent with control cv versus shift control cv I mean I don't really care I guess how it looks on this page maybe being a markdown in this case is actually making it weird that could be I think I think that that's probably the case honestly if this were a plain text file I think we might not have as much either way though truthfully I don't really care what it looks like in the pretty one as long as the raw one is has the new lines correctly then I'm I think I'm pretty much fine with that this will create a new file inside of the gist it's interesting because I thought just were one file didn't update the URL seems like somewhere along the way though just became just it's like a repo essentially right I think it's a full repo it can have as many stuff in it as any other repo can or is this a different gist thus it is different actually interesting okay well now okay yeah now it's different though because I created a new one but I guess the thing is if we had sent it to the same URL okay I want to try one more thing though also my camera did just die here I haven't shown the camera in a long time anyway though truthfully maybe it doesn't matter could you embed unicodes instead of new lines possibly I do not know it's a good question so I think that text actually will just make this better oh the ID is going to be different now too so I'm actually curious what happens if you post to the same ID but give it a different file inside the data dictionary if you click edit on a gist there's an ad file at the bottom yeah excuse me oops so not used to editing in here excuse me md there we go now that this is a text file we actually have proper formatting okay I think that is probably where we wrap it for tonight um obviously there's still work to do to use this how I want to do it but I and I think what we did is we basically knocked out the proof of concept and the api actual communication so at this point we should be ready to just create a handler object have it do the creation inside of here have it do the updating inside of here I don't think we need to do anything in there and then we should be able to just use it as a logger object um and that is where I am headed but I think that that part of the exercise will wait for another day um I'm gonna call it here and go and get some dinner but I am definitely happy to have gotten this portion of it out of the way also happy to have played with settings toml and the web editor this is again uh for folks that weren't around when we first got into this this is my first time using the uh code dot circuit python dot org version of this web editor uh as well as my first time using any web editor on the pico w so I wanted to try out all of that stuff it has been fun I will probably find myself back into pie charm sooner rather than later uh but it has been fun uh I'm happy for have doing this nonetheless um and yeah I feel like we're basically there we got everything figured out as far as the gist api that we need in order to actually create a file and update it which is all I need for the logging so happy happy with it we did not run into that much trouble I was expecting to have to do a bit more troubleshooting and honestly it was pretty smooth sailing so that's always good uh that was awesome thanks to him yeah for sure uh you're welcome thanks for watching thanks for hanging out everyone um I hope everyone does have a good evening as well as a good weekend and of course uh happy holidays it's uh Christmas or um you know many folks in the world I'm celebrating Christmas here in another two days uh so you know Merry Christmas to anyone who's celebrating that happy holidays to anyone who's celebrating anything uh happy new year to anyone who's not or um you know it's just more excited about the new year than anything else um I will I think I will be streaming tomorrow morning it will probably be a shorter stream tomorrow and I'm not sure what I'll work on uh but I should be around in the morning tomorrow so 10 a.m central time uh for my next stream that'll be over on my my own channel I'll put links to that in the chat when I get started um and like I said we'll probably do a shorter one than than usual but uh we'll hang out for a little bit tomorrow uh anybody who wants to sit and code over a cup of coffee with me so have a good night everybody uh I will catch you