Packaging a proprietary Python library for multiple OSs

1k views Asked by At

I am developing a proprietary Python library. The library is currently Windows-only, and I want to also make it available for other platforms (Linux & Mac).

The library is currently shipped to the (paying) customers in the form of a Zip file. This archive contains the compiled Python code for the implementation of my library, plus all dependencies. By placing the Zip file on his PYTHONPATH, the customer can use the library from his Python scripts.

Shipping a Zip file with all dependencies included has the following advantages:

  • No internet access or administrator privileges are required to install the library.
  • The customer does not have to worry about installing / managing dependencies of my library.

It also has the disadvantage that the customer is not (easily) able to use his own versions of my library's dependencies.

Even though I am not generating an EXE, I am using py2exe to obtain the distributable Zip file for my library. This "hack" is very convenient, as py2exe allows me to simply say which packages I require and does the work of performing a dependency analysis of the required libraries for me. py2exe automatically generates the Zip file with my (compiled) library code, and all dependencies.

Unfortunately, py2exe is only available for Windows. I need to also be able to build it on Linux & Mac, hence change the build process to not use py2exe.

My questions are:

  1. Is it considered a bad idea in the Python community to ship one large Zip file with all dependencies? From what I have seen, it seems to be an unusual approach, at the least.
  2. Is it possible to distribute the library in a form that allows for an offline installation without administrator privileges using other tools, such as setuptools?

My insight into the state of the art in Python regarding these matters is limited, so I would appreciate advice from someone with more experience in the subject.

A hard requirement is that I can only ship binary distributions of my library, as this is a proprietary product. I looked at Distutils and Setuptools, where the recommended approach seems to be to simply ship all sources.

Many thanks!

0

There are 0 answers