Reputation: 2181
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?
Upvotes: 4
Views: 413
Reputation: 1726
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
.
Upvotes: 3
Reputation: 336168
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.
Upvotes: 3