As we moved Wikimedia CI Quibble containers from Bullseye to Bookworm (T362705), we no more need to retain compatibility with Python 3.9 and can bump the requirement to Python 3.11. We can thus modernize the code base a bit and benefit from newer features.
(maybe look at Python 3.8 features as well?)
Python 3.9
https://docs.python.org/3.10/whatsnew/3.9.html
Python 3.10
https://docs.python.org/3.10/whatsnew/3.10.html
- Parenthesized context managers : https://gerrit.wikimedia.org/r/c/integration/quibble/+/1334902
- Structural Pattern Matching, could replace bunch of if/elif/elif if we have any?
glob() learned root_dir, let us drop a path.join(there is a single glob in a test, not worth the complexity)
Python 3.11
https://docs.python.org/3.11/whatsnew/3.11.html
- PEP 678 – Enriching Exceptions with Notes, could be used on subprocess exceptions raised from commands to indicate the human friendly name and maybe highlight in the console the step that has failed.