This package is a companion tool for exploring dynamics, control, and machine learning for the canonical cart-and-pendulum system.It includes a software simulation of the cart-and-pendulum system, a visualizer tool to create animations of the simulated system, and sample implementations for controllers and state estimators.The user can use any platform or the browser to run the pendsim Python package.It gives the user a plug-and-play sandbox to design and analyze controllers for the inverted pendulum, and is compatible with Python's rich landscape of third-party scientific programming and machine learning libraries.The package is useful for a wide range of curricula, from introductory mechanics to graduate-level control theory.The inverted pendulum is a canonical example in control theory (See, e.g.(Aström & Murray, 2008)).A set of example notebooks provide a starting point for introductory and graduate-level topics.