Home / Some Experiments with GitHub Copilot

Some Experiments with GitHub Copilot

4 min read
fairly easy
I recently got my hands the GitHub Copilot extension for VS Code and it's amazing (borderline scary). Let's look at a few cases
I recently got my hands the GitHub Copilot extension for VS Code and it's amazing (borderline scary)

The examples below are in Python

Function to get Pokemon Data

Was able to auto-complete my comment as well. Initially I never intended to save it to a json file.

Added some in-line code comments

Used an external library (requests) to make a request. Used Json to save the data.

Chose a decent file name on its own

Was able to find a data source, surprisingly someone's github repo

Function to zip and unzip a file

Was able to import all the necessary libraries. Although it did import shutil and never used it.

Used zipfile library to unzip/zip

For the second function, it didn't import the zipfile liibrary.

Was able to use the right parameters

Building a tictactoe game

Generated 64 lines of code

Was able to write functions for various purposes

Knew the winning combinations of a tictactoe board

Added Error Handling

Added print statements and ability to take input from the user

Logic to check the result of the game

Although it wrote all the sub-functions, it never invoked them to actually build a playable game

Crypto Price

Added a parameter

Used a crypto api to get the data

Was able to return the correct column for the price

Build a streamlit app to display Github Repos

For this, I had to write multiple comments and it actually felt like I was pair-programming with the Copilot. However, most of the code was generated by Copilot.

Was able to get data from github api

Since I mentioned popular, it sorted the repos based on 'stars'. It is mind-boggling how it was able to relate 'stars' to popularity.

It was able to use an external library streamlit (streamlit is used to build web apps)

It also added a title and…
Read full article