How To Use GitHub Copilot (with Python Examples)

  Рет қаралды 167,434

pixegami

pixegami

Күн бұрын

Пікірлер
@karlfimm
@karlfimm 2 жыл бұрын
I'm just starting with Copilot but I'm finding it very useful. I'm a recently retired programmer (40+ years experience) but I tend to do things 'my way'. Suggestions from Copilot often do things in ways I wouldn't normally do myself. Sometimes better, sometimes worse, but a chance to break out of the rut. Copilot is also great for whipping up a quick test routine to exercise code you've written - which means you're more likely to do it.
@pixegami
@pixegami 2 жыл бұрын
Glad to hear industry veterans are finding it useful! If you already have a lot of experience and established style, then sometimes Co-Pilot's suggestions can seem a bit mediocre. But if you ever have to work fast in a new framework or language, I find it really helps me to keep moving forward.
@2Dimples4U
@2Dimples4U Жыл бұрын
Any tips for an older guy to go just started his software Dev career? I sometimes feel like I’m so slow learning compared to these new college grads.
@konstantinrebrov675
@konstantinrebrov675 Жыл бұрын
Many job descriptions require the developer to know multiple programming languages, frameworks, APIs, and other features. It takes a lot of time to study and understand all of these software technologies to even get your foot into the door for these jobs. Many positions require you to know a lot of details. For example, different web frameworks might require to achieve the same feature with different codes, they have different ways of approaching the fundamentally same functionality. For embedded systems developers, there are multiple different assembly languages, some with Intel syntax, others with ATT syntax, and also having different registers, and different ways for dealing with digital and analog input/output. Incredible details to master! When studying programming, you have to know the fundamentals, the key concepts. Yet at some point you have studied the concepts of programming, and the algorithms, and data structures ... you reach a point where all that you have to learn are more details about the code itself. You eventually reach a point where more studying will not give you any more in depth understanding, but it is only details that you have to memorize. So automatic programming tools such as GitHub Copilot would be very good for programmers, freeing the programmers from bothering themselves with all the details. It is required of a programmer to know the fundamentals of the programming discipline, and how the systems work, be it web development, embedded development, or phone apps development. But the details can be taken by the Copilot autoprogramming tool. It isn't humanly possible to study and absorb all the information in a reasonable amount of time. So we take care to study only the fundamentals, the main and supporting concepts, but leaving the details to the machine. It's like the principle of abstraction in programming. Like how high level languages and compilers free the programmers from having to hand code every feature in assembly languages. How general purpose logic units free programmers from implementing the algorithms in hardware logic gates, enabling the discipline of programming software to be used at all. So Copilot is the natural continuation of encapsulating low level details into the machine, enabling programmers to be more productive, at least theoretically. If compilers and general purpose logic units did this to the computer programming, Copilot and related autoprograming tools are doing this to what I call "metaprogramming", the process of programming itself, and learning programming. The Matrix movie teaches us, "never have a human do the job which should be done by the machine".
@pixegami
@pixegami Жыл бұрын
That's the way I see it too - it moves the level of abstractions that software engineers need to deal with. I think this is a good thing.
@seatownrocks
@seatownrocks Жыл бұрын
Having chat gpt generate your comment... no fair! :D
@bhaumikrathod1280
@bhaumikrathod1280 7 күн бұрын
Very useful. Thanks 👍
@mintifu1658
@mintifu1658 Жыл бұрын
My ear blown away from how hard this man hit his enter key
@pixegami
@pixegami Жыл бұрын
🤣 Sorry!
@rkpell11
@rkpell11 Жыл бұрын
🤣
@xugefu
@xugefu 10 ай бұрын
Thanks!
@pixegami
@pixegami 9 ай бұрын
Wow! Thank you so much :)
@christophertreadwell4726
@christophertreadwell4726 Жыл бұрын
I rarely write comments, but I love the relaxing beat, the explanation, color of the video, and the examples. Thank you so much for this video it is really well polished.
@pixegami
@pixegami Жыл бұрын
Thank you! I really appreciate you taking the time to write that. It helps to motivate me to make more stuff like this!
@Websitedr
@Websitedr Жыл бұрын
I remember when the argument was using an IDE for typing code was cheating. Only use a plain text editor like notepad or vi they said. The tool doesn't do the job it helps you do the job.
@pixegami
@pixegami Жыл бұрын
There's always going to be folks who argue against new tools or adoption. It's also sometimes hard to tell apart what is a fad vs what is a truly groundbreaking technology. But I'm an optimist, and I'd rather focus on building things than winning arguments! 🛠️
@radianta5278
@radianta5278 Жыл бұрын
actually using a keyboard is also cheating so you should write your code on a paper 😂
@MiguelAngel-re6rh
@MiguelAngel-re6rh Жыл бұрын
Good old Borland C++ Builder + Copilot... Good !!!
@ChannelXY
@ChannelXY Жыл бұрын
Actually, using a computer to run a program is cheating. You should always run programs in your head, not only dry run.
@kylerrasnick
@kylerrasnick 2 жыл бұрын
This was a really helpful introduction to Copilot. Thanks!
@pixegami
@pixegami 2 жыл бұрын
Thanks! Glad you enjoyed it!
@DouglasFish
@DouglasFish Жыл бұрын
Thanks for the examples. It is making me a little lazier, for sure. I will be sad if it ever goes away. But I also have learned a lot of things that no one would have taught me; or I probably wouldn't have figured out on my own. Analyzing what it feeds me, and figuring out how it works is such a fun adventure every time.
@pixegami
@pixegami Жыл бұрын
Yeah, same. I felt lazier at first too, but if you look at the 'work' it's doing, it's mostly filling in the blanks for lot of menial tasks (e.g. writing HTTP requests) . I'm definitely happy to get that 'time' back to spend on more creative and interesting parts of the project :)
@bgwg80
@bgwg80 Жыл бұрын
I found useful to provide the contexts of what I intend to do to copilot by writing comments before trying to write any codes. So, I usually write comments, hit enter, then at the next line, copilot provides a code snippet sometimes the whole chunk, the other times, line by line. Then, I tweak the logic and refine coding style. I iterate this process repeatedly. It's definitely not perfect but I type a lot less nowadays to get the job done with the same level quality that I've been practicing for writing codes. It's definitely a great "assistance."
@pixegami
@pixegami Жыл бұрын
Yeah that's exactly what I do as well. Another thing that has worked well for me is to write all the function signatures/returns first, or the datatypes first, and let it fill in the logic.
@JokerPW84
@JokerPW84 Жыл бұрын
I haven't used it yet, but your video sure made a point towards me trying it! Thank you! ;)
@pixegami
@pixegami Жыл бұрын
I think you should definitely at least give it a go. Let me know how you find it!
@DoomCatcher
@DoomCatcher 2 ай бұрын
couldnt find any good c# videos on this but found yours useful thank you
@pixegami
@pixegami Ай бұрын
Thanks! Glad you found it helpful, even though it's Python-focused. Hope you can apply some of the concepts to C# too!
@Rider0fBuffalo
@Rider0fBuffalo Жыл бұрын
I have struggled to use Copilot usefully. I usually try to use it via a comment prompt - like "filter a list foo for items where status is 'done'" and it doesn't output anything or it outputs too much unrelated code (even with such a simple prompt). However Chat-GPT is incredibly good at doing this. So I was watching this video to try and figure out how to employ it better, but I didn't see anything different from how I use it. I try to comment all my code to give it more context, and that helps a little.
@Shiffo
@Shiffo Жыл бұрын
As a Finance guy that has been using and learning Python on the side for the past 5 years. I have to say that using ChatGPT has made me use Python a lot more and has made me learn a lot quicker about the types of code I can use.
@pixegami
@pixegami Жыл бұрын
Sounds like a great use case for it. And I think it’s going to be especially helpful to folks who aren’t full time programmers, but want to eventually tap into coding or automation.
@Apple55330
@Apple55330 Жыл бұрын
Awesome! Thanks for sharing your insights!
@pixegami
@pixegami Жыл бұрын
Glad you enjoyed it!
@fsaforosaforo6338
@fsaforosaforo6338 Жыл бұрын
Very cool and useful video! I am a novice in the programming game, this video shows me how copilot could help me broaden my skills .... sorta like a tutor who is available whenever I need it. Thanks for sharing. Flo
@pixegami
@pixegami Жыл бұрын
Exactly right. Just be-careful of relying on it too much without understand what it's suggest you!
@davidkovar7486
@davidkovar7486 Жыл бұрын
Thank you for your video and the examples you have provided within!
@chris9352
@chris9352 2 жыл бұрын
I don't get why some devs are against this! When you think about it, everybody uses stack overflow time to time when they are stuck! GitHub copilot is simply saving you time that you would have spent googling the same things anyway! So, let not be hypocrites here! The only use case where this might be really really bad, is if you're new to coding and still need to grasp important fundamental concepts of computer programming. Because you need to be at least able to read and 100% understand the codes that GitHub copilot generate, otherwise you're just shooting yourself in the foot!
@lighteningnewspodcast
@lighteningnewspodcast 2 жыл бұрын
well, many programmers using lib that they don't understand at all, so...
@pixegami
@pixegami 2 жыл бұрын
The main arguments I've heard were that it makes you a worse coder, or there could be license violations in your code. You also grant GitHib (Microsoft) access to your source code, which is a major privacy concern - especially if you have trade secrets in the code. All seem fair concerns, although not as convincing in smaller projects, start-up environments, and individual learning/development.
@innocentiuslacrim2290
@innocentiuslacrim2290 Жыл бұрын
I would argue that something like this is great for beginner programmers as they often tend to be stuck behind syntax issues and get discouraged from continuing prigramming. This can help them pass that hurdle and to continue learning.
@annacheng2415
@annacheng2415 Жыл бұрын
It's very useful tools for me, I am a student of someone University, It really give me many greate recommend which will enhance my programing skill.
@davidm2.johnston684
@davidm2.johnston684 Жыл бұрын
Thanks for the demo!
@pixegami
@pixegami Жыл бұрын
You're welcome!
@davidm2.johnston684
@davidm2.johnston684 Жыл бұрын
@@pixegami Sure man! Actually I just got a subscription as a result, and I'm trying it right now. One thing it doesn't really support is tweaking an existing code base, as it can write additional code but can't modify existing code. Or maybe there's a trick to get it to do that, that I haven't figured out yet (such as marking the old code as deprecated and suggesting in a comment that you're rewriting said code). Or maybe that's a feature they may add later on. Well, I'll see if it feels like a 25% speedup in the weeks to come ^^ but like you said, even lower than that would still be pretty cool
@ph3086
@ph3086 2 жыл бұрын
Thanks for the video! Bit of irrelevant quastion: Which vs code theme are you using?
@pixegami
@pixegami Жыл бұрын
Thank you! I used Monokai Pro in VSCode. I also sometimes use "Nord".
@LucijaC
@LucijaC Жыл бұрын
Thanks for the great intro video! What VSCode theme do you use, it is pretty neat?
@pixegami
@pixegami Жыл бұрын
I use “Monokai Pro” 😁
@nkristianschmidt
@nkristianschmidt Жыл бұрын
It's a good trade-off, to have time for design and strategy
@pixegami
@pixegami Жыл бұрын
Exactly - less time spent on boiler-plate work, and more time for interesting and creative work.
@ArchanaRaghupathy
@ArchanaRaghupathy 2 жыл бұрын
I think it should be part of development as more time is spent in trivial tasks
@pixegami
@pixegami 2 жыл бұрын
I agree... It's good for learning new languages and frameworks too.
@jimmysaxblack
@jimmysaxblack Жыл бұрын
thanks !!!
@pixegami
@pixegami Жыл бұрын
No worries!
@simonmescal9136
@simonmescal9136 2 жыл бұрын
This is a very good video indeed. Thanks
@pixegami
@pixegami 2 жыл бұрын
Glad you enjoyed it!
@WhiteSiroi
@WhiteSiroi Жыл бұрын
thank you so much, very useful tut
@pixegami
@pixegami Жыл бұрын
Glad it was helpful!
@MrReaouz
@MrReaouz Жыл бұрын
2:44 wdym by tapping through them?
@pixegami
@pixegami Жыл бұрын
GitHub Copilot generates multiple suggestions, and there are hotkeys you can use to tap (cycle) between them: docs.github.com/en/copilot/configuring-github-copilot/configuring-github-copilot-in-visual-studio-code#keyboard-shortcuts-for-github-copilot
@cloudzero2expert
@cloudzero2expert Жыл бұрын
Thank for the video. It was funny to hear "let's do a real problem, leetcode", kk.
@pixegami
@pixegami Жыл бұрын
😂 Now that you mention it, it is pretty ridiculous...
@hedgefund996
@hedgefund996 Жыл бұрын
Awesome Content, Thanks
@pixegami
@pixegami Жыл бұрын
Glad you liked it!
@JT-zl8yp
@JT-zl8yp 2 жыл бұрын
Thanks for making this video.....Do you use github copilot at your work ?
@pixegami
@pixegami 2 жыл бұрын
I work at a Microsoft competitor, so GitHub Copilot isn't a fit for my work. But I do enjoy it for personal projects!
@JT-zl8yp
@JT-zl8yp 2 жыл бұрын
@@pixegami Cool....keep making more videos with copilot
@boomerangfish3558
@boomerangfish3558 Жыл бұрын
Pretty great video
@rasfuranku
@rasfuranku Жыл бұрын
Insightful!
@codecaine
@codecaine 2 жыл бұрын
Excellent review
@pixegami
@pixegami 2 жыл бұрын
Thank you! Cheers!
@epicflails5471
@epicflails5471 Жыл бұрын
whats the music used in the video? Great video btw
@pixegami
@pixegami Жыл бұрын
Thanks! I don't remember which track I used for this (I'll remember to note it down for my future videos), but it was something from artlist.io/royalty-free-music
@Pinefenario
@Pinefenario Жыл бұрын
Good video about copilot! But shouldn’t you blur the api key?
@pixegami
@pixegami Жыл бұрын
Yup! In this case I believe that API key was public and free - but even then, it's probably a good idea to blur it. In additional I also delete and rotate every API key I use during video recordings.
@ValeriiTodua
@ValeriiTodua Жыл бұрын
Can you tell me what theme do you use in vscode ?
@pixegami
@pixegami Жыл бұрын
I'm using monokai.pro/
@maryam4071
@maryam4071 9 ай бұрын
How are you are highlighting it? with what shortcut key? I am not able to see inline suggestion on windows
@pixegami
@pixegami 9 ай бұрын
Hmm, when I use it normally, I don't really press anything beyond Tab or Escape. But here's a list of all the shortcut keys for different OS: docs.github.com/en/copilot/configuring-github-copilot/configuring-github-copilot-in-your-environment
@immortalsun
@immortalsun Жыл бұрын
This is pretty interesting, but I have encountered a problem where it stops suggesting past quotation marks.
@weirdmaninshirt
@weirdmaninshirt Жыл бұрын
First week in and I'm not a fan. It can make simple functions sure, but once you are writing something more complex it just starts suggesting I call functions that don't exist on the specific type. very type unaware in Typescript. Noticed similar problems in C++. My main issue is once it suggests some trash it disables the regular autocomplete on VSC, so it just slows me down. Not giving up on it yet, but I'm very sceptical it will get better.
@pixegami
@pixegami Жыл бұрын
I've run into that issue with it disabling the regular autocomplete too (which in some cases is what I need). I think there needs to be an easy way (or a hotkey) to switch it off somehow. It's most useful if you need to do something small in a domain you're unfamiliar with - e.g. a specific regex expression. Or when you have tedious (but simple) code that needs filling out.
@Liquidduck
@Liquidduck Жыл бұрын
I have no idea what I am talking about but do you think that it used names with the letter J as that is the 10th letter in the alphabet and you mentioned 10 in your prompt.
@pixegami
@pixegami Жыл бұрын
I don't think so, I think it's mostly because the first example name I used started with "J" and it tried to repeat that pattern.
@jobsnike3776
@jobsnike3776 Жыл бұрын
whether github copilot upload my db password of properties?
@pixegami
@pixegami Жыл бұрын
Copilot can see all of your code-base. It's unlikely secret data would get leaked because that would be the end of Copilot. But it's probably good to secure all your secret data even from Copilot anyway (e.g. with environment variables or using a secret manager) and limiting the damage that exposed API keys and passwords can do from the backend. You don't have to be paranoid about it, but do be prepared just in case.
@BilgeSoyer
@BilgeSoyer Жыл бұрын
how do you add py files to azure?
@patrick1532
@patrick1532 2 жыл бұрын
I'm going to try it because it's free with my student account but considering the first suggestion it made in this video was to use a redundant list comprehension that could just be list(range(100)) I am going to be very careful
@pixegami
@pixegami 2 жыл бұрын
Try it out! I especially recommend using it on a project where you are using a new framework or a new language. As with any tool, it is always good to be careful and critical about how you use it, and Co-Pilot is no different. However, I think your premise about its suggestion being 'redundant' is misguided. 1. If you already have code precedent in your file that prefers "list(range(...))", then it will probably learn that and suggest it. 2. If you have no style precedent set, it will suggest what it thinks is the most "common" way to solve the problem. What is suggests is a reflection of what the developer community has applied in practice - and even if it's sub-optimal, there is value in conventionality (especially if you work in a team). 3. Both list(range(...)) and list comprehension solve the problem. Choosing one over the other is an optimization matter, but optimization was never one of Co-Pilot's value propositions. On the criteria of solving the problem and saving developer time, it still delivers.
@patrick1532
@patrick1532 2 жыл бұрын
@@pixegami Thanks for the reply, I appreciate the well thought out response! I hadn't thought about it that way, I suppose list(range()) may actually be more ambiguous than the comprehension to someone not super familiar with python, and less natural to someone coming from another language. I'm no expert but I have enough experience with python that I had difficulty seeing that utility.
@karrde666666
@karrde666666 Жыл бұрын
Obsolete now that chat gpt can do english to entire pages of code?
@Alex-kr7zr
@Alex-kr7zr Жыл бұрын
Another concern that absolutely should mention is legal concerns. Github Copilot was trained on open source software with various licenses, a lot of them state that you at least need to give attribution to the author. So basically you might use illegal code in your software. Lawsuits are already running. Wouldn't use the co-pilot generated code in any business setup for that reason, maybe as smart documentation tool, but not for generating production code.
@pixegami
@pixegami Жыл бұрын
You're right about that being a concern and I definitely should have mentioned it. I wasn't aware of the class action against OpenAI at the time of making the video. I'm eager to see how the lawsuit settles. But if OpenAI and Microsoft win, I struggle to see how future plantiffs will prove (or even discover) cases of "stolen code" unless it is both public and verbatim.
@Alex-kr7zr
@Alex-kr7zr Жыл бұрын
@@pixegami Yes, you are right, it's probably hard to prove that you have been using copilot in closed source software. Even in open source software it's hard unless it copies pieces 1:1, but it most likely only does that for very simple solutions, so that could also come from the docs of the API for example. I'm still curious about the outcome of the lawsuit. I'm pretty sure that the field of AI will become a lot more regulated in the future. GitHub/M$ has already responded by adding a feature to deactivate suggestions which contain public code pieces, most likely other AI assistants will have a similar feature soon. Also, we might see OSS licenses covering AI at some point. Maybe a GPLv4 or something like AGPL, but for AI.
@pixegami
@pixegami Жыл бұрын
Yup, I reckon they’re be some back and forth but things will eventually find a sensible middle ground.
@BlackTigerAP
@BlackTigerAP Жыл бұрын
Please remind me something... Why exactly should I "code faster"? I'm paid for result, not for how quickly I type.
@tranthanhbao9978
@tranthanhbao9978 Жыл бұрын
what theme you are using
@pixegami
@pixegami Жыл бұрын
monokai.pro/
@jtvalente
@jtvalente 2 жыл бұрын
How does this differ to chatgpt?
@pixegami
@pixegami Жыл бұрын
Good question. I just had a look at ChatGPT and made a first look video here: kzbin.info/www/bejne/e3jChqSkgrtqjc0 In short, I think CoPilot is better for me. ChatGPT is good at the first (general) phase of a project, or for debugging. But CoPilot works better once the project gets going.
@JokerPW84
@JokerPW84 Жыл бұрын
As far as I know (and I might be wrong at it), ChatGPT was trained using human text, while CoPilot was trained using code samples from GitHub. So, it should be a more specialized tool. =]
@kck001
@kck001 Жыл бұрын
Can support Traditional Chinese language or not?
@joelboardgamerpger5393
@joelboardgamerpger5393 Жыл бұрын
what is if ___name__ == '__main__'?
@pixegami
@pixegami Жыл бұрын
So I did a search on Google and the definition that came up was: "A Python programme uses the condition if __name__ == '__main__' to only run the code inside the if statement when the program is run directly by the Python interpreter. " But that's a bit of a technical explanation. So to explain it in my own words-you use it so say "only run this code if I'm running THIS file directly." Anything *outside* that condition is actually run whenever the file is loaded (e.g. if you wanna import it into another file), so if you DON'T want stuff to run there, but only when you directly run that program, that's when you use the condition.
@MyBrianBailey
@MyBrianBailey Жыл бұрын
you have to REALLY REALLY want to make a Tetris game even with copilot lol lot's of patience to create that game
@艾伯纳
@艾伯纳 2 жыл бұрын
😮
@michaeltse321
@michaeltse321 Жыл бұрын
My bposs saw this video and offered me a 25% pay cut - lol
@pixegami
@pixegami Жыл бұрын
Unacceptable! They should've offered you 25% pay increase since that's how much more productive you'll become.
@nadzhafox
@nadzhafox Жыл бұрын
For my ticktok brain where long introduction
@thechessmaster9291
@thechessmaster9291 10 ай бұрын
Copilot presented you with a full code ... , why do you want to invent the wheel again ????? wtf .....
@pixegami
@pixegami 9 ай бұрын
Not quite sure what you mean here...
@lookingjust987654321
@lookingjust987654321 Жыл бұрын
Colleague of mine suggested using it to write tests. Amazing use of copilot
@pixegami
@pixegami Жыл бұрын
Yes! I've been using it to write a few tests and it's pretty good at predicting my intent and saving time.
The all NEW GitHub Copilot Experience
13:46
Visual Studio Code
Рет қаралды 81 М.
Thank you Santa
00:13
Nadir Show
Рет қаралды 52 МЛН
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 25 МЛН
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 9 МЛН
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 7 МЛН
GitHub Copilot in VSCode: Top 10 Features Explained
8:44
Max Rohowsky (Max on Tech)
Рет қаралды 117 М.
Prompting with Copilot
14:06
Visual Studio Code
Рет қаралды 91 М.
15 POWERFUL Python Libraries You Should Be Using
22:31
ArjanCodes
Рет қаралды 60 М.
I Tried Every AI Coding Assistant
24:50
Conner Ardman
Рет қаралды 859 М.
CoPilot Review: My Thoughts After 6 Months
9:45
ThePrimeagen
Рет қаралды 557 М.
Helping GitHub Copilot help you with prompt crafting
17:34
How to Use GitHub Copilot for Data Science (Python + VS Code)
11:59
Dave Ebbelaar
Рет қаралды 20 М.
Github Copilot vs. ChatGPT: Which one should you use, and when?
26:34
Doing It With A.I.
Рет қаралды 37 М.
Apache KAFKA Tutorial | KAFKA Crash Course | Spring Boot
56:49
Daily Code Buffer
Рет қаралды 97 М.
Master the core principles of prompt engineering with GitHub Copilot
6:08
Visual Studio Code
Рет қаралды 56 М.
Thank you Santa
00:13
Nadir Show
Рет қаралды 52 МЛН