Page 77 -
P. 77
sharing your code
Build your distribution
You now have a folder with two files in it: your module’s code in nester.py Note: if you are using Windows,
and metadata about your module in setup.py. Now, it’s time to build your replace “python3” in these commands
distribution. with “c:\Python31\python.exe”.
3 Build a distribution file.
The distribution utilities include all of the smarts required to build a distribution. Open a terminal
window within your nester folder and type a single command: python3 setup.py sdist.
Enter the
command at File Edit Window Help Build
the prompt. $ python3 setup.py sdist
running sdist
running check
warning: sdist: manifest template 'MANIFEST.in' does not exist
warning: sdist: standard file not found: should have README
A collection of writing manifest file 'MANIFEST'
status messages creating nester-1.0.0
appears on screen, making hard links in nester-1.0.0...
confirming the hard linking nester.py -> nester-1.0.0
creation of your hard linking setup.py -> nester-1.0.0
creating dist
distribution. Creating tar archive
removing 'nester-1.0.0' (and everything under it)
$
4 Install your distribution into your local copy of Python.
Staying in the terminal, type this command: sudo python3 setup.py install.
File Edit Window Help Install
$ python3 setup.py install
running install
running build
running build_py
Another bunch of creating build
status messages creating build/lib
appear on screen, copying nester.py -> build/lib
confirming the running install_lib
installation of copying build/lib/nester.py -> /Library/Frameworks/Python.
framework/Versions/3.1/lib/python3.1/site-packages
your distribution. byte-compiling /Library/Frameworks/Python.framework/Versions/3.1/
lib/python3.1/site-packages/nester.py to nester.pyc
running install_egg_info
Writing /Library/Frameworks/Python.framework/Versions/3.1/lib/
python3.1/site-packages/nester-1.0.0-py3.1.egg-info
Your distribution is ready.
you are here 4 41