Is it possible to mark or label (not just with comments) source code with a python version to indicate which version of python it is compatible with and raise an error or warning when it is run with an older or incompatible python interpreter?
Edit:
if sys.version_info < (3, 8):
raise Exception("You need Python 3.8+")
This should do what I want.
sys.version_infoto recognize used Python and raise error. And usually it is used at the beginning of code. ie.sys.version_info.major >= 3 and sys.version_info.minor > 5