Gitchat: A Hackable Python App That Teaches Kids How to Use Git

One of the challenges of teaching elementary school kids how to program is trying to back up their code so that they can work on it across sessions. Laptops often get rebuilt or need to be replaced for one reason or another.

The obvious solution is to teach the kids how to use Github. Most kids, however, do not have the patience to navigate the command line, let alone learn git.

We have made a couple of unsuccessful attempts to teach children how to use git but it was a lot of effort for something they did not see any value in and so they soon forgot everything they had learnt. They need something tangible to reward their effort.

Gitchat was designed to help them see the fruits of their effort immediately after using git. 

Gitchat is an asynchronous group chat application. You have to push messages to Github in order to send messages to others and pull messages down from Github to receive messages from others.

It is written in Python and was designed to be run on a Raspberry Pi. It has been tested on MacOS and on Raspbian/PIXEL but it should work on any operating system that has Python installed along with a few Python packages. The prerequisites are  -

  • Python 2.7
    • pillow
    • watchdog
    • netifaces

If you are using Python 3 you'll probably need to tweak the code a bit to account for the changes (for example, you would import 'TKinter' in Python27 and 'tkinter' in Python3, amongst other things...)

To see Gitchat in action all you have to do is clone the Gitchat directory and create a directory called 'gitchat-messages' at the same level as the Gitchat app directory and start Then create a new text file in 'gitchat-messages' and write your name and a message, separated by a colon (:). For example -

nikhil:That is not egg on your face, that is the colonial yoke

You can also add an optional tag at the end, also separated by a colon, which adds color to your message. For example the following will highlight your name in pink -

nikhil:That is not egg on your face, that is the colonial yoke:pink

If you wish to change the directory that Gitchat is watching for new messages, you can  change it by passing it a difrectory name when running it or by editing line 99 of

self.path = sys.argv[1] if len(sys.argv) > 1 else "../gitchat-messages"

If you want to get on a group chat with others you will need to push the 'gitchat-messages' directory to Github as a repo and invite others to clone it. Everyone that is participating in the chat will need write-access to the 'gitchat-messages' directory (or you could create a separate Github account and share the password with everyone that would like to participate in the group chat. 

Make sure that everyone is using separate files to chat. Even with separate text files, everyone will run into merge conflicts as they push their files to Github. So not only will everyone learn how to use standard git commands but they will also learn the basics of resolving merge conflicts - most of which involve saving a file in a terminal editor app such as vi

The skills required to use this app are -

To further entice young students to Gitchat, there is a second tab that allows them to send commands to Minecraft. This feature was designed for the Raspberry Pi but it can be made to work on any machine that has a Minecraft server that supports the RaspberryJuice plugin.

Once students are familiar with git and Github, they can then graduate to hacking Gitchat - they can add new emojis (even ones designed by them), they can add colors and they can add and remove Minecraft features. More importantly, they will learn how to fork a branch, switch between branches to try each other's code and learn to merge changes with each other.

Gitchat as well as instructions on how to use it are available on Github.

Although most of the code in Gitchat is fairly self-evident, I intend to provide instructions on how to hack it in future posts. 

Leave a comment