6

I have created a plugin for a software, this plugin is written in Python and I wish to distribute it in the form of a shared library (.so) for Mac OS (only). In my code I have a number of imports to packages that may not be installed in the 'target' Macs and I want to avoid having the user to download those packages as they many not have pip on their Mac and so on...

The simplest solution would be to 'build' a shared library with all the dependencies/modules to ensure that the user just downloads it and activates the plugin in the software and everything automatically works.

Is that possible?

I have been doing a lot of searching and reading on the web, I've look at pyInstaller, but I don' want to create a stand-alone executable but a single shared library with imports from packages such as Crypto, zerconf, twisted, etc.

If not what will be the alternatives?

I have tried Cython but I only get my plugin code compiled into a library so when I try to use it in a computer without the necessary packages I get an import error.

Is there a way to 'tell' Cython to compile all the dependencies of the code into a single shared library?

As I mentioned above pyInstaller could work for a stand-alone executable but in my case it needs to be a shared library...

Many thanks!

Kostas
  • 367
  • 1
  • 3
  • 17
  • Possible duplicate of [Compiling required external modules with cython](http://stackoverflow.com/questions/22567103/compiling-required-external-modules-with-cython) – DavidW Feb 10 '17 at 10:41
  • I know the question I've marked as a duplicate has an unsatisfactory answer, but Cython isn't designed for this and so it doesn't work – DavidW Feb 10 '17 at 10:42
  • Thanks @DavidW - I had a look at the post which is about creating an executable and for that pyInstaller could do the trick but I must be provide a shared library... – Kostas Feb 10 '17 at 12:04
  • One thing you try is providing all the dependencies in a zip file. Python can happily import from zip files https://docs.python.org/3/library/zipimport.html. I couldn't tell you exactly how to do that though. – DavidW Feb 10 '17 at 12:33

0 Answers0