With the 'version' action [1], instead of passing the version as an
argument to ArgumentParser (which was at one point supported in
Python, but I can't find the deprecation docs).
[1]: https://docs.python.org/3/library/argparse.html#action
[2]: https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser
import argparse as _argparse
parser = _argparse.ArgumentParser(
- description=__doc__, version=__version__,
+ description=__doc__,
formatter_class=_argparse.RawDescriptionHelpFormatter)
+ parser.add_argument(
+ '--version', action='version',
+ version='%(prog)s {}'.format(__version__))
parser.add_argument(
'--mode', default='cgi', choices=['cgi', 'scgi', 'wsgi'],
help='Server mode (defaults to CGI)')