beeware / Python-Apple-support

A meta-package for building a version of Python that can be embedded into a macOS, iOS, tvOS or watchOS project.
MIT License
1.1k stars 159 forks source link

Now What? #125

Closed nsmith1024 closed 3 years ago

nsmith1024 commented 3 years ago

Hello,

I have IOS app and i want to be able to call Python from objective-c to do some image processing so i decide to integrate the python interpreter on this repository with my objective-C IOS code, then use it to call python functions from objective-c.

So i downloaded the binary linked on this site, the files in the binary are shown below

user@Ns-Mac-mini Python-3.9-iOS-support.b3 % ls -la total 8 drwxr-xr-x@ 8 user staff 256 Jul 23 08:12 . drwxr-xr-x 6 user staff 192 Jul 23 08:52 .. drwxr-xr-x@ 4 user staff 128 Apr 5 00:15 BZip2 drwxr-xr-x@ 4 user staff 128 Apr 5 00:23 OpenSSL drwxr-xr-x@ 5 user staff 160 Apr 5 00:48 Python -rw-r--r--@ 1 user staff 106 Apr 5 00:48 VERSIONS drwxr-xr-x@ 4 user staff 128 Apr 5 00:17 XZ drwxr-xr-x@ 4 user staff 128 Apr 5 00:24 libFFI user@Ns-Mac-mini Python-3.9-iOS-support.b3 %

I would like to know what is the next step i need to take to get this python interpreter into my existing xcode objective-c IOS project, and then link it into my existing code as a single binary.

When the end result code executes it should start running from objective-C, then when i need to do the image processing be able to call the python interpreter to execute the python code to do the processing and get the result back to Objective-c

Does anyone know the steps to take, to accomplish all this?

Thanks so much!

freakboy3742 commented 3 years ago

As I indicated when you asked on the Rubicon repository, you use the normal CPython embedding API.

The Briefcase template contains an example of how you'd use this code, as well as providing a project that serves as an example of how to configure the libraries.