The present invention provides compounds of formula I: or a pharmaceutically acceptable salt thereof. Compounds of formula I are inhibitors of Janus kinases and as such are useful for the treatment of various diseases and conditions mediated by said enzymes, such as rheumatoid arthritis, asthma, COPD, ALS, and the like.