Question

I have a small application that runs on fairly recent Linux distributions with Python 2.7+ but also on CentOS and Scientific Linux boxes that have not yet made the switch to Python 2.7. optparse is deprecated with Python 2.7 and frankly I don't want to support optparse anyway, which is why I developed the application with argparse in mind. However, argparse does not exist on these older distributions. Moreover, the sysadmins are rather suspicious of installing a backport of argparse.

Now, that should I do? Stick with optparse? Write yet-another-wrapper around both libraries? Convince sysadmins and users (who in most cases are just able to start the application) to install an argparse backport?

Was it helpful?

Solution

I would stick with optparse as long as it provides the functionality you currently need (and expect to need in future).

optparse works perfectly fine, it just won't be developed further. It's still available in Python 3, so even if one day you decide to move to Python 3, it will continue to work.

OTHER TIPS

Provide a copy of argparse.py with your program, since there is no need to install the module. It is sufficient to get argparse.py from pypi.python.org/pypi/argparse and place it in some location included in sys.path.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top