diff --git a/.travis.yml b/.travis.yml index 16246cb8..3f44d69c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,35 +3,28 @@ python: - "2.7" - "3.4" - "3.5" - - "3.6" -# Workaround for testing Python 3.7: -# https://github.com/travis-ci/travis-ci/issues/9815 -matrix: - include: - - python: 3.7 - dist: xenial - sudo: yes + - "3.7" + - "3.8" + before_install: - pip install --upgrade setuptools pip - pip install --upgrade pylint pytest pytest-pylint pytest-runner + install: - - pip install termcolor - - pip install hypothesis python-Levenshtein + - pip install termcolor hypothesis python-Levenshtein + - if [[ $TRAVIS_PYTHON_VERSION != 3.4 ]]; then pip install pytype; fi - python setup.py develop + script: - python -m pytest # Run the tests without IPython. - pip install ipython - python -m pytest # Now run the tests with IPython. - pylint fire --ignore=test_components_py3.py,parser_fuzz_test.py,console - - if [[ $TRAVIS_PYTHON_VERSION != 3.4 ]]; then - pip install pytype; - fi # Run type-checking, excluding files that define or use py3 features in py2. - if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then pytype -x fire/fire_test.py fire/inspectutils_test.py fire/test_components_py3.py; - elif [[ $TRAVIS_PYTHON_VERSION != 3.4 ]]; then - pytype; fi + - if [[ $TRAVIS_PYTHON_VERSION == 3.* && $TRAVIS_PYTHON_VERSION != 3.4 ]]; then pytype; fi diff --git a/README.md b/README.md index 1482d56d..f5b2ad43 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Python Fire [![PyPI](https://img.shields.io/pypi/pyversions/fire.svg?style=plastic)](https://github.com/google/python-fire) +# Python Fire [![PyPI](https://img.shields.io/pypi/pyversions/fire.svg?style=plastic)](https://github.com/google/python-fire) [![Build Status](https://travis-ci.org/google/python-fire.svg?branch=master)](https://travis-ci.org/google/python-fire) _Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object._ diff --git a/fire/completion.py b/fire/completion.py index 451e2021..5c5ad490 100644 --- a/fire/completion.py +++ b/fire/completion.py @@ -320,10 +320,15 @@ def MemberVisible(component, name, member, class_attrs=None, verbose=False): if class_attrs is None: class_attrs = inspectutils.GetClassAttrsDict(class_attrs) or {} class_attr = class_attrs.get(name) - if class_attr and class_attr.kind in ('method', 'property'): - # methods and properties should be accessed on instantiated objects, - # not uninstantiated classes. - return False + if class_attr: + if class_attr.kind in ('method', 'property'): + # methods and properties should be accessed on instantiated objects, + # not uninstantiated classes. + return False + tuplegetter = getattr(collections, '_tuplegetter', type(None)) + if isinstance(class_attr.object, tuplegetter): + # backward compatibility: namedtuple attributes were properties + return False if (six.PY2 and inspect.isfunction(component) and name in ('func_closure', 'func_code', 'func_defaults', 'func_dict', 'func_doc', 'func_globals', 'func_name')): diff --git a/setup.py b/setup.py index 0047fa95..efd3f766 100644 --- a/setup.py +++ b/setup.py @@ -70,6 +70,7 @@ 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Operating System :: OS Independent', 'Operating System :: POSIX',