sopel-irc / sopel

:robot::speech_balloon: An easy-to-use and highly extensible IRC Bot framework. Formerly Willie.
https://sopel.chat
Other
949 stars 403 forks source link

Support invoking the Sopel CLI with `python3 -m sopel` #2529

Open SnoopJ opened 11 months ago

SnoopJ commented 11 months ago

Requested Feature

<+xrl> Random thought: if we want to properly support python -m sopel start we should have a __main__.py file.

Currently, users who want to invoke Sopel without using the installed entrypoint have to spell that as python3 -m sopel.cli.run which is a bit verbose. There's no other obvious reading of python3 -m sopel, so we may as well define a __main__.py that has the same effect as the sopel entrypoint. It probably can even call exactly the same functionality in sopel.cli.run, although maybe it's worth considering having subcommands for run, config, plugins, i.e. spelling it as python3 -m sopel run instead.

Problems Solved

It is often more reliable to invoke programs with the python3 -m … spelling, as there is a single executable whose resolution needs to be worried over. It's possible (if not a bit uncommon) for python3 and entrypoints (pip is a notorious one) to become "out of sync", i.e. for python3 to refer to a different interpreter than the shebang in a given entrypoint on one's PATH.

Alternatives

No response

Notes

Somewhat related to #2515, the proposed invocation will probably have the same issue with reloading, but that is not a blocker for this issue.