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

Lose the use of optparse #195

Open
GoogleCodeExporter opened this issue Jul 3, 2015 · 0 comments
Open

Lose the use of optparse #195

GoogleCodeExporter opened this issue Jul 3, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

optparse is deprecated in python2.7 and 3.2+. Argparse has replaced it (and is 
available on pypi for older versions). 

The use of optparse should be gradually deprecated in repo. Of course this 
needs to be done carefully since others write subcommands. 

A wrapper can be written around argparse to enable the most common uses of 
optparse so we don't break everyones commands. This won't work for all though, 
such as with callbacks that use parser.largs or rargs.

A class attribute can also be set to say if a command fully supports argparse, 
enabling us to skip the wrapper altogether.

Anything that doesn't touch on subcommands can be directly converted to use 
argparse safely.

Since argparse supports subparsers, it will simplify the the process used for 
selecting the subcommand.


In time, support for optparse should be fully removed, starting with warnings 
when optparse methods are used, then forcing an option to be set to allow 
optparse methods to be used, finally fully removing the wrapper.
Since optparse isn't set to be removed from py3.5, I would recommend a time 
frame of 2 years from when the subcommands are changed to use argparse. 

Original issue reported on code.google.com by [email protected] on 21 Feb 2015 at 6:27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant