Re: [Pyobjc-dev] Using pyobjc with Sympy and Swift
Brought to you by:
ronaldoussoren
From: Ian M. <ip...@po...> - 2017-04-03 17:13:20
|
While this is a bit of an over-simplification, PyObjC is typically used to write Cocoa applications using Python. Consuming Python libraries from an ObjC (or Swift) application is far less common. PyObjC can (probably) help you achieve this in eliminating some boilerplate, but the place to start is really with the "embedding" section of the standard Extending and Embedding the Python Interpreter <https://docs.python.org/2/extending/> documentation. As I read your message I couldn't help but wince a little because this is a lot of hoops to jump through in order to consume a Python library. Also, starting from Swift makes this considerably harder because there's not yet ABI stability for Swift, so if there are any callbacks, or other patterns that depend on the Swift ABI, you're setting yourself up for future disappointment. If you're dead set on using Swift, could you perhaps find an equivalent symbolic math library written in C or C++ (Boost perhaps) that would get the job done? This would eliminate one stop along the way, not to mention likely having better run-time performance. Overall, what you're trying to do is... complicated. PyObjC may be able to help you avoid some boilerplate work, but it's not going to be a silver bullet, and you should understand that this use case is pretty obscure, so the number of folks that are going to be able to provide concrete, actionable advice to get you unstuck is going to be relatively small. The concrete, actionable advice I can give you right now is that the first step will be getting a python interpreter running inside your application, so the above linked docs on embedding are definitely the place to start. Once you've embedded the interpreter, you can start to figure out how to get it "wired" together with the rest of your application. Start small. Get your embedded interpreter running Hello World or something first. Then graduate to a simple library call, and then, when you've got that all figured out, start to think about the best ways to integrate the larger library. Regards and Hope this Helped, Ian On Sun, Apr 2, 2017 at 11:22 PM, Robert Hai <rh...@gm...> wrote: > Hi, > > I need to use a Python Library (Sympy -> http://www.sympy.org/en/ > index.html) in my Swift App. So my idea was to bridge between Objective-C > and Swift and bridge between Objective-C and Swift to achieve my goal. So > how do I use PyObjC with Sympy and where can I find excat documentation of > how to use my Python in Objective-C via PyObjC ? > > Thanks a lot for your help ! I have ben trying to achieve this for the > past four weeks. I finally want to solve this =( > > All my best, > Robert > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > |