blog Scripting Python Project Checks

Tags:
packaging python

Django has a System check framework that is useful for doing automatic checks. I wanted something similar that I could use as I update some PyPI projects . Thanks to asking a question on Mastodon , I was introduced to Scientific Python’s repo-review tool.

repo-review was developed by the Scientific Python community to help with best practices against their many repos. Using repo-review they have bundled all of their checks into a sp-repo-review project that can easily be run on a project.

uvx sp-repo-review[cli] <path to repository>

Checks are fairly simple to write, and there are a lot of good examples in the upstream repo.

https://github.com/scientific-python/cookie/tree/2025.11.21/src/sp_repo_review/checks

Writing my own tests.

Most of the documentation repo-review is very good, and answers a lot of questions.

https://repo-review.readthedocs.io/en/latest/

I started by copying a few tests from the upstream repo that I wanted to use.

https://codeberg.org/kfdm/readiness/src/tag/v0.1.0/src/readiness/checks/borrowed.py

I wrote a few checks for classifiers

https://codeberg.org/kfdm/readiness/src/tag/v0.1.0/src/readiness/checks/classifiers.py

These work well with my recent add-url and add-classifiers projects. If any of my checks fail, I have the commands listed that I can immediately run with uvx to fix the error.

As I move away from GitHub, I also started a list of checks to avoid.

https://codeberg.org/kfdm/readiness/src/tag/v0.1.0/src/readiness/checks/avoid.py

I will be able to add to these as I migrate my projects over.

Future plans

Similar to sp-repo-review, several of my checks are likely unique to my specific repo, so there is less value in uploading to PyPI. If there are some more generic ones though, I could split them out to their own package to upload.

Right now I am also using the default repo-review command to check my repos.

[project.scripts]
pypi-check = "repo_review.__main__:main"

In the future, I may write my own main() to customize the command line arguments a bit, but otherwise things are working very well.

Also curious about writing a check for https://endoflife.date .

A minor missing feature that would be nice, but is not a deal breaker, is something like ruff check --fix where simple failures could be automatically fixed.