[FRPythoneers] dispatching from a script

Brent Pedersen bpederse at gmail.com
Fri Apr 15 11:29:36 MDT 2011

hi, not sure if this list is the appropriate venue, but i'll ask anyway.
so i have a python library and i want to have several scripts but keep
them in the same name space.
so i'll have "mymodule" that's importable from python and then i want
to be able to have console scripts

$ mymodule action_a --args files
$ mymodule actoin_b --other_args other_files

i can do this manually with something like:

      'console_scripts': ['mymodule = mymodule:main']

in my setup.py, and dispatching from main() based on sys.argv[2], but then
after implementing stuff like having

$ mymodule

give a list of available actions, it can get pretty tedious.
are there idioms or modules in python that make this easier?
i admit i haven't looked around too much.

thanks for any pointers,

More information about the FRPythoneers mailing list