Skip to content
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

Undeprecate getopt and optparse #126180

Closed
serhiy-storchaka opened this issue Oct 30, 2024 · 1 comment · Fixed by #126227
Closed

Undeprecate getopt and optparse #126180

serhiy-storchaka opened this issue Oct 30, 2024 · 1 comment · Fixed by #126227
Labels
docs Documentation in the Doc dir type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Oct 30, 2024

See discussion at https://discuss.python.org/t/getopt-and-optparse-vs-argparse/69618. Seems that all support this.

argparse has many issues, some are fundamental and cannot be easily worked around. Its implements behavior different from the behavior of other Unix/Linux programs in subtle ways. It is still not mature to be the preferable Python module for CLI.

getopt is a de-facto cross-language standard. Many programmers that came from other programming languges are already familiar with it. It is very simple, so even if there are other CLI modules, it should be left in the stdlib.

optparse provides an object-oriented interface. Even if it has less features than argparse, it is more stable and has less bugs. It should be the preferable Python module for CLI.

Linked PRs

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Oct 30, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Oct 30, 2024
@picnixz picnixz added type-feature A feature request or enhancement stdlib Python modules in the Lib dir labels Oct 30, 2024
@picnixz picnixz added docs Documentation in the Doc dir and removed stdlib Python modules in the Lib dir labels Oct 30, 2024
@ncoghlan
Copy link
Contributor

I missed that @serhiy-storchaka had already created a PR for this, so #126227 is an alternative take on the same change.

ncoghlan added a commit that referenced this issue Dec 23, 2024
* Remove getopt and optparse deprecation notices
* Add new docs sections for command line app helper libraries
* Add guidance on choosing a CLI parsing library to the optparse docs
* Link to the new guidance from the argparse and getopt docs
* Reword intro in docs section for superseded stdlib modules
* Reframe the optparse->argparse guide as a migration guide
  rather than as an upgrade guide

---------

Co-authored-by: Serhiy Storchaka <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Dec 23, 2024
…onGH-126227)

* Remove getopt and optparse deprecation notices
* Add new docs sections for command line app helper libraries
* Add guidance on choosing a CLI parsing library to the optparse docs
* Link to the new guidance from the argparse and getopt docs
* Reword intro in docs section for superseded stdlib modules
* Reframe the optparse->argparse guide as a migration guide
  rather than as an upgrade guide

---------
(cherry picked from commit 831b6de)

Co-authored-by: Alyssa Coghlan <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
ncoghlan added a commit that referenced this issue Dec 23, 2024
…128191)

* Remove getopt and optparse deprecation notices
* Add new docs sections for command line app helper libraries
* Add guidance on choosing a CLI parsing library to the optparse docs
* Link to the new guidance from the argparse and getopt docs
* Reword intro in docs section for superseded stdlib modules
* Reframe the optparse->argparse guide as a migration guide
  rather than as an upgrade guide

---------
(cherry picked from commit 831b6de)

Co-authored-by: Alyssa Coghlan <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this issue Dec 23, 2024
…onGH-126227)

* Remove getopt and optparse deprecation notices
* Add new docs sections for command line app helper libraries
* Add guidance on choosing a CLI parsing library to the optparse docs
* Link to the new guidance from the argparse and getopt docs
* Reword intro in docs section for superseded stdlib modules
* Reframe the optparse->argparse guide as a migration guide
  rather than as an upgrade guide

---------

Co-authored-by: Serhiy Storchaka <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir type-feature A feature request or enhancement
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

3 participants