argparse2
— Updated library for creating command-line interfaces¶
argparse2
is a Python library that is a fork of the the Python
standard library’s argparse module. The project page is on GitHub.
argparse2
is distributed for free on PyPI and the source code
is hosted on GitHub_. Documentation is hosted on Read the Docs.
TODO
Contents:
argparse2
— How to contribute¶
This page contains information for those contributing to argparse2
.
Setting up¶
To develop locally, clone the repo.
Then run the following from the repo root in a new virtualenv:
$ pip install -e .[dev,test]
Running tests¶
To run tests:
$ ./tests.sh
The test runner allows tests to be run with either argparse
or
argparse2
as the argparse module. This makes it easy to see what
test cases the two differ on.
Writing tests¶
The repository contains two types of tests: the original unit tests
carried over from CPython’s argparse
and new argparse2
-specific
tests.
The original argparse
tests are in a single file copied from the CPython
repository (and modified slightly to support importing argparse2
instead
of argparse
). New tests should not be added to this file. This simplifies
keeping the upstream tests in synch with this project.
Building documentation¶
To build and view documentation locally:
$ cd docs
$ make html
$ open _build/html/index.html
argparse2
— Summary of changes¶
This page contains a summary of argparse2
changes.
Next version (TBD)¶
- Simplified and refactored some formatting-related code (e.g. parts
of the
HelpFormatter
class). - [CPython issue #14037]: Added an
add_parser_group()
method to let subcommands be organized in groups.
0.1.0¶
Forked the following files from CPython version 3.5.0 alpha 1 on November 27, 2014 (changeset
93622:167d51a54de2
from the CPython repository):Lib/argparse.py
Lib/test_argparse.py
Doc/library/argparse.rst