Add pypy3 to the build matrix

Rebased #2168 on to develop and fixed merge conflicts.