 So welcome everybody today. We're going to do a quick review of github co-pilot I have two extensions installed one is the co-pilot extension. The other is the co-pilot chat extension So this is the co-pilot extension this you need you'll need to connect it to your github account And then there's the co-pilot chat extension This is a second extension that allows you to actually open a chat window And this one's really powerful and this is the one that I get the most value out of Basically minus setup using all the defaults. I haven't changed a thing. Okay So one of the things that co-pilot has is this The what they call the sparkle command. So if you are looking for Some sort of a VS code setting save on format You know, I save on format Or something that our format on save or whatever You have this option that will appear that says ask github co-pilot. Okay, so when you click that it then Does its thing and it says It seems that you want to save on save the current file and visual studio code You can do this by control s if you're on windows command s if you're on Mac Okay, but it has additional Additional things so then this down here you see that the sparkle they call this the sparkle icon You will begin to see that once you installed in many different places This is the Saraswati project and this is the custom Google Drive Loader this is a hodgepodge of GitHub co-pilot going absolutely nuts and spitting out all kinds of code right things that I don't even understand Okay, but that's all right because one of the great things about This tool is if you open up the chat window here with this line selected I can do Explain Don't have to type anything else So it's looking at this line and in theory it's going to give me an explanation of what it does and what it is including examples and you can see down here the Sparkle icon again, that's a follow-up question. It's really remarkable Could you please show you an example of the explain of like an API cool with Where the documentation isn't necessarily like go into the library like sure that Sure, so Jerome, what do you exactly want to know for example? What are the parameters? Yeah, so like for example the doc the example that she gave in the video was called to the database where it added various Extra flags to the cool right the API cool and she was saying that these are examples from an old version of the documentation I'm wondering how well and your solution to it and adding random Extra flags and things is to say it can actually help explain these things to you And I want to see like how well it works when it's given Like an API cool where the documentation isn't necessarily like Gonna be indexed or it might be indexed, but maybe not the most recent version Do you know what I mean? Like if you've made a call to Google slides API, which you seem to have somewhere here Yeah, so for example can If you ask it like what does this the source mean in the Google slides API result something like that like something really specific that's like All right, you can do you can just ask you questions for example No, let's say so you want to know What does the source? Attribute mean Where does it come from What does It represent for example, right Yeah, so maybe it's maybe it's just like here. I see a scope and am I I'm just Right, so it's looking at the thing is it's looking at what I've selected right here So if I just if I come in here like this and I just select say You know this this bit here Above question using the selected code. This is exactly correct by the way. This is 100% accurate I'll give that a can you Pretty amazing pretty amazing This is a specific Python construct and you can see down here it ends with yield, right? That is used quite a bit by and it's an advanced programming Python programming language feature that is very low memory use and Should be used whenever possible So it looks like a loop, right, but it's actually it's a memory Low memory use loop. It's a generator function. That's what it is. Yeah, so exactly correct It's a generator function. It's done using the yield keyword Exiterating over the list of files returning the most recent it's incredible Yeah, the advantage of generator is that it doesn't need to compute all values up front Which can be very useful for large data sets Just one of the reasons Python is so is used so heavily in data science This is the let me show you some of the some really cool things that this can do, all right Watch this. We'll just we'll just write on it So when we're you know when we're developing new products focus really isn't on getting the code, right? The focus is on getting it working and the tests passing Then we'll go back and we'll look at how we can refactor to improve the quality of the maintainability of the code so As you can see we've got some work to do Right list all the code smells look we got quite a few we have nine code smells here Let's do this. I want to give you another demo that that has a very interesting approach and Over here what you can do is You can open the chat window right here, for example, so you could say And you can do the same thing. I don't know how to fix the latch Type hints in this file and the difference is it's the UI that changes And I think it's easier to work with when you do when you do it this way Okay Now this looks really awful Okay, and it basically just it it's not a very elegant approach and on a tiny screen like this It's really annoying right so here's what I do I go like this There's this option here discard to new file Okay, because I don't want to accept these changes without reviewing them I want to see what the hell it's actually doing. So if you create a new file, that's pretty cool It opens it up like this and you can begin to sorry you can go through and you can Analyze What the changes consist of so it's starting about right here? Sorry, this isn't a great approach as you can see because it does thing You know when you create a new file, it's not including all of the context So Python starts complaining about indentation and things like that But you can begin to go through and see where the missing Type hints are so let's look at oh, I'm sorry The first thing that it did was it included list and dictionary to our typing our Call for the typing library. Okay. Well, that's cool. So it did definitely add some so the first one here is discussed Custom Google Drive loader. Let's give it a little more space and you can see this line right here. It's added String a dictionary with a string or any subtype type script people will recognize this Annotation immediately. So then I think it may have added some to Yeah, see there's a Boolean. I don't yeah recursive equals false it added the Boolean type right there So this is one approach you can use for adding For going through and fixing stuff that's broken What's the shortcut for this check window? command-i So you can think of it that way and We're doing the same sort of thing and so it's going through and it's finding all of the instances of multiple Responsibilities and it's going to try to ferret them out into separate classes With varying degrees of success and failure. Mind you. This is not this is this is an it, you know, mega advanced sort of Behavior and to expect it to just get it right from the you know from the get-go is You know come on really so Interesting what it did here. It's hard to say exactly what it's done. I don't really know what it's done here It's odd that it removed the comment But it's doing super in the in it. Yeah, I'm too though, so I Don't know if any of you see what it's done. Let me know Well, it's got a load method, but that was there anyway, oh No, no, no the London initialized service as well. It's you know, and the load credentials. I know the road I don't know what it's done. Well, yeah, no initialized service. That's a new one. It's done that That's nice. That's helpful. It's one that I had in mind, but I just haven't had time to get to This load there is the base class has its own load Function and it's overriding it for some reason. I'm not really sure why I guess because it's doing the initialization here. Okay Let's just let it go Hello They got confused it doesn't know what it should do. Oh, there we go. Oh Tomah Okay, and then look also by the way when sometimes you'll get multiple completion recommendations or suggestions and if you roll if you mouse over you can go you can navigate through them, right? so This is really interesting. I Just said yes to all of this Who will dockloader not a great name, you know, but you can modify that sort of thing by by clarifying up here in your comment What exactly you're looking for? But you can you can see I'm not gonna go too much further into this because this is like this. This is a rabbit hole of Huge dimensions so you can just spend hours and hours experimenting with this stuff And you do have to be a bit careful because it will introduce errors It will introduce it will makes it will hallucinate a little bit It's not a hundred percent Gonna fix everything and do things correctly Fixing problems generating commit messages, right? So this bit's kind of lame. Okay, but It can work. I don't really have any good examples, but let me just give you this one example Okay, so like if I come up here and and I want to commit this one file that I've staged You'll see I have the sparkle icon if I click that it's gonna generate the commit message Really lame. Sorry co-pilot on that one. No, that's a fail. Sorry about that Because it's like, of course, I'm adding it, but what's the feature that I'm that I'm modifying So in my notes file here, I have I've added some data on some test runs that I created And if I select that and then I come up here and I do the same Fix bug There's no bug. I don't even know where it came up with that. That's why I said lower your expectations It's gonna get things wrong. I don't usually use the terminal in VS code that this one feature may Convince me to start using it. Okay, so Let's say I'm trying to do something and I execute the command WTF it goes. Hey WTF hasn't found but look there's my little icon. So if I click that Explain using co-pilot Right Okay, cool. Thank you for letting me know. Let's we could try brew install WTF util Who knows if that's even a real package that could just be a complete elucination, all right And with that So really good stuff Cool. Thank you all for listening. I appreciate it. I hope we got something interesting out of this