Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-mando for openSUSE:Factory checked in at 2022-02-26 17:01:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-mando (Old) and /work/SRC/openSUSE:Factory/.python-mando.new.1958 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-mando" Sat Feb 26 17:01:54 2022 rev:7 rq:957243 version:0.7.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-mando/python-mando.changes 2021-12-16 21:20:08.254540082 +0100 +++ /work/SRC/openSUSE:Factory/.python-mando.new.1958/python-mando.changes 2022-02-26 17:02:13.783537303 +0100 @@ -1,0 +2,7 @@ +Thu Feb 24 09:37:25 UTC 2022 - Steve Kowalik <steven.kowa...@suse.com> + +- Update to 0.7.1: + * - Add support for Python 3.10 (@s-t-e-v-e-n-k): #54 +- Drop patch python-310-support.patch, merged upstream. + +------------------------------------------------------------------- Old: ---- mando-0.7.0.tar.gz python-310-support.patch New: ---- mando-0.7.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-mando.spec ++++++ --- /var/tmp/diff_new_pack.nJVQw4/_old 2022-02-26 17:02:14.391537400 +0100 +++ /var/tmp/diff_new_pack.nJVQw4/_new 2022-02-26 17:02:14.395537400 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-mando # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,13 +18,12 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-mando -Version: 0.7.0 +Version: 0.7.1 Release: 0 Summary: Python wrapper around argparse, a tool to create CLI apps License: MIT URL: https://mando.readthedocs.org/ Source: https://files.pythonhosted.org/packages/source/m/mando/mando-%{version}.tar.gz -Patch0: python-310-support.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -43,7 +42,6 @@ %prep %setup -q -n mando-%{version} -%autopatch -p1 sed -i -e '/^#!\//, 1d' mando/tests/*.py %build ++++++ mando-0.7.0.tar.gz -> mando-0.7.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mando-0.7.0/PKG-INFO new/mando-0.7.1/PKG-INFO --- old/mando-0.7.0/PKG-INFO 2020-03-16 15:45:49.022976000 +0100 +++ new/mando-0.7.1/PKG-INFO 2022-02-24 09:12:20.068276400 +0100 @@ -1,219 +1,12 @@ Metadata-Version: 2.1 Name: mando -Version: 0.7.0 +Version: 0.7.1 Summary: Create Python CLI apps with little to no effort at all! Home-page: https://mando.readthedocs.org/ +Download-URL: https://pypi.python.org/mando/ Author: Michele Lacchia Author-email: michelelacc...@gmail.com License: MIT -Download-URL: https://pypi.python.org/mando/ -Description: mando: CLI interfaces for Humans! - ================================= - - .. image:: https://img.shields.io/travis/rubik/mando - :alt: Travis-CI badge - :target: https://travis-ci.org/rubik/mando - - .. image:: https://img.shields.io/coveralls/rubik/mando - :alt: Coveralls badge - :target: https://coveralls.io/r/rubik/mando - - .. image:: https://img.shields.io/pypi/implementation/mando?label=%20&logo=python&logoColor=white - :alt: PyPI - Implementation - - .. image:: https://img.shields.io/pypi/v/mando - :alt: Latest release - :target: https://pypi.python.org/pypi/mando - - .. image:: https://img.shields.io/pypi/l/mando - :alt: PyPI - License - :target: https://pypi.org/project/mando/ - - .. image:: https://img.shields.io/pypi/pyversions/mando - :alt: PyPI - Python Version - :target: https://pypi.org/project/mando/ - - .. image:: https://img.shields.io/pypi/format/mando - :alt: Download format - :target: http://pythonwheels.com/ - - - mando is a wrapper around ``argparse``, and allows you to write complete CLI - applications in seconds while maintaining all the flexibility. - - Installation - ------------ - - .. code-block:: console - - $ pip install mando - - The problem - ----------- - - While ``argparse`` is great for simple command line applications with only - one, default command, when you have to add multiple commands and manage them - things get really messy and long. But don't worry, mando comes to help! - - Quickstart - ---------- - - .. code-block:: python - - from mando import command, main - - @command - def echo(text, capitalize=False): - '''Echo the given text.''' - if capitalize: - text = text.upper() - print(text) - - if __name__ == '__main__': - main() - - Generated help: - - .. code-block:: console - - $ python example.py -h - usage: example.py [-h] {echo} ... - - positional arguments: - {echo} - echo Echo the given text. - - optional arguments: - -h, --help show this help message and exit - - $ python example.py echo -h - usage: example.py echo [-h] [--capitalize] text - - Echo the given text. - - positional arguments: - text - - optional arguments: - -h, --help show this help message and exit - --capitalize - - Actual usage: - - .. code-block:: console - - $ python example.py echo spam - spam - $ python example.py echo --capitalize spam - SPAM - - - A *real* example - ---------------- - - Something more complex and real-world-*ish*. The code: - - .. code-block:: python - - from mando import command, main - - - @command - def push(repository, all=False, dry_run=False, force=False, thin=False): - '''Update remote refs along with associated objects. - - :param repository: Repository to push to. - :param --all: Push all refs. - :param -n, --dry-run: Dry run. - :param -f, --force: Force updates. - :param --thin: Use thin pack.''' - - print ('Pushing to {0}. All: {1}, dry run: {2}, force: {3}, thin: {4}' - .format(repository, all, dry_run, force, thin)) - - - if __name__ == '__main__': - main() - - mando understands Sphinx-style ``:param:``'s in the docstring, so it creates - short options and their help for you. - - .. code-block:: console - - $ python git.py push -h - usage: git.py push [-h] [--all] [-n] [-f] [--thin] repository - - Update remote refs along with associated objects. - - positional arguments: - repository Repository to push to. - - optional arguments: - -h, --help show this help message and exit - --all Push all refs. - -n, --dry-run Dry run. - -f, --force Force updates. - --thin Use thin pack. - - Let's try it! - - .. code-block:: console - - $ python git.py push --all myrepo - Pushing to myrepo. All: True, dry run: False, force: False, thin: False - $ python git.py push --all -f myrepo - Pushing to myrepo. All: True, dry run: False, force: True, thin: False - $ python git.py push --all -fn myrepo - Pushing to myrepo. All: True, dry run: True, force: True, thin: False - $ python git.py push --thin -fn myrepo - Pushing to myrepo. All: False, dry run: True, force: True, thin: True - $ python git.py push --thin - usage: git.py push [-h] [--all] [-n] [-f] [--thin] repository - git.py push: error: too few arguments - - Amazed uh? Yes, mando got the short options and the help from the docstring! - You can put much more in the docstring, and if that isn't enough, there's an - ``@arg`` decorator to customize the arguments that get passed to argparse. - - - Type annotations - ---------------- - - mando understands Python 3-style type annotations and will warn the user if the - arguments given to a command are of the wrong type. - - .. code-block:: python - - from mando import command, main - - - @command - def duplicate(string, times: int): - '''Duplicate text. - - :param string: The text to duplicate. - :param times: How many times to duplicate.''' - - print(string * times) - - - if __name__ == '__main__': - main() - - .. code-block:: console - - $ python3 test.py duplicate "test " 5 - test test test test test - $ python3 test.py duplicate "test " foo - usage: test.py duplicate [-h] string times - test.py duplicate: error: argument times: invalid int value: 'foo' - - - Mando has lots of other options. For example, it supports different docstring - styles (Sphinx, Google and NumPy), supports shell autocompletion via the - ``argcomplete`` package and supports custom format classes. For a complete - documentation, visit https://mando.readthedocs.org/. - Keywords: argparse,argument parser,arguments,cli,command line,commands,decorator,dispatch,flags,getopt,options,optparse,parser,subcommands Platform: any Classifier: Development Status :: 5 - Production/Stable @@ -240,3 +33,213 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Utilities Provides-Extra: restructuredText +License-File: LICENSE + +mando: CLI interfaces for Humans! +================================= + +.. image:: https://img.shields.io/travis/rubik/mando + :alt: Travis-CI badge + :target: https://travis-ci.org/rubik/mando + +.. image:: https://img.shields.io/coveralls/rubik/mando + :alt: Coveralls badge + :target: https://coveralls.io/r/rubik/mando + +.. image:: https://img.shields.io/pypi/implementation/mando?label=%20&logo=python&logoColor=white + :alt: PyPI - Implementation + +.. image:: https://img.shields.io/pypi/v/mando + :alt: Latest release + :target: https://pypi.python.org/pypi/mando + +.. image:: https://img.shields.io/pypi/l/mando + :alt: PyPI - License + :target: https://pypi.org/project/mando/ + +.. image:: https://img.shields.io/pypi/pyversions/mando + :alt: PyPI - Python Version + :target: https://pypi.org/project/mando/ + +.. image:: https://img.shields.io/pypi/format/mando + :alt: Download format + :target: http://pythonwheels.com/ + + +mando is a wrapper around ``argparse``, and allows you to write complete CLI +applications in seconds while maintaining all the flexibility. + +Installation +------------ + +.. code-block:: console + + $ pip install mando + +The problem +----------- + +While ``argparse`` is great for simple command line applications with only +one, default command, when you have to add multiple commands and manage them +things get really messy and long. But don't worry, mando comes to help! + +Quickstart +---------- + +.. code-block:: python + + from mando import command, main + + @command + def echo(text, capitalize=False): + '''Echo the given text.''' + if capitalize: + text = text.upper() + print(text) + + if __name__ == '__main__': + main() + +Generated help: + +.. code-block:: console + + $ python example.py -h + usage: example.py [-h] {echo} ... + + positional arguments: + {echo} + echo Echo the given text. + + optional arguments: + -h, --help show this help message and exit + + $ python example.py echo -h + usage: example.py echo [-h] [--capitalize] text + + Echo the given text. + + positional arguments: + text + + optional arguments: + -h, --help show this help message and exit + --capitalize + +Actual usage: + +.. code-block:: console + + $ python example.py echo spam + spam + $ python example.py echo --capitalize spam + SPAM + + +A *real* example +---------------- + +Something more complex and real-world-*ish*. The code: + +.. code-block:: python + + from mando import command, main + + + @command + def push(repository, all=False, dry_run=False, force=False, thin=False): + '''Update remote refs along with associated objects. + + :param repository: Repository to push to. + :param --all: Push all refs. + :param -n, --dry-run: Dry run. + :param -f, --force: Force updates. + :param --thin: Use thin pack.''' + + print ('Pushing to {0}. All: {1}, dry run: {2}, force: {3}, thin: {4}' + .format(repository, all, dry_run, force, thin)) + + + if __name__ == '__main__': + main() + +mando understands Sphinx-style ``:param:``'s in the docstring, so it creates +short options and their help for you. + +.. code-block:: console + + $ python git.py push -h + usage: git.py push [-h] [--all] [-n] [-f] [--thin] repository + + Update remote refs along with associated objects. + + positional arguments: + repository Repository to push to. + + optional arguments: + -h, --help show this help message and exit + --all Push all refs. + -n, --dry-run Dry run. + -f, --force Force updates. + --thin Use thin pack. + +Let's try it! + +.. code-block:: console + + $ python git.py push --all myrepo + Pushing to myrepo. All: True, dry run: False, force: False, thin: False + $ python git.py push --all -f myrepo + Pushing to myrepo. All: True, dry run: False, force: True, thin: False + $ python git.py push --all -fn myrepo + Pushing to myrepo. All: True, dry run: True, force: True, thin: False + $ python git.py push --thin -fn myrepo + Pushing to myrepo. All: False, dry run: True, force: True, thin: True + $ python git.py push --thin + usage: git.py push [-h] [--all] [-n] [-f] [--thin] repository + git.py push: error: too few arguments + +Amazed uh? Yes, mando got the short options and the help from the docstring! +You can put much more in the docstring, and if that isn't enough, there's an +``@arg`` decorator to customize the arguments that get passed to argparse. + + +Type annotations +---------------- + +mando understands Python 3-style type annotations and will warn the user if the +arguments given to a command are of the wrong type. + +.. code-block:: python + + from mando import command, main + + + @command + def duplicate(string, times: int): + '''Duplicate text. + + :param string: The text to duplicate. + :param times: How many times to duplicate.''' + + print(string * times) + + + if __name__ == '__main__': + main() + +.. code-block:: console + + $ python3 test.py duplicate "test " 5 + test test test test test + $ python3 test.py duplicate "test " foo + usage: test.py duplicate [-h] string times + test.py duplicate: error: argument times: invalid int value: 'foo' + + +Mando has lots of other options. For example, it supports different docstring +styles (Sphinx, Google and NumPy), supports shell autocompletion via the +``argcomplete`` package and supports custom format classes. For a complete +documentation, visit https://mando.readthedocs.org/. + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mando-0.7.0/docs/usage.rst new/mando-0.7.1/docs/usage.rst --- old/mando-0.7.0/docs/usage.rst 2020-03-16 12:01:40.000000000 +0100 +++ new/mando-0.7.1/docs/usage.rst 2022-02-24 08:55:29.000000000 +0100 @@ -239,6 +239,7 @@ If running Python 3, mando can use type annotations to convert argument types. Since type annotations can be any callable, this allows more flexibility than the hard-coded list of types permitted by the docstring method:: + from mando import command, main # Note: don't actually do this. @@ -261,6 +262,7 @@ main() .. code-block:: console + $ python3 test.py dup "test " 2 test test test test $ python3 test.py dup "test " foo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mando-0.7.0/mando/__init__.py new/mando-0.7.1/mando/__init__.py --- old/mando-0.7.0/mando/__init__.py 2020-03-16 12:03:14.000000000 +0100 +++ new/mando-0.7.1/mando/__init__.py 2022-02-24 09:11:35.000000000 +0100 @@ -1,4 +1,4 @@ -__version__ = '0.7.0' +__version__ = '0.7.1' try: from mando.core import Program diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mando-0.7.0/mando/tests/run.py new/mando-0.7.1/mando/tests/run.py --- old/mando-0.7.0/mando/tests/run.py 2020-03-16 12:01:40.000000000 +0100 +++ new/mando-0.7.1/mando/tests/run.py 2022-02-24 09:00:32.000000000 +0100 @@ -1,6 +1,10 @@ #!/usr/bin/python if __name__ == '__main__': + import sys import pytest - pytest.main(['--strict']) + if sys.version_info[:2] >= (3, 10): + pytest.main(['--strict-markers']) + else: + pytest.main(['--strict']) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mando-0.7.0/mando/tests/test_google.py new/mando-0.7.1/mando/tests/test_google.py --- old/mando-0.7.0/mando/tests/test_google.py 2020-03-16 12:01:40.000000000 +0100 +++ new/mando-0.7.1/mando/tests/test_google.py 2022-02-24 08:59:21.000000000 +0100 @@ -1,3 +1,4 @@ +import sys import pytest from mando import Program @@ -32,7 +33,9 @@ assert result == program.execute(args) assert program.parse(args)[0].__name__ == program._current_command - +ending = 'al arguments' +if sys.version_info[:2] >= (3, 10): + ending = 's' GOOGLE_DOCSTRING_HELP_CASES = [ ('simple_google_docstring --help 2 --arg2=test', '''usage: example.py simple_google_docstring [-h] [--arg2 ARG2] arg1 @@ -41,10 +44,10 @@ positional arguments: arg1 Description of `arg1` -optional arguments: +option%s: -h, --help show this help message and exit --arg2 ARG2 Description of `arg2` -'''), +''' % ending), ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mando-0.7.0/mando/tests/test_numpy.py new/mando-0.7.1/mando/tests/test_numpy.py --- old/mando-0.7.0/mando/tests/test_numpy.py 2020-03-16 12:01:40.000000000 +0100 +++ new/mando-0.7.1/mando/tests/test_numpy.py 2022-02-24 08:59:21.000000000 +0100 @@ -1,3 +1,4 @@ +import sys import pytest from mando import Program @@ -37,7 +38,9 @@ assert result == program.execute(args) assert program.parse(args)[0].__name__ == program._current_command - +ending = 'al arguments' +if sys.version_info[:2] >= (3, 10): + ending = 's' NUMPY_DOCSTRING_HELP_CASES = [ ('simple_numpy_docstring --help 2 --arg2=test', '''usage: example.py simple_numpy_docstring [-h] [--arg2 ARG2] arg1 @@ -46,10 +49,10 @@ positional arguments: arg1 Description of `arg1` -optional arguments: +option%s: -h, --help show this help message and exit --arg2 ARG2 Description of `arg2` -'''), +''' % ending), ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mando-0.7.0/mando.egg-info/PKG-INFO new/mando-0.7.1/mando.egg-info/PKG-INFO --- old/mando-0.7.0/mando.egg-info/PKG-INFO 2020-03-16 15:45:49.000000000 +0100 +++ new/mando-0.7.1/mando.egg-info/PKG-INFO 2022-02-24 09:12:20.000000000 +0100 @@ -1,219 +1,12 @@ Metadata-Version: 2.1 Name: mando -Version: 0.7.0 +Version: 0.7.1 Summary: Create Python CLI apps with little to no effort at all! Home-page: https://mando.readthedocs.org/ +Download-URL: https://pypi.python.org/mando/ Author: Michele Lacchia Author-email: michelelacc...@gmail.com License: MIT -Download-URL: https://pypi.python.org/mando/ -Description: mando: CLI interfaces for Humans! - ================================= - - .. image:: https://img.shields.io/travis/rubik/mando - :alt: Travis-CI badge - :target: https://travis-ci.org/rubik/mando - - .. image:: https://img.shields.io/coveralls/rubik/mando - :alt: Coveralls badge - :target: https://coveralls.io/r/rubik/mando - - .. image:: https://img.shields.io/pypi/implementation/mando?label=%20&logo=python&logoColor=white - :alt: PyPI - Implementation - - .. image:: https://img.shields.io/pypi/v/mando - :alt: Latest release - :target: https://pypi.python.org/pypi/mando - - .. image:: https://img.shields.io/pypi/l/mando - :alt: PyPI - License - :target: https://pypi.org/project/mando/ - - .. image:: https://img.shields.io/pypi/pyversions/mando - :alt: PyPI - Python Version - :target: https://pypi.org/project/mando/ - - .. image:: https://img.shields.io/pypi/format/mando - :alt: Download format - :target: http://pythonwheels.com/ - - - mando is a wrapper around ``argparse``, and allows you to write complete CLI - applications in seconds while maintaining all the flexibility. - - Installation - ------------ - - .. code-block:: console - - $ pip install mando - - The problem - ----------- - - While ``argparse`` is great for simple command line applications with only - one, default command, when you have to add multiple commands and manage them - things get really messy and long. But don't worry, mando comes to help! - - Quickstart - ---------- - - .. code-block:: python - - from mando import command, main - - @command - def echo(text, capitalize=False): - '''Echo the given text.''' - if capitalize: - text = text.upper() - print(text) - - if __name__ == '__main__': - main() - - Generated help: - - .. code-block:: console - - $ python example.py -h - usage: example.py [-h] {echo} ... - - positional arguments: - {echo} - echo Echo the given text. - - optional arguments: - -h, --help show this help message and exit - - $ python example.py echo -h - usage: example.py echo [-h] [--capitalize] text - - Echo the given text. - - positional arguments: - text - - optional arguments: - -h, --help show this help message and exit - --capitalize - - Actual usage: - - .. code-block:: console - - $ python example.py echo spam - spam - $ python example.py echo --capitalize spam - SPAM - - - A *real* example - ---------------- - - Something more complex and real-world-*ish*. The code: - - .. code-block:: python - - from mando import command, main - - - @command - def push(repository, all=False, dry_run=False, force=False, thin=False): - '''Update remote refs along with associated objects. - - :param repository: Repository to push to. - :param --all: Push all refs. - :param -n, --dry-run: Dry run. - :param -f, --force: Force updates. - :param --thin: Use thin pack.''' - - print ('Pushing to {0}. All: {1}, dry run: {2}, force: {3}, thin: {4}' - .format(repository, all, dry_run, force, thin)) - - - if __name__ == '__main__': - main() - - mando understands Sphinx-style ``:param:``'s in the docstring, so it creates - short options and their help for you. - - .. code-block:: console - - $ python git.py push -h - usage: git.py push [-h] [--all] [-n] [-f] [--thin] repository - - Update remote refs along with associated objects. - - positional arguments: - repository Repository to push to. - - optional arguments: - -h, --help show this help message and exit - --all Push all refs. - -n, --dry-run Dry run. - -f, --force Force updates. - --thin Use thin pack. - - Let's try it! - - .. code-block:: console - - $ python git.py push --all myrepo - Pushing to myrepo. All: True, dry run: False, force: False, thin: False - $ python git.py push --all -f myrepo - Pushing to myrepo. All: True, dry run: False, force: True, thin: False - $ python git.py push --all -fn myrepo - Pushing to myrepo. All: True, dry run: True, force: True, thin: False - $ python git.py push --thin -fn myrepo - Pushing to myrepo. All: False, dry run: True, force: True, thin: True - $ python git.py push --thin - usage: git.py push [-h] [--all] [-n] [-f] [--thin] repository - git.py push: error: too few arguments - - Amazed uh? Yes, mando got the short options and the help from the docstring! - You can put much more in the docstring, and if that isn't enough, there's an - ``@arg`` decorator to customize the arguments that get passed to argparse. - - - Type annotations - ---------------- - - mando understands Python 3-style type annotations and will warn the user if the - arguments given to a command are of the wrong type. - - .. code-block:: python - - from mando import command, main - - - @command - def duplicate(string, times: int): - '''Duplicate text. - - :param string: The text to duplicate. - :param times: How many times to duplicate.''' - - print(string * times) - - - if __name__ == '__main__': - main() - - .. code-block:: console - - $ python3 test.py duplicate "test " 5 - test test test test test - $ python3 test.py duplicate "test " foo - usage: test.py duplicate [-h] string times - test.py duplicate: error: argument times: invalid int value: 'foo' - - - Mando has lots of other options. For example, it supports different docstring - styles (Sphinx, Google and NumPy), supports shell autocompletion via the - ``argcomplete`` package and supports custom format classes. For a complete - documentation, visit https://mando.readthedocs.org/. - Keywords: argparse,argument parser,arguments,cli,command line,commands,decorator,dispatch,flags,getopt,options,optparse,parser,subcommands Platform: any Classifier: Development Status :: 5 - Production/Stable @@ -240,3 +33,213 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Utilities Provides-Extra: restructuredText +License-File: LICENSE + +mando: CLI interfaces for Humans! +================================= + +.. image:: https://img.shields.io/travis/rubik/mando + :alt: Travis-CI badge + :target: https://travis-ci.org/rubik/mando + +.. image:: https://img.shields.io/coveralls/rubik/mando + :alt: Coveralls badge + :target: https://coveralls.io/r/rubik/mando + +.. image:: https://img.shields.io/pypi/implementation/mando?label=%20&logo=python&logoColor=white + :alt: PyPI - Implementation + +.. image:: https://img.shields.io/pypi/v/mando + :alt: Latest release + :target: https://pypi.python.org/pypi/mando + +.. image:: https://img.shields.io/pypi/l/mando + :alt: PyPI - License + :target: https://pypi.org/project/mando/ + +.. image:: https://img.shields.io/pypi/pyversions/mando + :alt: PyPI - Python Version + :target: https://pypi.org/project/mando/ + +.. image:: https://img.shields.io/pypi/format/mando + :alt: Download format + :target: http://pythonwheels.com/ + + +mando is a wrapper around ``argparse``, and allows you to write complete CLI +applications in seconds while maintaining all the flexibility. + +Installation +------------ + +.. code-block:: console + + $ pip install mando + +The problem +----------- + +While ``argparse`` is great for simple command line applications with only +one, default command, when you have to add multiple commands and manage them +things get really messy and long. But don't worry, mando comes to help! + +Quickstart +---------- + +.. code-block:: python + + from mando import command, main + + @command + def echo(text, capitalize=False): + '''Echo the given text.''' + if capitalize: + text = text.upper() + print(text) + + if __name__ == '__main__': + main() + +Generated help: + +.. code-block:: console + + $ python example.py -h + usage: example.py [-h] {echo} ... + + positional arguments: + {echo} + echo Echo the given text. + + optional arguments: + -h, --help show this help message and exit + + $ python example.py echo -h + usage: example.py echo [-h] [--capitalize] text + + Echo the given text. + + positional arguments: + text + + optional arguments: + -h, --help show this help message and exit + --capitalize + +Actual usage: + +.. code-block:: console + + $ python example.py echo spam + spam + $ python example.py echo --capitalize spam + SPAM + + +A *real* example +---------------- + +Something more complex and real-world-*ish*. The code: + +.. code-block:: python + + from mando import command, main + + + @command + def push(repository, all=False, dry_run=False, force=False, thin=False): + '''Update remote refs along with associated objects. + + :param repository: Repository to push to. + :param --all: Push all refs. + :param -n, --dry-run: Dry run. + :param -f, --force: Force updates. + :param --thin: Use thin pack.''' + + print ('Pushing to {0}. All: {1}, dry run: {2}, force: {3}, thin: {4}' + .format(repository, all, dry_run, force, thin)) + + + if __name__ == '__main__': + main() + +mando understands Sphinx-style ``:param:``'s in the docstring, so it creates +short options and their help for you. + +.. code-block:: console + + $ python git.py push -h + usage: git.py push [-h] [--all] [-n] [-f] [--thin] repository + + Update remote refs along with associated objects. + + positional arguments: + repository Repository to push to. + + optional arguments: + -h, --help show this help message and exit + --all Push all refs. + -n, --dry-run Dry run. + -f, --force Force updates. + --thin Use thin pack. + +Let's try it! + +.. code-block:: console + + $ python git.py push --all myrepo + Pushing to myrepo. All: True, dry run: False, force: False, thin: False + $ python git.py push --all -f myrepo + Pushing to myrepo. All: True, dry run: False, force: True, thin: False + $ python git.py push --all -fn myrepo + Pushing to myrepo. All: True, dry run: True, force: True, thin: False + $ python git.py push --thin -fn myrepo + Pushing to myrepo. All: False, dry run: True, force: True, thin: True + $ python git.py push --thin + usage: git.py push [-h] [--all] [-n] [-f] [--thin] repository + git.py push: error: too few arguments + +Amazed uh? Yes, mando got the short options and the help from the docstring! +You can put much more in the docstring, and if that isn't enough, there's an +``@arg`` decorator to customize the arguments that get passed to argparse. + + +Type annotations +---------------- + +mando understands Python 3-style type annotations and will warn the user if the +arguments given to a command are of the wrong type. + +.. code-block:: python + + from mando import command, main + + + @command + def duplicate(string, times: int): + '''Duplicate text. + + :param string: The text to duplicate. + :param times: How many times to duplicate.''' + + print(string * times) + + + if __name__ == '__main__': + main() + +.. code-block:: console + + $ python3 test.py duplicate "test " 5 + test test test test test + $ python3 test.py duplicate "test " foo + usage: test.py duplicate [-h] string times + test.py duplicate: error: argument times: invalid int value: 'foo' + + +Mando has lots of other options. For example, it supports different docstring +styles (Sphinx, Google and NumPy), supports shell autocompletion via the +``argcomplete`` package and supports custom format classes. For a complete +documentation, visit https://mando.readthedocs.org/. + +