The main source for a tic-tac-toe game for my application to the Recurse Center. I have some tests, uploaded in a second gist.
The code assumes a directory structure of repo/ttt/<these files>, and can be run with python -m ttt.
Some unit tests at https://gist.github.com/kunalb/51cf93418c72cc55a16f3804948f3583