-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-126180: Undeprecate getopt and optparse #126186
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
serhiy-storchaka
wants to merge
5
commits into
python:main
from
serhiy-storchaka:undeprecate-getopt-optparse
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
097cba2
gh-126180: Undeprecate the optparse and getopt modules
serhiy-storchaka 9744ded
Update Doc/library/getopt.rst
serhiy-storchaka 8f211ff
Update Doc/library/getopt.rst
serhiy-storchaka 22b8a77
Update Doc/library/argparse.rst
serhiy-storchaka 2c2f48f
Update Doc/library/argparse.rst
serhiy-storchaka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,22 +3,14 @@ | |
|
||
.. module:: optparse | ||
:synopsis: Command-line option parsing library. | ||
:deprecated: | ||
|
||
.. moduleauthor:: Greg Ward <[email protected]> | ||
.. sectionauthor:: Greg Ward <[email protected]> | ||
|
||
**Source code:** :source:`Lib/optparse.py` | ||
|
||
.. deprecated:: 3.2 | ||
The :mod:`optparse` module is :term:`soft deprecated` and will not be | ||
developed further; development will continue with the :mod:`argparse` | ||
module. | ||
|
||
-------------- | ||
|
||
:mod:`optparse` is a more convenient, flexible, and powerful library for parsing | ||
command-line options than the old :mod:`getopt` module. :mod:`optparse` uses a | ||
command-line options than the simple :mod:`getopt` module. :mod:`optparse` uses a | ||
more declarative style of command-line parsing: you create an instance of | ||
:class:`OptionParser`, populate it with options, and parse the command | ||
line. :mod:`optparse` allows users to specify options in the conventional | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Misc/NEWS.d/next/Library/2024-10-30-16-56-54.gh-issue-126180.CQ-bA4.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The :mod:`optparse` and :mod:`getopt` modules are no longer deprecated. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we typically remove from the What's New for the version introduced or do we annotate that it is being changed in 3.14?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an interesting question. Obviously undeprecation should be retroactive. There is no sense in discouraging the use of getopt and optparse in 3.12 and 3.13. For 3.13, this may even be considered a bugfix.
But how to indicate this in What's New? If say nothing, then users will continue to think that getopt and optparse are deprecated. If write about this in 3.12 and 3.13, most users will not read this. So we should write something in 3.14, even if this change will be applied to 3.12 and 3.13.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a good answer to this. Perhaps @hugovk would like to weigh in as release manager.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Yhg1s is the 3.13 RM so punting to him :)
However, optparse was deprecated back in 3.2, some 13 years ago, so for one of them, this isn't a sudden change in 3.13.
If we do undeprecate, perhaps adding a note to the existing "What's New in 3.13" entry to note it's future change?
In any case, I would also hold off merging this and allow some more time for the discussion, it's not yet been 24 hours:
https://discuss.python.org/t/getopt-and-optparse-vs-argparse/69618
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In drafting my PR, I took the view that 3.13 is new enough that most of the people who will read the What's New haven't actually read it yet, and hence just changed this to a regular 3.13 What's New entry for
optparse
(getopt
is reverting to the 3.12 status quo, so it only got mentioned in NEWS).