Distribute Executable Module
I developed a program consisting of a package which is executable (i.e. two files x/__init__.py and x/__main__.py), so I can execute it using python -m x, if the package resides i
Solution 1:
Use either
distribute
orsetuptools
, the former is a fork of the latter, with some improvements and better documentation. Either one is a big step up fromdistutils
, which is part of the python standard library.You want a console script, for which you define an entry point:
entry_points = { 'console_scripts': [ 'foo = my_package.some_module:main_func', 'bar = other_module:some_func', ],
where
foo
andbar
would be scripts that you can call on the command line. The indicated function will be called withsys.argv[1:]
as the first and only argument.Let the installation tools take care of that; it works fine on Windows. :-)
Post a Comment for "Distribute Executable Module"