Why do you feel the need for a new CLI flag when there’s a one-line with -c that does what you’re after? And is there a reason that Python 3.10.3 can’t be used in the cache key?
I think the -c line detailed above involves some reinventing of the wheel and takes up quite a lot of characters (62). It would be nice for a CI pipeline file (usually YAML, which may already be quite indented) to keep the command’s length under 30 chars.
To address your other question, Python 3.10.3 also works fine! We can see the pre-commit docs use python --version --version to generate the key, which is probably more robust.
I think it would be convenient to enable acquisition of the semantic version with a CLI trick, but it is not required by any means.
There may be other uses for the semantic version being easily acquired from outside of the Python console. Looking forward to hearing back!
You likely already know, but for other’s benefit, YAML does support representing single-line strings across multiple lines: https://yaml-multiline.info/