The prompt_toolkit (core library) which is the basis for pyvim (same author), is well structured and modular. https://github.com/jonathanslenders/python-prompt-toolkit
There are plenty of examples in the repo that cover most of the features in the library. The awesome thing is all of the examples fit in a single page, a testament to the power and simplicity of the library.
I built pgcli (https://github.com/dbcli/pgcli) almost entirely by reading the examples.