Swift framework to interact with Python.
PythonKit requires recent Swift 4.2 toolchains and has been tested both on macOS and Linux.
Some Python code like this:
import sys
print("Python {}.{}".format(sys.version_info.major, sys.version_info.minor))
print("Python Path: {}".format(sys.path[0]))
print("Python Version: {}".format(sys.version))Can be implemented in Swift through PythonKit with the following code:
import PythonKit
let sys = try Python.import("sys")
print("Python \(sys.version_info.major).\(sys.version_info.minor)")
print("Python Path: \(sys.path[0])")
print("Python Version: \(sys.version)")PythonGlue.swiftis code from the Swift for TensorFlow project.