-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
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
Changes from 2 commits
097cba2
9744ded
8f211ff
22b8a77
2c2f48f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1787,14 +1787,6 @@ New Deprecations | |
| Check membership in :data:`~dis.hasarg` instead. | ||
| (Contributed by Irit Katriel in :gh:`109319`.) | ||
|
|
||
| * :mod:`getopt` and :mod:`optparse`: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 commentThe 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 commentThe 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 |
||
|
|
||
| * Both modules are now :term:`soft deprecated`, | ||
| with :mod:`argparse` preferred for new projects. | ||
| This is a new soft-deprecation for the :mod:`!getopt` module, | ||
| whereas the :mod:`!optparse` module was already *de facto* soft deprecated. | ||
| (Contributed by Victor Stinner in :gh:`106535`.) | ||
|
|
||
| * :mod:`gettext`: | ||
|
|
||
| * Deprecate non-integer numbers as arguments to functions and methods | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| The :mod:`optparse` and :mod:`getopt` modules are no longer deprecated. |
Uh oh!
There was an error while loading. Please reload this page.