modulespackagesand distribution distributing python programs and libraries to distribute python programs to othersyou should use the distutils module as preparationyou should first cleanly organize your work into directory that has readme filesupporting documentationand your source code typicallythis directory will contain mix of library modulespackagesand scripts modules and packages refer to source files that will be loaded with import statements scripts are programs that will run as the main program to the interpreter ( running as python scriptnamehere is an example of directory containing python codespamreadme txt documentation txt libspam py spampkg_ _init_ py foo py bar py runspam py single library module package of support modules script to run aspython runspam py you should organize your code so that it works normally when running the python interpreter in the top-level directory for exampleif you start python in the spam directoryyou should be able to import modulesimport package componentsand run scripts without having to alter any of python' settings such as the module search path after you have organized your codecreate file setup py in the top most directory (spam in the previous examplesin this fileput the following codesetup py from distutils core import setup setup(name "spam"version " "py_modules ['libspam']packages ['spampkg']scripts ['runspam py']in the setup(callthe py_modules argument is list of all of the single-file python modulespackages is list of all package directoriesand scripts is list of script files any of these arguments may be omitted if your software does not have any matching components ( there are no scriptsname is the name of your packageand version is the version number as string the call to setup(supports variety of other parameters that supply various metadata about your package table shows the most common parameters that can be specified all values are strings except for the classifiers parameterwhich is list of strings such as ['development status : beta''programming language :python'( full list can be found at table parameters to setup(parameter description name version author author_email name of the package (requiredversion number (requiredauthor' name author' email address lib fl ff