argparse 1.0 announced
[Posted July 27, 2009 by cook]
| From: |
| Steven Bethard <steven.bethard-AT-gmail.com> |
| To: |
| Python Announce <python-announce-list-AT-python.org> |
| Subject: |
| argparse 1.0 - Command-line parsing library |
| Date: |
| Sun, 26 Jul 2009 13:14:02 -0400 |
| Message-ID: |
| <d11dcfba0907261014r5692aaf1v63a2b7ce0021ddd@mail.gmail.com> |
| Archive‑link: | |
Article |
=======================
Announcing argparse 1.0
=======================
The argparse module provides an easy, declarative interface for
creating command line tools, which knows how to:
* parse the arguments and flags from sys.argv
* convert arg strings into objects for your program
* format and print informative help messages
* and much more...
The argparse module improves on the standard library optparse module
in a number of ways including:
* handling positional arguments
* supporting sub-commands
* allowing alternative option prefixes like + and /
* handling zero-or-more and one-or-more style arguments
* producing more informative usage messages
* providing a much simpler interface for custom types and actions
Download argparse
=================
The argparse homepage has links for source, MSI and single file
distributions of argparse:
http://code.google.com/p/argparse/
About this release
==================
This release includes a number of new features:
* Support for Python versions 2.3 through 3.1. No need to run 2to3 or
anything like that -- the argparse source code is both fully 2.X
and 3.X compatible.
* ``ArgumentParser`` grew a ``parse_known_args`` method which works
like ``parse_args`` but collects unrecognized arguments into a list
instead of raising an exception
* The ``ArgumentParser`` constructor accepts a new parameter for
reading additional arguments from files. For example,
``fromfile_prefix_chars='@'`` means that arguments like ``@file``
should be replaced by the arguments read from the given file.
* A new formatter class, ``ArgumentsDefaultHelpFormatter`` is
available, which will automatically add ``(default: %(default)s)``
to all argument help messages
* The ``metavar`` parameter to ``add_argument`` now accepts a tuple
of strings in additional to a single string so that more than one
name can be specified.
* The ``add_subparsers`` method now accepts ``title`` and
``description`` parameters which will cause it to display like an
argument group in help messages.
--
http://mail.python.org/mailman/listinfo/python-announce-list
Support the Python Software Foundation:
http://www.python.org/psf/donations/