Skip to content

CI: enforce python 3.6+ with vermin

Oliver Smith requested to merge vermin into master

Make sure that features requiring a higher python version don't sneak in by accident.

It would be nice to add this to test/static_code_analysis.sh, so it is easy to run it locally. But vermin is not packaged in Alpine right now, and given that this should be a rather rarer error, it doesn't seem worth the effort right now.

Run silently by default and only in verbose mode if there are errors, because if vermin isn't silent, it will not just point out errors, but describe required python versions for everything it sees. (Copied that part from the bpo CI script, where I had used it as pre-commit hook as it was stuck on 3.5 for some time.)


EDIT: proof that it works (checking for python 3.5+, although we have 3.6+):

https://gitlab.com/postmarketOS/pmbootstrap/-/jobs/894688481

At the end:

Minimum required versions: 3.6
Incompatible versions:     2
Target versions not met:   3.5-

Searching for 3.6 reveals that this particular version is needed because we use f-strings:

!2, 3.6      /builds/postmarketOS/pmbootstrap/pmb/aportgen/busybox_static.py
  `with` requires 2.5, 3.0
  f-strings requires !2, 3.6
!2, 3.6      /builds/postmarketOS/pmbootstrap/pmb/aportgen/core.py
  'logging' module requires 2.3, 3.0
  `with` requires 2.5, 3.0
  f-strings requires !2, 3.6
!2, 3.6      /builds/postmarketOS/pmbootstrap/pmb/aportgen/device.py
  'logging' module requires 2.3, 3.0
  `with` requires 2.5, 3.0
  f-strings requires !2, 3.6
Edited by Oliver Smith

Merge request reports