Skip to content

optparse is Deprecated in python and suggest to use argparse #11266

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
1 task done
zhuofeng6 opened this issue Jul 16, 2022 · 1 comment
Closed
1 task done

optparse is Deprecated in python and suggest to use argparse #11266

zhuofeng6 opened this issue Jul 16, 2022 · 1 comment
Labels
type: feature request Request for a new feature

Comments

@zhuofeng6
Copy link

What's the problem this feature will solve?

i debug pip in my project, and i found you project are still using optparse module.

class CustomOptionParser(optparse.OptionParser):
    def insert_option_group(
        self, idx: int, *args: Any, **kwargs: Any
    ) -> optparse.OptionGroup:
        """Insert an OptionGroup at a given position."""
        group = self.add_option_group(*args, **kwargs)

        self.option_groups.pop()
        self.option_groups.insert(idx, group)

        return group

    @property
    def option_list_all(self) -> List[optparse.Option]:
        """Get a list of all options, including those in option groups."""
        res = self.option_list[:]
        for i in self.option_groups:
            res.extend(i.option_list)

        return res

but it is deprecated since version 3.2 in python. Deprecated since version 3.2

Deprecated since version 3.2: The optparse module is deprecated and will not be developed further; development will continue with the argparse module.

I think pip should be update, maybe, it is only my suggestion.

Describe the solution you'd like

Use argparse instead, after all optparse is no longer maintained

Alternative Solutions

N/A

Additional context

N/A

Code of Conduct

@zhuofeng6 zhuofeng6 added S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature labels Jul 16, 2022
@pradyunsg
Copy link
Member

Please look at existing issues, before filing new ones.

Duplicate of #4659

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 16, 2022
@pradyunsg pradyunsg removed the S: needs triage Issues/PRs that need to be triaged label Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants