Skip to content

Improve sysconfig CLI #132726

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

Closed
donBarbos opened this issue Apr 19, 2025 · 5 comments
Closed

Improve sysconfig CLI #132726

donBarbos opened this issue Apr 19, 2025 · 5 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@donBarbos
Copy link
Contributor

donBarbos commented Apr 19, 2025

Proposal:

Currently, the sysconfig 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 (only have example for python -m sysconfig output) 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 argument --generate-posix-vars, which I could only find from looking at the source in ./Lib/sysconfig/__main__.py.

Inspired by #131524

I suggest adding a 1. full-fledged CommandLineTest class to the tests (currently there is only test_main which only checks that the output is present), 2. update the documentation so that it is the same as other command line interaces, 3. use argparse as a quality CLI tool

P.S.: sysconfig CLI was added in January 2010 for Python 3.2 (edacea3)

I'm happy to submit a PR if needed.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

@donBarbos donBarbos added the type-feature A feature request or enhancement label Apr 19, 2025
@picnixz picnixz added the stdlib Python modules in the Lib dir label Apr 19, 2025
@donBarbos
Copy link
Contributor Author

cc @hugovk

@tomasr8
Copy link
Member

tomasr8 commented Apr 19, 2025

cc @FFY00 as the sysconfig maintainer

@hugovk
Copy link
Member

hugovk commented Apr 26, 2025

This CLI feels more of a debugging tool? I'm not sure how useful tests will be in this case.

Brief docs are probably enough. We could change the heading to "Command-line usage", like for others (if so, keep the existing #sysconfig-cli anchor).

@donBarbos
Copy link
Contributor Author

This CLI feels more of a debugging tool? I'm not sure how useful tests will be in this case.

Brief docs are probably enough. We could change the heading to "Command-line usage", like for others (if so, keep the existing #sysconfig-cli anchor).

done, and last question what do you think about --generate-posix-vars flag. Keep it, add it to documentation or maybe add help message to CLI via argparse?

@vstinner
Copy link
Member

Please don't document --generate-posix-vars. It's only used to build Python itself.

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

No branches or pull requests

5 participants