Is there a good way for swift to be compatible with Python code? For example, is there a python parser built into swift?
You might be interested in Swift for Tensorflow. It includes a Python module which lets you import python packages and use them like native Swift:
There's also a Swift Package, PythonKit, which is a stand alone library version of what is available in the S4TF compiler.
PythonKit Can't run on the phone