|
|
|
|
|
by eesmith
1794 days ago
|
|
FWIW, my command-line tools and any support code are all in a subdirectory under my package directory. I used to include a simple stub Python program (~10 lines) as a "script" in my setup.py that would import the right code and call it. Then I learned that "entry_points" implemented most of the dispatch behavior I wanted. I no longer have those scripts, just an entry that basically says "from abc.cli.prog1 import main; main()". The prog1.py, prog2.py, etc. look like normal command-line scripts, assuming the usual: if __name__ == "__main__":
main()
The major downside is I can't suppress SIGPIPE and SIGINT until main() is called, leaving a wider window where something like ^C gives a unwanted Python stack trace. |
|