Skip to content

Clarifications to the command-line tools guide#2061

Open
anpol wants to merge 3 commits into
pypa:mainfrom
anpol:cli-tools-guide-clarify
Open

Clarifications to the command-line tools guide#2061
anpol wants to merge 3 commits into
pypa:mainfrom
anpol:cli-tools-guide-clarify

Conversation

@anpol
Copy link
Copy Markdown

@anpol anpol commented May 25, 2026

A series of commits, please review them in order.


📚 Documentation preview 📚: https://python-packaging-user-guide--2061.org.readthedocs.build/en/2061/

anpol added 3 commits May 25, 2026 14:46
When describing a CLI command with `typer`, it might be more common to
use unqualified names, especially when you are defining many command
parameters and want to avoid repetitive typing.
The intent of `greetings.cli` is likely to preconfigure the `app`
object, exportable it for reuse by others.

Allowing `greetings.cli` to be runnable as a module didn't make much
sense, because the `greetings` module itself is already runnable.

Exporting the `main()` function and referencing it from the
`pyproject.toml` is likely more common and concise than relying on the
fact that the `app` object itself is callable.
Allowing `greetings.__main__` to be runnable as a module didn't make much
sense, because the `greetings` module itself is already runnable due to
the mere existence of the `__main__.py` file.

Importing just the `main()` function is likely more common and concise
than relying on the heavy-weight `app` object to be callable.
@anpol anpol changed the title Clarifications for the command-line tools guide Clarifications to the command-line tools guide May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant