piio by Schelte Bron is a library for accessing a couple of the I/O possibilities of the Raspberry Pi. The library supports both gpio and i2c .