Slide 1

Slide 1 text

Revolutionize Your Python Development with GitHub Copilot: Tips, Tricks, and Best Practices Olayinka Atobiloye

Slide 2

Slide 2 text

How many percent of time does an average developer spend on writing repetitive code?

Slide 3

Slide 3 text

According to a 2023 survey by Stack Overflow, software developers spend an average of 22% of their time writing repetitive code.

Slide 4

Slide 4 text

Who am I? • Fourth year Computer Engineering student • Software Engineer • Technical Writer • GitHub Campus Expert • Passionate about diversity & inclusion in tech

Slide 5

Slide 5 text

What is GitHub Copilot? GitHub Copilot is an AI-powered code completion tool developed with OpenAI that can help you write code faster and with fewer errors. It works by analyzing the context of your code and providing suggestions for completing functions, generating documentation, and refactoring code. GitHub Copilot is still under development, but it has already become a popular tool for Python developers.

Slide 6

Slide 6 text

Why use GitHub Copilot for Python development? INCREASED PRODUCTIVITY IMPROVED CODE QUALITY REDUCED ERRORS: GITHUB FASTER DEVELOPMENT TIME MORE CREATIVITY AND INNOVATION

Slide 7

Slide 7 text

Installing GitHub Copilot To install GitHub Copilot, you will need to have a GitHub account and a compatible IDE. GitHub Copilot is currently supported by the following IDEs: • Visual Studio Code • Neovim • IntelliJ IDEA • JetBrains Rider • PyCharm

Slide 8

Slide 8 text

Integrating GitHub Copilot To install GitHub Copilot in Visual Studio Code, follow these steps: • Open Visual Studio Code and press Ctrl+Shift+P to open the Command Palette. • Type install extensions and select Install Extensions. • Search for GitHub Copilot and click Install. • To install GitHub Copilot in another IDE, please refer to the documentation for that IDE.

Slide 9

Slide 9 text

Basic usage of GitHub Copilot • To use GitHub Copilot, simply start typing code and Copilot will provide suggestions for completing your code. You can also use Copilot to generate documentation and refactor code.

Slide 10

Slide 10 text

To generate a suggestion, simply type a comment or function name and press Tab. GitHub Copilot will provide a suggestion based on the context of your code.

Slide 11

Slide 11 text

To accept a suggestion, simply press Enter. GitHub Copilot will insert the code into your file.

Slide 12

Slide 12 text

To reject a suggestion, simply press Escape. GitHub Copilot will hide the suggestion.

Slide 13

Slide 13 text

You can also use GitHub Copilot to generate documentation and refactor code. To generate documentation, simply type a triple-slash comment (///) and press Enter. GitHub Copilot will generate documentation for the function or class that you are commenting.

Slide 14

Slide 14 text

To refactor code, simply type a comment with the word refactor in it and press Enter. GitHub Copilot will provide suggestions for refactoring your code.

Slide 15

Slide 15 text

Practical Tips for Using GitHub Copilot

Slide 16

Slide 16 text

Use descriptive comments to guide Copilot GitHub Copilot can better understand your code and provide more accurate suggestions if you use descriptive comments. For example, if you are writing a function to calculate the area of a triangle, you could write a comment like this:

Slide 17

Slide 17 text

Be specific with your code requests The more specific you are with your code requests, the better Copilot will be able to understand what you want and provide a helpful suggestion. For example, instead of saying "generate a function to calculate the area of a triangle", you could say "generate a function to calculate the area of a triangle given the base and height". This will help Copilot to generate a more accurate function that meets your needs.

Slide 18

Slide 18 text

Review and accept Copilot suggestions carefully Copilot is still under development, so it is important to review and accept its suggestions carefully. Don't just blindly accept everything that Copilot suggests. Take some time to review the code and make sure that it is correct and that it does what you want it to do.

Slide 19

Slide 19 text

Test your code thoroughly Once you have accepted a Copilot suggestion, it is important to test your code thoroughly to make sure that it is working correctly. Copilot is still under development, so it is possible that it could generate incorrect code. It is important to test your code thoroughly to avoid any problems.

Slide 20

Slide 20 text

Find me online at • Twitter (yinkaatobiloye) • LinkedIn (Olayinka Atobiloye)

Slide 21

Slide 21 text

Thank you