PYSCF is a Python-based general-purpose electronic structure platform that both supports first-principles simulations of molecules and solids, as well as accelerates the development of new methodology and complex computational workflows. The present paper explains the design and philosophy behind PYSCF that enables it to meet these twin objectives. With several case studies, we show how users can easily implement their own methods using PYSCF as a development environment. We then summarize the capabilities of PYSCF for molecular and solid-state simulations. Finally, we describe the growing ecosystem of projects that use PYSCF across the domains of quantum chemistry, materials science, machine learning and quantum information science.