the do_mpc library in python contains much of the functionality to implement Model-predictive Control in python. There are other open source repositories which implement MPC using only numpy.

CasADi is a symbolic framework used to implement nonlinear optimal control algorithms.