Grammatical theory: From transformational grammar to constraint-based approaches. Second revised and extended edition -- Stefan Müller
The code for this book is found at https://github.com/langsci/25, which is also where the first version is hosted.