pyavrutils is a Python library that can build AVR and arduino code at runtime.