Reputation: 5417
We have an app (a bunch of Twisted classes actually) which runs on a specific Python version and depends on quite a bit of modules. This app needs to be deployed onto a Windows Server machine which has no access to Internet.
Currently we are choosing between:
setup.py
,%PYTHONPATH%
.What is the good accepted way of dealing with such situation? Obviously we cannot use pip
, easy_install.exe
and other blessed tools, and our approaches are silly and inelegant.
Upvotes: 3
Views: 530
Reputation: 605
As a third option you can consider deploing the application as an executable using PyInstaller (http://www.pyinstaller.org). You dont need to install anything on the client machine (not even python)
PyInstaller is a program that converts (packages) Python programs into stand-alone executables, under Windows, Linux, Mac OS X, Solaris and AIX. Its main advantages over similar tools are that PyInstaller works with any version of Python since 2.4, it builds smaller executables thanks to transparent compression, it is fully multi-platform, and use the OS support to load the dynamic libraries, thus ensuring full compatibility.
I have used it in a project to deploy standalone application in both Linux and Windows. Worked like a charm. My project also used Twisted.
Between your current two choices the setup.py approach is more pythonic. But beware that if any of your modules has some c implementation for faster performance that need to be compiled, you can't do that on you client's machine.
Upvotes: 3
Reputation: 1382
Try to use wheels. It designed to cover your case, i.e. you build wheel once, downloading all required packages. Then you just copy wheel archive to the target machine and install your application without downloading anything.
Upvotes: 3