I am currently deploying some code on a fleet of raspberry pi systems. The systems all have python 3.7.x installed but one of my team's custom libraries has some python 3.8 features (a few walrus operators, etc). I need to modify my library to remove all of the 3.8 features so that the code runs on these machines. I am not able to update the python version on them. Is there a script or tool that exists to batch check if a file or folder of files is compatible with python 3.7? I'm thinking something similar to how flake8 or black can check for issues.
Run a static analysis tool, like pylint or mypy, and make sure that it's running on the appropriate version of Python.  One of the first things these tools do is parse the code using the Python parser, and they'll report any SyntaxErrors they find.
How to parse Python files to see if they are compatible with Python 3.7