Google Summer of Code NumFOCUS PyBaMM

Blogs Project page on the Google Summer of Code website Proposal on Google Docs

View my Twitter profile View my GitHub profile View my LinkedIn profile

This page serves as a permalink to the final report that provides details of Arjun Vermaโ€™s project in the Google Summer of Code 2023 programme.

๐Ÿ“– TL;DR

A summary of some of the tasks I achieved throughout the community bonding and the coding periods is given below.

  • Migration of testing infrastructure from tox to nox
  • Various improvements to existing infrastructure & Segregate optional dependencies
  • Add or replace several pre-commit hooks to auto format the code
  • Dockerize PyBaMM
  • Significant Improvements to documentation including simplifying the installation instructions

๐Ÿ”‹ About PyBaMM

PyBaMM is an open-source Python package for the mathematical modelling of batteries and running fast, flexible, and accurate simulations for myriads of battery models. Its mission is to accelerate battery modelling research by providing open-source tools for multi-institutional, interdisciplinary collaboration; it is fiscally sponsored by NumFOCUS and The Faraday Institution in the U.K. The use of the software in academia and industry has been prolific since its inceptionโ€”it has been used at a multitude of universities, research institutions, and commercial research labs in collaborative settings.

๐Ÿ“„ Project abstract

The primary focus of this project was to streamline the installation process of PyBaMM by containerizing it with Docker, simplifying the setup from source code. Additionally, the testing framework transitioned from tox to nox. An essential aspect of the project involved introducing optional dependencies for PyBaMM, allowing users to have customized and lightweight versions of PyBaMM tailored for specific tasks or use cases.

๐Ÿš€ Motivation

The core motivation behind this project was to streamline the installation process by offering a simplified approach to installing from source. This involved providing a one-command installation that includes a pre-configured development environment with the desired solvers already installed.Furthermore, the project aimed to create a lightweight version of PyBaMM, which includes only the essential dependencies necessary for specific tasks.

๐Ÿ€ Benefits to the community

This project offers a range of significant advantages aimed at enhancing the user experience and improving the development process. By containerizing PyBaMM and simplifying its installation through Docker, it provides a streamlined one-command setup that reduces complexity and setup time. The transition to Docker also ensures consistent environments across different systems, reducing potential compatibility issues. The inclusion of a PyBaMM Lite version with essential dependencies allows users to create lightweight configurations tailored to specific tasks, optimizing resource usage. These improvements collectively contribute to a more accessible, user-friendly installation process, fostering user engagement, enabling faster contributions, and advancing the PyBaMM ecosystem.

๐Ÿง‘โ€๐Ÿ’ป Work done

The first major accomplishment was the migration of the testing infrastructure from tox to nox. This transition brought about enhanced testing capabilities, improved efficiency, and greater reliability in assessing PyBaMM’s codebase. The adoption of nox as the testing framework further contributed to a more robust development process.

In addition to testing improvements, the project introduced the concept of optional dependencies. This feature allows users to tailor their PyBaMM environment by selecting specific dependencies based on their requirements. This approach empowers users to create lightweight and specialized versions of PyBaMM that cater to their specific use cases, promoting efficient and resource-conscious development.

To ensure code quality and adherence to best practices, the project added more pre-commit hooks. These hooks automate code formatting, linting, and other checks, thereby enhancing the code review process and maintaining consistent coding standards throughout the development lifecycle.

One of the key achievements was the Dockerization of PyBaMM. By containerizing PyBaMM using Docker, the project simplified the installation process, making it easier for users to set up and deploy PyBaMM in various environments. This containerization approach eliminates potential installation hurdles and provides a consistent environment for users.

Lastly, the project successfully pushed PyBaMM Docker images to Docker Hub. This step not only showcases the project’s commitment to accessibility but also makes it convenient for users to access and deploy PyBaMM Docker images from a centralized repository.

๐Ÿ“‘ A list of issues opened and pull requests submitted

This list contains issues and pull requests that are both specific to and not specific to my project: they contain infrastructure improvements, documentation improvements, general bug fixes, and enhancements.

๐Ÿ› ๏ธ Issues

๐Ÿ‘ท Pull requests

๐Ÿ”ฎ Future work

  • Automated Docker Image Builds and DockerHub Integration: Develop an automated process for building PyBaMM Docker images and seamlessly pushing them to DockerHub using continuous integration (CI) pipelines. This enhancement will ensure that up-to-date PyBaMM images are readily available for deployment and usage by the community.

  • Contribution to Nightly Release Infrastructure: Further contribute to the implementation of nightly builds and releases on a custom PyPI index. Collaborate on versioning strategies, improve wheel-building infrastructure, and facilitate the smooth upload of nightly builds to the third-party PyPI index.

  • Exploration of Migration to pyproject.toml: Investigate the feasibility and benefits of migrating PyBaMM’s packaging configuration from to the modern pyproject.toml format. This transition could involve leveraging new build-backends like meson-py or scikit-build to enhance packaging compatibility and maintainability.


I extend my heartfelt gratitude to the Google Summer of Code program, NumFOCUS, and the entire PyBaMM Team for providing me with a remarkable and enriching experience during this productive summer. This journey marked my first significant contribution to the development and maintenance of open-source scientific software on such a significant scale. The learnings I acquired throughout this process have been invaluable.

I am deeply honored to have had the privilege of being mentored by the esteemed PyBaMM Steering Council members, Ferran Brosa Planella and Saransh Chopra. Their guidance and unwavering support not only in technical matters but also in fostering a positive and collaborative environment have been truly uplifting.

I wish to express my sincere appreciation to Valentin Sulzer and Robert Timms for their invaluable reviews and guidance throughout various stages of my contributions to PyBaMM. The collective effort of the PyBaMM team, their insights, and collaborative spirit have been the driving force behind the accomplishments achieved during this project.

I also had the pleasure of collaborating with Agriya, my fellow student at GSoC. Our interactions during discussions on issues and pull requests exemplified the essence of open-source collaboration.

๐Ÿ”ญ References