The modelling of long time-scale solid-Earth processes presents challenges on many fronts.Typically a large range of length scales must be resolved, and computational requirements can easily go beyond a desktop machine’s capability, even in 2-dimensions. Rheological behaviours are diverse and modellers often wish to investigate a spectrum of dynamics. With this also comes the requirement of robust solution strategies capable of capturing a system of large dynamic range. Time dependent aspects of a model also require careful consideration such that numerical artefacts do not subsume the required signal.Underworld2is a Python API which seeks to meet these challenges, while also providing a friendly and intuitive interface to model development.Designed to work (almost) seamlessly across PC, cloud and HPC infrastructure,Underworld2consists of a set of Python classes, instances of which will be used to construct numerical geodynamics models. The API also provides the tools required for inline analysis and data management.Underworld2continues the legacy of Underworld1 (Moresi, Dufour, & Mühlhaus,2002, 2003; Moresi et al., 2007), sharing much of the underlying mathematical approach. ButUnderworld2is not a Python wrapper to Underworld1, and modelling paradigms have been completely redesigned to best fit the Python language.Underworld2provides capacity for modelling 2- and 3-dimensional geodynamics processes,utilising a particle-in-cell finite element approach for solving Stokes flow type configurations.For the multi-processor scalability required of high-resolution models, we use MPI (Message Passing Interface) based domain-decomposition, and for performant operation all heavy computations are executed within a statically typed layer. InUnderworld2, the finite element mesh can be static or dynamic, but it is not constrained to move in lock-step with the evolving geometry of the fluid. This hybrid approach allows for the accurate solution to the velocity problem (on the mesh) for a given material configuration, while simultaneously ensuring the accurate tracking of material interfaces and history information (using particle swarms). Templated systems are provided for solutions to Stokes flow, steady state heat (or Darcy) flow,and time-dependent advection-diffusion models. A primary aim ofUnderworld2is to enable rapid and frictionless model development. To this end, the rich syntactic possibilities of Python have been leveraged empowering users with intuitive access to complex operations, while paternalistic patterns help to guarantee data integrity and ensure consistent parallel operation. By design,Underworld2provides only a minimal set of flexible core functionality, and leaves user domain concerns to the users themselves to construct. At the centre of this design is the Function class, which aims to provide a natural interface for the description of problem dynamics. For example, the user may describe a viscosity which is piecewise constant, temperature dependent, or visco-elasto-plastic in behaviour. Simulation chronology is also fully exposed and the user is expected to explicitly specify when events should occur. This free-form approach allows users to define exactly the physics they require, and more importantly provides transparency. Although not a requirement,Underworld2is very much at home within the Jupyter (Kluyver et al., 2016) environment. When coupled with theLavaVu (Kaluza, Moresi, Mansour, & Barnes, 2019) visualisation engine, users are able to interactively develop models piecemeal. Jupyter also provides a path to cloud amenability, with users accessing their model Notebooks via any standard web browser. Cloud based operation has been used successfully within teaching environments, and also enables our live user documentation and examples.Underworld2is utilised by the UWGeodynamics Python module (Beucher et al., 2019), which provides a more structured interface to geodynamics model construction. It has enabled numerous recent publications, including Beall & Moresi (2018), Mériaux, May, Mansour, Chen, & Kaluza (2018) and Sandiford & Moresi (2019).