
On 9 March 2015 at 23:11, Nick Coghlan <ncoghlan@gmail.com> wrote:
While I like the idea of offering something more "built in" in this space, my initial inclination is to prefer extending "-m" to accept the "module.name:function.name" format to let you invoke entry points by the name of the target function (Possible API name: runpy.run_cli_function), and then add a "runpy.call" that can be used to call an arbitrary function with positional and keyword string arguments based on sys.argv and (optionally?) print the repr of the result.
It wouldn't be a universal panacea (and would need a PEP to work out the exact UX details), but would likely make quite a few libraries more command line accessible without needing to modify them.
Personally I doubt it would make much difference. If the docs say "pygmentize" I'm unlikely to dig around to find that the incantation "python -m pygments.somemodule:main" does the same thing using 3 times as many characters. I'd just add Python to my PATH and say stuff it. Paul