DEV Community

Agriya Khetarpal
Agriya Khetarpal

Posted on

GSoC 2023 @ PyBaMM, NumFOCUS: Weeks 1 and 2

Hi there! This is the second blog in a series of seven blogs that document my journey of my Google Summer of Code project under the NumFOCUS umbrella organisation where I aim to improve the documentation infrastructure for PyBaMM, a Python package for working with physics-based battery models.


A summary of the tasks I completed

  1. Use Lychee to check for broken links (#3)
  2. Add pre-commit support (#4)
  3. Improvements to pre-commit (#5)
  4. Netlify deployment infrastructure (#8)
  5. Add news pages from PyBaMM blogspot (#10)
  6. Custom PyBaMM 404 page (#12)
  7. Favicon for PyBaMM (#14)
  8. Donations and sponsors (#16)
  9. Twitter feed, institutional partners, and about PyBaMM (#19)

I have started a summary issue to keep track of my progress, which I will be editing on a regular basis. Please feel free to suggest an improvement in the summary issue thread and I will be glad to look into it!

Building blocks: the initial infrastructure for the new pybamm.org website

We started the project by creating a repository for the website in the pybamm-team organisation. To set up the website itself, we planned to use the Scientific Python Hugo theme; also used by NumPy and SciPy, and by some other Python projects in the Scientific Python community.

To host the website, we preferred Netlify to GitHub Pages owing to the fact that it would be easier to see collaborative previews on changes made via pull requests. The development version of the website can be accessed at https://pybamm-developer-preview.netlify.app/. Please feel free to open an issue if you see something broken!

A screengrab of the PyBaMM website

The war against broken links: validating and checking them with a workflow

I also added my favourite link checker (Lychee in a GitHub Action to check for broken links and. It is incredibly fast and written in Rust β€” which is also the reason it is one of my favourites! It also serves as a personal reminder to learn Rust some day. The workflow currently runs as a CRON job at 0300 hours UTC scheduled daily. The link checker also has features such as excluding selected links or status codes, adding user agents, and an option to enable caching.

pre-commit hooks are cool!

I added pre-commit hooks for developers to use, such as ruffβ€”an extremely fast Python linter written in Rust, black as an autoformatter, codespell to fix common spelling errors and some other pre-commit hooks to remove trailing whitespaces and lint Markdown files. This way, developers working on the website locally can run

pre-commit install
pre-commit run --all-files
Enter fullscreen mode Exit fullscreen mode

to fix all the files with the pre-commit hooks before committing, or let git do it for them.

In addition, we enabled support for the pre-commit.ci bot to automatically perform these operations wherever possible on pull requests and commits.

For every piece of art, there is another that does it better

I ported over many pages and items from the previous PyBaMM website, redesigning and editing them as neccessary:

  1. The Donations page for enlisting sponsorships and ways to contribute PyBaMM fiscally
  2. Blogs by the PyBaMM team, in a newsroom page (https://pybamm.org/news/)
  3. A custom 404 page
  4. A favicon for the website, which is essentially the PyBaMM logo
  5. A Twitter feed for PyBaMM, and
  6. The home page and other pages, which contain training material and institutional partners

Tasks to focus on in the coming weeks

  1. Improving the structure for the newly-set-up PyBaMM website and reordering certain pages
  2. Adding over the remaining pages, and
  3. Making sure the website adheres to the W3C Web Content Accessibility Guidelines specification

Stay tuned

I will be posting these blogs fortnightly as a part of my GSoC project. Thoughts, comments, constructive criticism, and insights will be greatly appreciated. See you soon on the next one! For updates, please follow me on my social media handles:

Top comments (0)