Hello,
In the PythonInteroperability.md document, you write
Another interesting aspect of this work is that Python support is completely independent of the other TensorFlow and automatic differentiation logic we鈥檙e building as part of Swift for TensorFlow. This is a generally useful extension to the Swift ecosystem that can stand alone, useful for server side development or anything else that wants to interoperate with existing Python APIs.
I totally agree, and it would be nice if the Python.swift module could be available on its own independently of TensorFlow, to use for other applications that need to call into Python code.
I came across this, https://github.com/pvieito/PythonKit, which seems to be using the same code, though I am not sure what is its relation with the tensorflow/swift project, if any.
Have you considered making it available in a separate repository with its own Package.swift, etc.?
Thank you.
Thanks for the good question!
@pvieito is not affiliated with the Swift for TensorFlow project but he contributed in mailing list discussions about Python interoperability.
Regarding separating the Python module from "TensorFlow": the Python module does not depend on the TensorFlow module so it is already separate.
Perhaps your question is about separating the Python module from the Swift compiler. The Python module requires compiler support for the @dynamicCallable attribute - this support is currently implemented only in the Swift for TensorFlow codebase.
The Swift evolution proposal for @dynamicCallable is currently undergoing review: if it is accepted and code is merged upstream, then it will be possible to make the Python module available as a SPM package. However, I feel it may be more appropriate for the Python module to be included in the standard library as an SDK overlay - this would require more discussion.
Also, FWIW, we do plan to propose integration of the Python module in upstream swift, we are just waiting for the @dynamicCallable proposal to finish its review cycle and be decided.
I鈥檒l look forward to it, thank you!
Python 3 support would be a bonus, but it鈥檚 probably a separate issue :)
Patches welcome! :-) :-)
Most helpful comment
Also, FWIW, we do plan to propose integration of the Python module in upstream swift, we are just waiting for the @dynamicCallable proposal to finish its review cycle and be decided.