I’ve written before about Python Packaging and pre-commit which I’m a big fan of. Today I discovered a really useful tool for checking your packaging configuration and pre-commit configuration from the Scientific Python Development Guide.
This development guide is really well written and has Tutorials and Topical Guides that cover package development, style guides, type checking and tests amongst other things.
Repo Review
Of particular use is the Repo-Review - Scientific Python Development Guide which will automatically check a GitHub hosted repository against the Scientific Python development guidelines and make recommendations where improvements can be made to the package configuration and pre-commit configuration.
Having tested it against AFM-SPM/TopoStats main branch there are a lot of useful and simple recommendations made.
More Pre-Commit hooks
More pre-commit hooks is only a good thing in my view, they don’t take that long to run against most reasonably sized repositories, particularly if ruff is used in favour of more traditional tools such as flake8
and isort
.
There are a few pre-commit hooks that I wasn’t aware of and will be adding to my projects such as..,
- Check-manifest that verifies you have working SDist (source) packages.
- Codespell for checking the spelling used in code.
- validate-pyproject for validating
pyproject.toml
.
Conclusion
If you are involved in Python package development of any sort give your repository a review and see what recommendations are suggested. You may not agree with all of the recommendations but the vast majority of tools are highly configurable so you can disable the checks you don’t want applied. It won’t do any harm.
Now I just need to find time to apply MyPy.
Reuse
Citation
@online{shephard2023,
author = {Shephard, Neil},
title = {Repository {Review} with {Scientific} {Python}},
date = {2023-11-17},
url = {https://blog.nshephard.dev/posts/repository-review/},
langid = {en}
}