Understanding how the distribution of a python script is achieved with setuptools -
i'm looking distribute few python scripts. scripts use few separate packages such docopt , of course utilise various libraries. id able package script along needs function correctly.
from have read best way use setuptools , use of setup.py script. id know is, setuptools able identify packages , libraries being used in script , automatically copy relevant packages current location directory used 'new package' creation. or have manually find package installations on system , copy them relevant folder 'new package' creation?
ive read setuptool docs have read seems though need manually? if how know relevant packages , libraries on system?
could let me know if im understanding correctly?
ok got working.
just in case else comes across post , wants know simply.
the idea have script share, script uses various other modules, packages etc. last thing wants start scrapping them create nonworking manual package.
by creating setup.py file , specifying packages want included script can automated. automated includtion of "required packages" done during install process (so has newly shared script , installing using easy_install).
to generate distribution package script need following.
- identify packages need include (check out code).
- move script new folder (this package container).
- follow instructions in post create relevant files youd in distribution. (note "install_requires" field)
- execute
python setup.py sdist
commandline making sure current working directory of new package. - your distribution package in dist dir.
- pass friends. need install setuptools/easy_install here.
- once installed can install package executing
easy_install packagename-0.1.0.tar.gz
. install required packages , of course script.
Comments
Post a Comment