pyship
pyship creates a python 2.7 binary that can be bundled with python scripts. This gives python scripts a native application feel. Other attempts at creating a similar effect include programs like py2exe and cx_Freeze.
Currently only OSX is supported.
pre-requisites
- Install ActiveState Tcl/Tk 8.5
- Install Xcode SDK
sudo ln -s /usr/bin/clang /usr/bin/ccsudo ln -s /usr/local/bin/hg /usr/bin/hgsudo ln -s /Library/Frameworks/Tk.framework/ $(xcrun --show-sdk-path)/Library/Frameworks/sudo ln -s /Library/Frameworks/Tcl.framework/ $(xcrun --show-sdk-path)/Library/Frameworks/
creating a binary
git clone https://github.com/burrows-labs/pyship.gitcd pyship./main.sh 10.10
invoking the python shell
$ ./build/pyship/python2.7/usr/local/bin/python
>>> import _ssl # ssl works!
>>> print "Hello World"
Hello World
>>> exit()
setting up a virtualenv
$ ./build/pyship/python2.7/usr/local/bin/python ./build/pyship/virtualenv/virtualenv.py abc
$ ./abc/bin/pip install requests
$ ./abc/bin/python
>>> import requests
>>> r = requests.get('http://google.com')
>>> r.text
u'<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta
content="Search the world\'s information, including webpages, images, videos and more. Google
has many special features to help you find exactly what you\'re looking for." name="description">...
>>> exit()
dependencies?
$ find build/pyship/python2.7/ | xargs otool -L 2>/dev/null | \
grep -Ev "(is not an object file|Invalid argument|build/pyship)" | \
awk '{$1=$1};1' | awk '{print $1}' | sort | uniq
/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl
/Library/Frameworks/Tk.framework/Versions/8.5/Tk
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration
/usr/lib/libSystem.B.dylib
/usr/lib/libbz2.1.0.dylib
/usr/lib/libedit.3.dylib
/usr/lib/libz.1.dylib