Hello community, here is the log from the commit of package python-entrypoint2 for openSUSE:Factory checked in at 2020-10-29 09:45:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-entrypoint2 (Old) and /work/SRC/openSUSE:Factory/.python-entrypoint2.new.3463 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-entrypoint2" Thu Oct 29 09:45:48 2020 rev:16 rq:835984 version:0.2.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-entrypoint2/python-entrypoint2.changes 2020-08-20 22:31:38.220060128 +0200 +++ /work/SRC/openSUSE:Factory/.python-entrypoint2.new.3463/python-entrypoint2.changes 2020-10-29 09:46:04.916042557 +0100 @@ -1,0 +2,9 @@ +Thu Sep 17 11:06:16 UTC 2020 - Dirk Mueller <[email protected]> + +- update to 0.2.1: + * readme conversion to markdown + * pytest and readme updates + * code formatting improvements +- remove remove_nose.patch (upstream) + +------------------------------------------------------------------- Old: ---- entrypoint2-0.2.tar.gz remove_nose.patch New: ---- entrypoint2-0.2.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-entrypoint2.spec ++++++ --- /var/tmp/diff_new_pack.vmGIIq/_old 2020-10-29 09:46:05.564043168 +0100 +++ /var/tmp/diff_new_pack.vmGIIq/_new 2020-10-29 09:46:05.568043172 +0100 @@ -26,15 +26,13 @@ %bcond_with test %endif Name: python-entrypoint2 -Version: 0.2 +Version: 0.2.1 Release: 0 Summary: Command-line interface for python modules License: BSD-2-Clause Group: Development/Languages/Python URL: https://github.com/ponty/entrypoint2 Source: https://github.com/ponty/entrypoint2/archive/%{version}.tar.gz#/entrypoint2-%{version}.tar.gz -# https://github.com/ponty/entrypoint2/pull/6 -Patch0: remove_nose.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -57,7 +55,6 @@ %prep %setup -q -n entrypoint2-%{version} -%patch0 -p1 # argparse is py2.6 or older sed -i -e '/argparse/d' requirements.txt @@ -74,13 +71,13 @@ %if %{with test} %check -%pytest tests/test.py +%pytest tests/test_all.py %endif %if !%{with test} %files %{python_files} %license LICENSE.txt -%doc README.rst +%doc README.md %{python_sitelib}/* %endif ++++++ entrypoint2-0.2.tar.gz -> entrypoint2-0.2.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/.travis.yml new/entrypoint2-0.2.1/.travis.yml --- old/entrypoint2-0.2/.travis.yml 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/.travis.yml 2020-05-02 18:49:41.000000000 +0200 @@ -13,14 +13,25 @@ python: 3.8 dist: bionic + - name: "Python 3.7 on macOS" + os: osx + osx_image: xcode11.2 + language: shell # 'language: python' is an error on Travis CI macOS + env: PATH=/Users/travis/Library/Python/3.7/bin:$PATH USER=--user + + - name: "Python 3.8 on Windows" + os: windows # Windows 10.0.17134 N/A Build 17134 + language: shell # 'language: python' is an error on Travis CI Windows + before_install: + - choco install python --version 3.8 + - python -m pip install --upgrade pip + env: PATH=/c/Python38:/c/Python38/Scripts:$PATH + install: - - pip install coveralls - - pip install -r requirements-test.txt - - pip install --upgrade . + - if [ "$TRAVIS_PYTHON_VERSION" == "2.7" ]; then PIP=pip; else PIP=pip3; fi + - $PIP install $USER --upgrade -r requirements-test.txt + - $PIP install $USER --upgrade . script: - cd tests - - nosetests -v --with-coverage --cover-package=entrypoint2 . - -after_success: - - coveralls + - pytest -v . diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/MANIFEST.in new/entrypoint2-0.2.1/MANIFEST.in --- old/entrypoint2-0.2/MANIFEST.in 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/MANIFEST.in 2020-05-02 18:49:41.000000000 +0200 @@ -7,3 +7,4 @@ include README* include setup.py prune docs/_build +graft tests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/README.md new/entrypoint2-0.2.1/README.md --- old/entrypoint2-0.2/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/entrypoint2-0.2.1/README.md 2020-05-02 18:49:41.000000000 +0200 @@ -0,0 +1,156 @@ +entrypoint2 is an easy to use [argparse][2] based command-line interface for python modules. +It translates function signature and documentation to [argparse][2] configuration. + + +Links: + + * home: https://github.com/ponty/entrypoint2 + * PYPI: https://pypi.python.org/pypi/entrypoint2 + +[](https://travis-ci.org/ponty/entrypoint2) + +Goals: + + - simplicity: only one decorator to add to existing code + +Features: + + - good for protoyping or simple CLI + - generate CLI parameters from function signature + - generate CLI documentation from python documentation + - the decorated function has the same behavior as without the entrypoint2 decorator + - boolean parameters are toggle flags (e.g. ``--verbose``) + - function signature is preserved so it can be called both from command-line and external module + - function name, doc and module are preserved so it can be used with sphinx [autodoc][1] + - sphinx [autodoc][1] documentation style is supported: ``:param x: this is x`` + - automatic ``--version`` flag, which prints version variable from the current module + (``__version__``, ``VERSION``, ..) + - automatic ``--debug`` flag, which turns on logging + - short flags are generated from long flags automatically (e.g. ``--parameter`` -> ``-p``) + - supported python versions: 2.7, 3.6, 3.7, 3.8 + - support for repeating arguments + +Basic usage +============ + +Example (entrypoint2/examples/hello.py): + + import logging + + from entrypoint2 import entrypoint + + __version__ = "3.2" + + + @entrypoint + def add(one, two=4, three=False): + """ This function adds two numbers. + + :param one: first number to add + :param two: second number to add + :param three: print hello + :rtype: int + """ + s = int(one) + int(two) + logging.debug(s) + print(s) + if three: + print("hello") + return s + +Adding numbers: + + $ python3 -m entrypoint2.examples.hello 1 + 5 + $ python3 -m entrypoint2.examples.hello 1 --two 1 + 2 + +Short flag: + + $ python3 -m entrypoint2.examples.hello 1 -t 1 + 2 + +Boolean parameter: + + $ python3 -m entrypoint2.examples.hello 1 --three + 5 + hello + +Logging: + + $ python3 -m entrypoint2.examples.hello 1 --debug + 2020-05-02 18:20:19,864: root - DEBUG - 5 + 5 + +Missing positional parameter: + + $ python3 -m entrypoint2.examples.hello + usage: hello.py [-h] [-t TWO] [--three] [--debug] [--version] one + hello.py: error: the following arguments are required: one + +Generated help: + + $ python3 -m entrypoint2.examples.hello --help + usage: hello.py [-h] [-t TWO] [--three] [--debug] [--version] one + + This function adds two numbers. + + positional arguments: + one first number to add + + optional arguments: + -h, --help show this help message and exit + -t TWO, --two TWO second number to add + --three print hello + --debug set logging level to DEBUG + --version show program's version number and exit + +Printing version: + + $ python3 -m entrypoint2.examples.hello --version + 3.2 + +Repeating arguments +-------------------- + +Example (entrypoint2/examples/repeating.py):: + + from entrypoint2 import entrypoint + + @entrypoint + def main(files=[]): + """ This function has repeating arguments. + :param files: test input + """ + print(files) + +Only string list is supported + + +Printing help: + + $ python3 -m entrypoint2.examples.repeating --help + usage: repeating.py [-h] [-f FILES] [--debug] + + This function has repeating arguments. + + optional arguments: + -h, --help show this help message and exit + -f FILES, --files FILES + test input + --debug set logging level to DEBUG + +Repeating flag: + + $ python3 -m entrypoint2.examples.repeating -f input1.txt -f input2.txt + ['input1.txt', 'input2.txt'] + +installation: + + pip3 install entrypoint2 + + +[1]: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html +[2]: http://docs.python.org/dev/library/argparse.html + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/README.rst new/entrypoint2-0.2.1/README.rst --- old/entrypoint2-0.2/README.rst 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/README.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,115 +0,0 @@ -entrypoint2 is an easy to use argparse_ based command-line interface for python modules, fork of `entrypoint <http://pypi.python.org/pypi/entrypoint/>`_. -It translates function signature and documentation to argparse_ configuration. - - -Links: - - * home: https://github.com/ponty/entrypoint2 - * documentation: http://entrypoint2.readthedocs.org - * PYPI: https://pypi.python.org/pypi/entrypoint2 - -|Travis| |Coveralls| |Latest Version| |Supported Python versions| |License| |Documentation| - -Goals: - - - simplicity: only one decorator to add to existing code - -Features: - - - good for protoyping or simple CLI - - generate CLI parameters from function signature - - generate CLI documentation from python documentation - - the decorated function has the same behavior as without the entrypoint2 decorator - - boolean parameters are toggle flags (e.g. ``--verbose``) - - function signature is preserved so it can be called both from command-line and external module - - function name, doc and module are preserved so it can be used with sphinx autodoc_ - - sphinx autodoc_ documentation style is supported: ``:param x: this is x`` - - automatic ``--version`` flag, which prints version variable from the current module - (``__version__``, ``VERSION``, ..) - - automatic ``--debug`` flag, which turns on logging - - short flags are generated from long flags automatically (e.g. ``--parameter`` -> ``-p``) - - unit tests - - supported python versions: 2.7, 3.6, 3.7, 3.8 - - support for repeating arguments - -Similar projects: - - * `entrypoint <http://pypi.python.org/pypi/entrypoint/>`_ - * `plac <http://micheles.googlecode.com/hg/plac/doc/plac.html>`_ - * `baker <http://bitbucket.org/mchaput/baker>`_ - * `argh <http://packages.python.org/argh/>`_ - * `opster <http://pypi.python.org/pypi/opster/>`_ - * `commandline <http://pypi.python.org/pypi/commandline>`_ - * `optfunc <https://github.com/simonw/optfunc>`_: this has the same concept - * `commando (1) <http://freshmeat.net/projects/commando>`_ - * `commando (2) <https://github.com/lakshmivyas/commando>`_ - * argparse_ - * `optparse <http://docs.python.org/library/optparse.html>`_ - * `plumbum <https://github.com/tomerfiliba/plumbum>`_ - -Basic usage -============ - -Example:: - - from entrypoint2 import entrypoint - - __version__ = '3.2' - - @entrypoint - def add(one, two=4, three=False): - ''' This function adds three numbers. - - one: first number to add - two: second number to add - ''' - -Generated help:: - - $ python3 -m entrypoint2.examples.hello --help - usage: hello.py [-h] [-t TWO] [--three] [--version] [--debug] one - - This function adds two number. - - positional arguments: - one first number to add - - optional arguments: - -h, --help show this help message and exit - -t TWO, --two TWO second number to add - --three - --version show program's version number and exit - --debug set logging level to DEBUG - -Printing version:: - - $ python3 -m entrypoint2.examples.hello --version - 3.2 - - -Installation -============ - -install:: - - pip install entrypoint2 - -.. _entrypoint: http://pypi.python.org/pypi/entrypoint/ -.. _autodoc: http://sphinx.pocoo.org/ext/autodoc.html -.. _argparse: http://docs.python.org/dev/library/argparse.html - -.. |Travis| image:: http://img.shields.io/travis/ponty/entrypoint2.svg - :target: https://travis-ci.org/ponty/entrypoint2/ -.. |Coveralls| image:: http://img.shields.io/coveralls/ponty/entrypoint2/master.svg - :target: https://coveralls.io/r/ponty/entrypoint2/ -.. |Latest Version| image:: https://img.shields.io/pypi/v/entrypoint2.svg - :target: https://pypi.python.org/pypi/entrypoint2/ -.. |Supported Python versions| image:: https://img.shields.io/pypi/pyversions/entrypoint2.svg - :target: https://pypi.python.org/pypi/entrypoint2/ -.. |License| image:: https://img.shields.io/pypi/l/entrypoint2.svg - :target: https://pypi.python.org/pypi/entrypoint2/ -.. |Code Health| image:: https://landscape.io/github/ponty/entrypoint2/master/landscape.svg?style=flat - :target: https://landscape.io/github/ponty/entrypoint2/master -.. |Documentation| image:: https://readthedocs.org/projects/pyscreenshot/badge/?version=latest - :target: http://entrypoint2.readthedocs.org - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/Vagrantfile new/entrypoint2-0.2.1/Vagrantfile --- old/entrypoint2-0.2/Vagrantfile 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/Vagrantfile 2020-05-02 18:49:41.000000000 +0200 @@ -66,7 +66,6 @@ # documentation for more information about their specific syntax and use. $script = " export DEBIAN_FRONTEND=noninteractive - echo 'export distutils_issue8876_workaround_enabled=1' >> /home/vagrant/.profile echo 'export export LC_ALL=C' >> /home/vagrant/.profile # install python versions @@ -80,14 +79,13 @@ # tools sudo apt-get install -y mc -sudo apt-get install -y python-pip sudo apt-get install -y python3-pip # test dependencies - sudo pip install -r /vagrant/requirements-test.txt +sudo pip3 install -U tox # doc dependencies - sudo pip install -r /vagrant/requirements-doc.txt +# sudo pip install -r /vagrant/requirements-doc.txt " config.vm.provision "shell", inline: $script diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/docs/api.rst new/entrypoint2-0.2.1/docs/api.rst --- old/entrypoint2-0.2/docs/api.rst 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/docs/api.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -API -=== - -.. automodule:: entrypoint2 - :members: entrypoint, UsageError diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/docs/conf.py new/entrypoint2-0.2.1/docs/conf.py --- old/entrypoint2-0.2/docs/conf.py 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/docs/conf.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,56 +0,0 @@ -import os -import sys - - -project = 'entrypoint2' -author = 'ponty' -copyright = '2011, ponty' - -__version__ = None -exec(open(os.path.join('..', project.lower(), 'about.py')).read()) -release = __version__ - -sys.path.insert(0, os.path.abspath('..')) - -# Extension -extensions = [ - # -*-Extensions: -*- - 'sphinx.ext.autodoc', - # 'sphinxcontrib.programoutput', - # 'sphinxcontrib.programscreenshot', - # 'sphinx.ext.graphviz', - # 'sphinxcontrib.autorun', - # 'sphinx.ext.autosummary', - # 'sphinx.ext.intersphinx', -] -intersphinx_mapping = {'http://docs.python.org/': None} - -# Source -master_doc = 'index' -templates_path = ['_templates'] -source_suffix = '.rst' -exclude_trees = [] -pygments_style = 'sphinx' - -# html build settings -html_theme = 'default' -html_static_path = ['_static'] - -# htmlhelp settings -htmlhelp_basename = '%sdoc' % project - -# latex build settings -latex_documents = [ - ('index', '%s.tex' % project, u'%s Documentation' % project, - author, 'manual'), -] - - -# remove blank pages from pdf -# http://groups.google.com/group/sphinx- -# dev/browse_thread/thread/92e19267d095412d/d60dcba483c6b13d -latex_font_size = '10pt,oneside' - -latex_elements = dict( - papersize='a4paper', -) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/docs/index.rst new/entrypoint2-0.2.1/docs/index.rst --- old/entrypoint2-0.2/docs/index.rst 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/docs/index.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,14 +0,0 @@ -=========== -entrypoint2 -=========== - - - -About -===== - - -.. include:: ../README.rst - -.. include:: api.rst - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/entrypoint2/__init__.py new/entrypoint2-0.2.1/entrypoint2/__init__.py --- old/entrypoint2-0.2/entrypoint2/__init__.py 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/entrypoint2/__init__.py 2020-05-02 18:49:41.000000000 +0200 @@ -1,14 +1,11 @@ from __future__ import with_statement -# from contextlib import nested -from decorator import decorator + import argparse -import textwrap -import codecs import inspect +import logging import re import sys -import logging - +import textwrap """ This is a library of decorators designed for writing scripts quickly. This @@ -58,7 +55,7 @@ """ -ENCODING = 'utf8' +ENCODING = "utf8" PY3 = sys.version_info[0] >= 3 @@ -72,7 +69,7 @@ def module_version(func): version = None - for v in '__version__ VERSION version'.split(): + for v in "__version__ VERSION version".split(): if PY3: version = func.__globals__.get(v) else: @@ -84,16 +81,18 @@ class ParagraphPreservingArgParseFormatter(argparse.HelpFormatter): def __init__(self, *args, **kwargs): - super(ParagraphPreservingArgParseFormatter, - self).__init__(*args, **kwargs) - self._long_break_matcher = argparse._re.compile(r'\n\n+') + super(ParagraphPreservingArgParseFormatter, self).__init__(*args, **kwargs) + self._long_break_matcher = argparse._re.compile(r"\n\n+") def _fill_text(self, text, width, indent): output = [] for block in self._long_break_matcher.split(text.strip()): - output.append(textwrap.fill(block, width, - initial_indent=indent, subsequent_indent=indent)) - return "\n\n".join(output + ['']) + output.append( + textwrap.fill( + block, width, initial_indent=indent, subsequent_indent=indent + ) + ) + return "\n\n".join(output + [""]) class UsageError(Exception): @@ -106,11 +105,9 @@ def __init__(self, message): super(Exception, self).__init__(message) self.message = message - pass class FileUsageError(UsageError): - def __init__(self, e): """ Convert an IOError into a UsageError. @@ -123,7 +120,6 @@ """ Used for define-time errors with withfile specs. """ - pass def _parse_doc(docs): @@ -143,8 +139,9 @@ name = "(?:[a-zA-Z][a-zA-Z0-9-_]*)" re_var = re.compile(r"^ *(%s)(?: */(%s))? *:(.*)$" % (name, name)) - re_opt = re.compile(r"^ *(?:(-[a-zA-Z0-9]),? +)?--(%s)(?: *=(%s))? *:(.*)$" - % (name, name)) + re_opt = re.compile( + r"^ *(?:(-[a-zA-Z0-9]),? +)?--(%s)(?: *=(%s))? *:(.*)$" % (name, name) + ) shorts, metavars, helps, description, epilog = {}, {}, {}, "", "" @@ -155,11 +152,11 @@ line = line.strip() # remove starting ':param' - if line.startswith(':param'): - line = line[len(':param'):] + if line.startswith(":param"): + line = line[len(":param") :] # skip ':rtype:' row - if line.startswith(':rtype:'): + if line.startswith(":rtype:"): continue if line.strip() == "----": @@ -274,28 +271,29 @@ raise Exception("Can't wrap a function with **kwargs") # Compulsary positional options - needed = args[0:len(args) - len(defaults)] + needed = args[0 : len(args) - len(defaults)] # Optional flag options - params = args[len(needed):] + params = args[len(needed) :] shorts, metavars, helps, description, epilog = _parse_doc(func.__doc__) parser = argparse.ArgumentParser( description=description, epilog=epilog, - formatter_class=ParagraphPreservingArgParseFormatter) + formatter_class=ParagraphPreservingArgParseFormatter, + ) # special flags special_flags = [] - special_flags += ['debug'] + special_flags += ["debug"] defaults += (False,) - helps['debug'] = 'set logging level to DEBUG' + helps["debug"] = "set logging level to DEBUG" if module_version(func): - special_flags += ['version'] + special_flags += ["version"] defaults += (False,) - helps['version'] = "show program's version number and exit" + helps["version"] = "show program's version number and exit" params += special_flags # Optional flag options @@ -310,54 +308,54 @@ first_char = param[0] if first_char not in used_shorts: used_shorts.add(first_char) - short = '-' + first_char + short = "-" + first_char # -h conflicts with 'help' - if short and short != '-h': + if short and short != "-h": args = [short] + args - kwargs = {'default': default, 'dest': param.replace("-", "_")} + kwargs = {"default": default, "dest": param.replace("-", "_")} - if param == 'version': - kwargs['action'] = 'version' - kwargs['version'] = module_version(func) + if param == "version": + kwargs["action"] = "version" + kwargs["version"] = module_version(func) elif default is True: - kwargs['action'] = 'store_false' + kwargs["action"] = "store_false" elif default is False: - kwargs['action'] = 'store_true' + kwargs["action"] = "store_true" elif isinstance(default, list): - kwargs['action'] = 'append' -# default is not working -# if len(default): -# first = default[0] -# if type(first) in [type(None), unicode]: -# kwargs['type'] = unidecode -# else: -# kwargs['type'] = type(first) -# kwargs['default'] = [] -# else: - kwargs['type'] = unidecode + kwargs["action"] = "append" + # default is not working + # if len(default): + # first = default[0] + # if type(first) in [type(None), unicode]: + # kwargs['type'] = unidecode + # else: + # kwargs['type'] = type(first) + # kwargs['default'] = [] + # else: + kwargs["type"] = unidecode else: - kwargs['action'] = 'store' + kwargs["action"] = "store" if type(default) in [type(None), str if PY3 else unicode]: - kwargs['type'] = unidecode + kwargs["type"] = unidecode else: - kwargs['type'] = type(default) + kwargs["type"] = type(default) if param in helps: - kwargs['help'] = helps[param] + kwargs["help"] = helps[param] if param in metavars: - kwargs['metavar'] = metavars[param] + kwargs["metavar"] = metavars[param] parser.add_argument(*args, **kwargs) # Compulsary positional options for need in needed: - kwargs = {'action': 'store', 'type': unidecode} + kwargs = {"action": "store", "type": unidecode} if need in helps: - kwargs['help'] = helps[need] + kwargs["help"] = helps[need] if need in shorts: args = [shorts[need]] @@ -368,17 +366,17 @@ # The trailing arguments if trail: - kwargs = {'action': 'store', 'type': unidecode, 'nargs': "*"} + kwargs = {"action": "store", "type": unidecode, "nargs": "*"} if trail in helps: - kwargs['help'] = helps[trail] + kwargs["help"] = helps[trail] if trail in shorts: - kwargs['metavar'] = shorts[trail] + kwargs["metavar"] = shorts[trail] else: - kwargs['metavar'] = trail + kwargs["metavar"] = trail - parser.add_argument('__args', **kwargs) + parser.add_argument("__args", **kwargs) return parser @@ -389,7 +387,7 @@ for passing to the function. """ args = inspect.getargspec(func)[0] - return [kwargs[arg] for arg in args] + kwargs['__args'] + return [kwargs[arg] for arg in args] + kwargs["__args"] def entrypoint(func): @@ -409,7 +407,7 @@ it is run. """ frame_local = sys._getframe(1).f_locals - if '__name__' in frame_local and frame_local['__name__'] == '__main__': + if "__name__" in frame_local and frame_local["__name__"] == "__main__": argv = sys.argv[1:] parser = signature_parser(func) @@ -422,17 +420,16 @@ # if kwargs.get('version'): # print module_version(func) # return - if 'version' in kwargs.keys(): - del kwargs['version'] + if "version" in kwargs.keys(): + del kwargs["version"] # --debug - FORMAT = '%(asctime)-6s: %(name)s - %(levelname)s - %(message)s' - if kwargs.get('debug'): + FORMAT = "%(asctime)-6s: %(name)s - %(levelname)s - %(message)s" + if kwargs.get("debug"): logging.basicConfig( - level=logging.DEBUG, - format=FORMAT, + level=logging.DEBUG, format=FORMAT, ) - del kwargs['debug'] + del kwargs["debug"] if "__args" in kwargs: return func(*_correct_args(func, kwargs)) @@ -460,7 +457,7 @@ """ frame_local = sys._getframe(_depth).f_locals - if '__name__' in frame_local and frame_local['__name__'] == '__main__': + if "__name__" in frame_local and frame_local["__name__"] == "__main__": func(argv=sys.argv[1:]) return func @@ -489,7 +486,7 @@ parser = signature_parser(func) def main(*args, **kw): - argv = kw.get('argv', None) + argv = kw.get("argv", None) if argv == None: return func(*args, **kw) else: @@ -502,13 +499,13 @@ # if kwargs.get('version'): # print module_version(func) # return - if 'version' in kwargs.keys(): - del kwargs['version'] + if "version" in kwargs.keys(): + del kwargs["version"] # --debug - if kwargs.get('debug'): + if kwargs.get("debug"): logging.basicConfig(level=logging.DEBUG) - del kwargs['debug'] + del kwargs["debug"] if "__args" in kwargs: return func(*_correct_args(func, kwargs)) @@ -525,6 +522,16 @@ return main -__all__ = ['UsageError', 'FileUsageError', 'acceptargv', 'argparse', - 'autorun', 'entrypoint', 'entrywithfile', 'runwithfile', - 'signature_parser', 'withfile', 'withuserfile'] +__all__ = [ + "UsageError", + "FileUsageError", + "acceptargv", + "argparse", + "autorun", + "entrypoint", + "entrywithfile", + "runwithfile", + "signature_parser", + "withfile", + "withuserfile", +] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/entrypoint2/about.py new/entrypoint2-0.2.1/entrypoint2/about.py --- old/entrypoint2-0.2/entrypoint2/about.py 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/entrypoint2/about.py 2020-05-02 18:49:41.000000000 +0200 @@ -1 +1 @@ -__version__ = '0.2' +__version__ = "0.2.1" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/entrypoint2/examples/caller.py new/entrypoint2-0.2.1/entrypoint2/examples/caller.py --- old/entrypoint2-0.2/entrypoint2/examples/caller.py 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/entrypoint2/examples/caller.py 2020-05-02 18:49:41.000000000 +0200 @@ -1,15 +1,16 @@ +import logging + import hello from entrypoint2 import entrypoint -import logging -__version__ = '5.2' +__version__ = "5.2" @entrypoint def f(): - ''' calls hello - ''' + """ calls hello + """ s = hello.add(7, 2) - logging.debug('logging sum from caller.py:' + s) - print('printing sum from caller.py:' + s) + logging.debug("logging sum from caller.py:" + s) + print("printing sum from caller.py:" + s) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/entrypoint2/examples/hello.py new/entrypoint2-0.2.1/entrypoint2/examples/hello.py --- old/entrypoint2-0.2/entrypoint2/examples/hello.py 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/entrypoint2/examples/hello.py 2020-05-02 18:49:41.000000000 +0200 @@ -1,20 +1,22 @@ -from entrypoint2 import entrypoint import logging -__version__ = '3.2' +from entrypoint2 import entrypoint + +__version__ = "3.2" @entrypoint def add(one, two=4, three=False): - ''' This function adds two number. + """ This function adds two numbers. :param one: first number to add :param two: second number to add + :param three: print hello :rtype: int - ''' - s = str(int(one) + int(two)) - - logging.debug('logging sum from hello.py:' + s) - print('printing sum from hello.py:' + s) - + """ + s = int(one) + int(two) + logging.debug(s) + print(s) + if three: + print("hello") return s diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/entrypoint2/examples/repeating.py new/entrypoint2-0.2.1/entrypoint2/examples/repeating.py --- old/entrypoint2-0.2/entrypoint2/examples/repeating.py 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/entrypoint2/examples/repeating.py 2020-05-02 18:49:41.000000000 +0200 @@ -3,7 +3,7 @@ @entrypoint def main(files=[]): - ''' This function has repeating arguments. + """ This function has repeating arguments. :param files: test input - ''' + """ print(files) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/format-code.sh new/entrypoint2-0.2.1/format-code.sh --- old/entrypoint2-0.2/format-code.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/entrypoint2-0.2.1/format-code.sh 2020-05-02 18:49:41.000000000 +0200 @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +autoflake -i -r --remove-all-unused-imports . +autoflake -i -r --remove-unused-variables . +isort --recursive . +black . diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/pavement.py new/entrypoint2-0.2.1/pavement.py --- old/entrypoint2-0.2/pavement.py 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/pavement.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -from path import Path -from paver.doctools import cog, html -from paver.easy import options -from paver.options import Bunch -from paver.setuputils import setup - - -IMPORTS = [cog, html, setup] - -options( - cog=Bunch( - basedir='.', - pattern='README.rst', - includedir='entrypoint2', - beginspec='#--', - endspec='--#', - endoutput='#-#', - ) -) - - -# get info from setup.py -setup_py = ''.join( - [x for x in Path('setup.py').lines() if 'setuptools' not in x]) -exec(setup_py) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/requirements-doc.txt new/entrypoint2-0.2.1/requirements-doc.txt --- old/entrypoint2-0.2/requirements-doc.txt 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/requirements-doc.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -paver -path.py -cogapp==2.3 -sphinx -decorator \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/requirements-test.txt new/entrypoint2-0.2.1/requirements-test.txt --- old/entrypoint2-0.2/requirements-test.txt 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/requirements-test.txt 2020-05-02 18:49:41.000000000 +0200 @@ -1,5 +1,3 @@ -tox -nose -coverage path.py -easyprocess \ No newline at end of file +easyprocess +pytest \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/requirements.txt new/entrypoint2-0.2.1/requirements.txt --- old/entrypoint2-0.2/requirements.txt 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/requirements.txt 2020-05-02 18:49:41.000000000 +0200 @@ -1,3 +1,2 @@ -decorator argparse diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/setup.py new/entrypoint2-0.2.1/setup.py --- old/entrypoint2-0.2/setup.py 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/setup.py 2020-05-02 18:49:41.000000000 +0200 @@ -1,23 +1,22 @@ -from setuptools import setup -import sys import os -if os.environ.get('distutils_issue8876_workaround_enabled', False): - # sdist_hack: Remove reference to os.link to disable using hardlinks when - # building setup.py's sdist target. This is done because - # VirtualBox VMs shared filesystems don't support hardlinks. - del os.link - -NAME = 'entrypoint2' -URL = 'https://github.com/ponty/entrypoint2' -DESCRIPTION = 'easy to use command-line interface for python modules, fork of entrypoint' -PACKAGES = [NAME, - NAME + '.examples', - ] +from setuptools import setup + +NAME = "entrypoint2" +URL = "https://github.com/ponty/entrypoint2" +DESCRIPTION = "easy to use command-line interface for python modules" +LONG_DESCRIPTION = """easy to use command-line interface for Python modules + +home: https://github.com/ponty/entrypoint2""" + +PACKAGES = [ + NAME, + NAME + ".examples", +] # get __version__ __version__ = None -exec(open(os.path.join(NAME, 'about.py')).read()) +exec(open(os.path.join(NAME, "about.py")).read()) VERSION = __version__ # extra = {} @@ -30,7 +29,6 @@ "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", - "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", @@ -40,23 +38,22 @@ "Programming Language :: Python :: 3.8", ] -install_requires = ['decorator', 'argparse'] +install_requires = ["argparse"] # compatible with distutils of python 2.3+ or later setup( name=NAME, version=VERSION, description=DESCRIPTION, - long_description=open('README.rst', 'r').read(), + long_description=LONG_DESCRIPTION, classifiers=classifiers, - keywords='argparse decorator optparse signature command-line', - author='ponty', + keywords="argparse decorator optparse signature command-line", + author="ponty", # author_email='', url=URL, - license='BSD', + license="BSD", packages=PACKAGES, # include_package_data=True, - # test_suite='nose.collector', # zip_safe=False, install_requires=install_requires, # **extra diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/tests/example1.py new/entrypoint2-0.2.1/tests/example1.py --- old/entrypoint2-0.2/tests/example1.py 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/tests/example1.py 2020-05-02 18:49:41.000000000 +0200 @@ -1,15 +1,15 @@ from entrypoint2 import entrypoint -__version__ = '3.2' +__version__ = "3.2" # 'hi': test conflict with -h (--help) @entrypoint def f(one, two=4, three=False, hi=7): - ''' description + """ description one: par1 two: par2 - ''' + """ return one diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/tests/example2.py new/entrypoint2-0.2.1/tests/example2.py --- old/entrypoint2-0.2/tests/example2.py 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/tests/example2.py 2020-05-02 18:49:41.000000000 +0200 @@ -1,7 +1,8 @@ -from entrypoint2 import entrypoint import logging -VERSION = '1.2' +from entrypoint2 import entrypoint + +VERSION = "1.2" @entrypoint diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/tests/test.py new/entrypoint2-0.2.1/tests/test.py --- old/entrypoint2-0.2/tests/test.py 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/tests/test.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,145 +0,0 @@ -from easyprocess import EasyProcess -from nose.tools import eq_, ok_ -from path import Path -import sys - -python = sys.executable - -d = Path(__file__).parent -example1_py = d / 'example1.py' -example2_py = d / 'example2.py' -example3_py = d / 'example3.py' - -PY3 = sys.version_info[0] >= 3 - - -def test_1_call(): - import example1 - eq_(example1.f(3), 3) - eq_('description' in example1.f.__doc__, True) - eq_(example1.f.__name__, 'f') - - -def test_2_call(): - import example2 - eq_(example2.f(5, 1), 6) - eq_(example2.f.__doc__, None) - eq_(example2.f.__name__, 'f') - - -def test_3_call(): - import example3 - eq_(example3.f(), 7) - eq_(example3.f.__doc__, None) - eq_(example3.f.__name__, 'f') - - -def test_1_cli(): - cmd = [python, example1_py, '5'] - p = EasyProcess(cmd).call() - eq_(p.return_code, 0) - eq_(p.stdout, '') - eq_(p.stderr, '') - - cmd = [python, example1_py, '5', '--two', '7', '--debug'] - p = EasyProcess(cmd).call() - eq_(p.return_code, 0) - eq_(p.stdout, '') - eq_(p.stderr, '') - - cmd = [python, example1_py, '5', '--three', '-t', '2', '--debug'] - p = EasyProcess(cmd).call() - eq_(p.return_code, 0) - eq_(p.stdout, '') - eq_(p.stderr, '') - - cmd = [python, example1_py, '5', '-t', 'x'] - p = EasyProcess(cmd).call() - eq_(p.return_code > 0, 1) - eq_(p.stdout, '') - eq_(p.stderr != '', 1) - - cmd = [python, example1_py, '-t', '1', '5', '--debug'] - p = EasyProcess(cmd).call() - eq_(p.return_code, 0) - eq_(p.stdout, '') - eq_(p.stderr, '') - - -def test_2_cli(): - cmd = [python, example2_py, '5', '2'] - p = EasyProcess(cmd).call() - eq_(p.return_code, 0) - eq_(p.stdout, '') - eq_(p.stderr, '') - - cmd = [python, example2_py, '--debug', '5', '2'] - p = EasyProcess(cmd).call() - eq_(p.return_code, 0) - eq_(p.stdout, '') - ok_('root - DEBUG - 5' in p.stderr) - - -def test_3_cli(): - cmd = [python, example3_py] - p = EasyProcess(cmd).call() - eq_(p.return_code, 0) - eq_(p.stdout, '') - eq_(p.stderr, '') - - -def test_1_ver(): - cmd = [python, example1_py, '--version'] - p = EasyProcess(cmd).call() - if PY3: - eq_(p.stderr, '') - eq_(p.stdout, '3.2') - else: - eq_(p.stdout, '') - eq_(p.stderr, '3.2') - eq_(p.return_code, 0) - - -def test_2_ver(): - cmd = [python, example2_py, '--version'] - p = EasyProcess(cmd).call() - if PY3: - eq_(p.stderr, '') - eq_(p.stdout, '1.2') - else: - eq_(p.stdout, '') - eq_(p.stderr, '1.2') - eq_(p.return_code, 0) - - -def test_3_ver(): - cmd = [python, example3_py, '--version'] - p = EasyProcess(cmd).call() - eq_(p.stdout, '') - ok_(p.stderr) - ok_(p.return_code != 0) - - -def test_1_help(): - cmd = [python, example1_py, '--help'] - p = EasyProcess(cmd).call() - eq_(p.stderr, '') - eq_(p.return_code, 0) - eq_('one' in p.stdout, 1) - eq_('--two' in p.stdout, 1) - eq_('-t' in p.stdout, 1) - eq_('--three' in p.stdout, 1) - - -def test_2_help(): - cmd = [python, example2_py, '--help'] - p = EasyProcess(cmd).call() - eq_(p.stderr, '') - eq_(p.return_code, 0) - - -def test_3_help(): - cmd = [python, example3_py, '--help'] - p = EasyProcess(cmd).call() - eq_(p.stderr, '') - eq_(p.return_code, 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/tests/test_all.py new/entrypoint2-0.2.1/tests/test_all.py --- old/entrypoint2-0.2/tests/test_all.py 1970-01-01 01:00:00.000000000 +0100 +++ new/entrypoint2-0.2.1/tests/test_all.py 2020-05-02 18:49:41.000000000 +0200 @@ -0,0 +1,148 @@ +import sys + +from easyprocess import EasyProcess +from path import Path + +python = sys.executable + +d = Path(__file__).parent +example1_py = d / "example1.py" +example2_py = d / "example2.py" +example3_py = d / "example3.py" + +PY3 = sys.version_info[0] >= 3 + + +def test_1_call(): + import example1 + + assert example1.f(3) == 3 + assert "description" in example1.f.__doc__ + assert example1.f.__name__ == "f" + + +def test_2_call(): + import example2 + + assert example2.f(5, 1) == 6 + assert example2.f.__doc__ is None + assert example2.f.__name__ == "f" + + +def test_3_call(): + import example3 + + assert example3.f() == 7 + assert example3.f.__doc__ is None + assert example3.f.__name__ == "f" + + +def test_1_cli(): + cmd = [python, example1_py, "5"] + p = EasyProcess(cmd).call() + assert p.return_code == 0 + assert p.stdout == "" + assert p.stderr == "" + + cmd = [python, example1_py, "5", "--two", "7", "--debug"] + p = EasyProcess(cmd).call() + assert p.return_code == 0 + assert p.stdout == "" + assert p.stderr == "" + + cmd = [python, example1_py, "5", "--three", "-t", "2", "--debug"] + p = EasyProcess(cmd).call() + assert p.return_code == 0 + assert p.stdout == "" + assert p.stderr == "" + + cmd = [python, example1_py, "5", "-t", "x"] + p = EasyProcess(cmd).call() + assert p.return_code > 0 + assert p.stdout == "" + assert p.stderr != "" + + cmd = [python, example1_py, "-t", "1", "5", "--debug"] + p = EasyProcess(cmd).call() + assert p.return_code == 0 + assert p.stdout == "" + assert p.stderr == "" + + +def test_2_cli(): + cmd = [python, example2_py, "5", "2"] + p = EasyProcess(cmd).call() + assert p.return_code == 0 + assert p.stdout == "" + assert p.stderr == "" + + cmd = [python, example2_py, "--debug", "5", "2"] + p = EasyProcess(cmd).call() + assert p.return_code == 0 + assert p.stdout == "" + assert "root - DEBUG - 5" in p.stderr + + +def test_3_cli(): + cmd = [python, example3_py] + p = EasyProcess(cmd).call() + assert p.return_code == 0 + assert p.stdout == "" + assert p.stderr == "" + + +def test_1_ver(): + cmd = [python, example1_py, "--version"] + p = EasyProcess(cmd).call() + if PY3: + assert p.stderr == "" + assert p.stdout == "3.2" + else: + assert p.stdout == "" + assert p.stderr == "3.2" + assert p.return_code == 0 + + +def test_2_ver(): + cmd = [python, example2_py, "--version"] + p = EasyProcess(cmd).call() + if PY3: + assert p.stderr == "" + assert p.stdout == "1.2" + else: + assert p.stdout == "" + assert p.stderr == "1.2" + assert p.return_code == 0 + + +def test_3_ver(): + cmd = [python, example3_py, "--version"] + p = EasyProcess(cmd).call() + assert p.stdout == "" + assert p.stderr + assert p.return_code != 0 + + +def test_1_help(): + cmd = [python, example1_py, "--help"] + p = EasyProcess(cmd).call() + assert p.stderr == "" + assert p.return_code == 0 + assert "one" in p.stdout + assert "--two" in p.stdout + assert "-t" in p.stdout + assert "--three" in p.stdout + + +def test_2_help(): + cmd = [python, example2_py, "--help"] + p = EasyProcess(cmd).call() + assert p.stderr == "" + assert p.return_code == 0 + + +def test_3_help(): + cmd = [python, example3_py, "--help"] + p = EasyProcess(cmd).call() + assert p.stderr == "" + assert p.return_code == 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/entrypoint2-0.2/tox.ini new/entrypoint2-0.2.1/tox.ini --- old/entrypoint2-0.2/tox.ini 2020-01-08 19:51:12.000000000 +0100 +++ new/entrypoint2-0.2.1/tox.ini 2020-05-02 18:49:41.000000000 +0200 @@ -8,12 +8,11 @@ [testenv] deps= - nose + pytest easyprocess path.py -setenv= - PYTHONPATH= -changedir=tests -commands=nosetests --verbose +changedir=tests +commands= + pytest -v
