On 21Feb2022 09:12, Steven D'Aprano <st...@pearwood.info> wrote:
>On Sun, Feb 20, 2022 at 09:56:18AM +0100, Eliot Lear wrote:
>> [...] I wonder if there is a reason why certain functions are not 
>> linked to console_scripts.  In particular I would think this would be 
>> good for
>> json.tool (though I might call it something else, like pyjson_pp).
>> with venv. I'm sure I'm missing something obvious. [...]
>
>[...]
>1. Not all functions would be useful as command line tools.
>
>2. Nobody has done the work to make it possible.
>
>3. If a Python package already defines a `__main__.py` file in the
>   package, you can call it as a CLI tool with `python -m package`.
>   So making it a separate CLI tool is redundant.

A fourth reason is that one shouldn't be too profligate with installing 
scripts in the command line path. That "space" includes not just Python 
tools but every other command you could invoke - as a global namespace 
it is easily polluted.

The previously mentioned "python -m module_name" command line mode 
provides precision here, particularly if you adjust the word "python", 
without polluting the command line space.

That said, it isn't always a bad thing to provide a script. I do it 
myself. Choosing an name which is (a) expressive and (b) less likely to 
conflict with other's choices is important though.

Cheers,
Cameron Simpson <c...@cskk.id.au>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/HD6TQC22ORI3T6RPWDD7FQIIA57U236E/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to