-
-
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
gh-126180: Undeprecate getopt and optparse #126186
Conversation
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.
@serhiy-storchaka This looks good. Thanks for the detailed comments too.
@@ -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 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).
507bdfc
to
097cba2
Compare
Co-authored-by: Carol Willing <[email protected]>
Co-authored-by: Martin Panter <[email protected]>
Co-authored-by: Martin Panter <[email protected]>
Co-authored-by: Martin Panter <[email protected]>
I missed that @serhiy-storchaka had already started on a PR for this, so #126227 is an alternative take on the same change which goes a bit further than this one does in some respects, but not as far in others:
I like some of the other changes Serhiy has included here, so I'm going to include them to the other PR with a Co-Authored-By note. I've also added the DO-NOT-MERGE label to both PRs, as I agree with @hugovk that we want to let the discussion on this play out for a while longer yet. |
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'm definitely in favour of the general idea, but had drafted my own PR before I saw the notification that Serhiy had started this one. I prefer the overall structure of my PR (it splits out a new docs chapter for "Command Line Interface Libraries"), so I added several of Serhiy's content changes as Co-Authored-By additions over there, rather than suggesting my structural changes here.
@serhiy-storchaka Are you cool with @ncoghlan's approach or do you want to work together to refine either one of the existing PRs? |
I am fine with either option, but I think that |
@serhiy-storchaka Perhaps we can separate the two concerns? I think there's a piece the two of us agree on, and a piece where we still disagree (at least for now):
There are lots of CLIs where the problem of While there are places where it might make sense for people to use
We've spent ~15 years of telling people to use It might be reasonable to include those third party recommendations in the Edit: Serhiy clarified on the other PR that my assumption that mishandling leading |
📚 Documentation preview 📚: https://cpython-previews--126186.org.readthedocs.build/