Skip to content

Improve platform CLI #131524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Harry-Lees opened this issue Mar 20, 2025 · 4 comments · May be fixed by #131542
Open

Improve platform CLI #131524

Harry-Lees opened this issue Mar 20, 2025 · 4 comments · May be fixed by #131542
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@Harry-Lees
Copy link
Contributor

Harry-Lees commented Mar 20, 2025

Feature or enhancement

Proposal:

Currently, the platform module's CLI is fairly hidden and inaccessible. I think there are two main issues with the module CLI.

  1. There is no "Command Line Interface" section of the docs like there is with some other modules e.g. random. (It is, however, listed under the Modules command-line interface section)
  2. There is no help section when running the platform CLI, the CLI takes two arguments --terse and --nonaliased, which I could only find from looking at the source in Lib/platform.py.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

@Harry-Lees Harry-Lees added the type-feature A feature request or enhancement label Mar 20, 2025
@Harry-Lees
Copy link
Contributor Author

I am open to adding the missing documentation/ updating the CLI to use argparse for a help section. I came across this while looking into #131178, so it might be possible to add tests and update the CLI at the same time if this proposal is acceptable.

@sobolevn
Copy link
Member

In my opinion, this is a good idea. I also think that we can add better CLI tools for arg parsing (like argparse).

CC @hugovk

@donBarbos
Copy link
Contributor

we also don't have help messages for many other CLI modules that parse flags themselves or use legacy modules to implement cli

I wrote about it here: #93096 (comment)

as already said (in comment) this makes the behavior implicit maybe it's worth opening a new issue to add help flags to each module

@hugovk
Copy link
Member

hugovk commented Mar 21, 2025

Interestingly, the CLI has been part of the module since it was added in 2003 for Python 2.3 and hasn't changed (beyond print and whitespace): 246d847

In my opinion, this is a good idea. I also think that we can add better CLI tools for arg parsing (like argparse).

Fine by me too.

@Harry-Lees Would you like to open a PR?

@Harry-Lees Harry-Lees linked a pull request Mar 21, 2025 that will close this issue
@encukou encukou added the stdlib Python modules in the Lib dir label Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants