diff options
-rw-r--r-- | .appveyor.yml | 5 | ||||
-rw-r--r-- | .travis.yml | 6 | ||||
-rw-r--r-- | CONTRIBUTING.md | 2 | ||||
-rwxr-xr-x | README.md | 4 | ||||
-rw-r--r-- | azure-pipelines.yml | 3 | ||||
-rw-r--r-- | cmd2/cmd2.py | 7 | ||||
-rw-r--r-- | cmd2/pyscript_bridge.py | 8 | ||||
-rw-r--r-- | docs/index.rst | 2 | ||||
-rw-r--r-- | docs/install.rst | 8 | ||||
-rwxr-xr-x | setup.py | 10 | ||||
-rw-r--r-- | tests/conftest.py | 7 | ||||
-rw-r--r-- | tox.ini | 2 |
12 files changed, 19 insertions, 45 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index 69ab4b6a..4e32ee1a 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -4,9 +4,8 @@ environment: PYTHONUNBUFFERED: 1 MINICONDA: C:\\Miniconda3-x64 matrix: -# Disable Python 3.5 testing on AppVeyor for now until we fix issue with mock module install for python < 3.6 -# - PYTHON: "C:\\Python35" -# TOX_ENV: "py35" + - PYTHON: "C:\\Python35" + TOX_ENV: "py35" - PYTHON: "C:\\Python36" TOX_ENV: "py36" diff --git a/.travis.yml b/.travis.yml index fc9c65bd..1946b48e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,6 @@ sudo: false # false enables container-based build for fast boot times on Linux matrix: include: - os: linux - python: 3.4 - env: TOXENV=py34 - - os: linux python: 3.5 env: TOXENV=py35 - os: linux @@ -19,6 +16,9 @@ matrix: sudo: true # Travis CI doesn't yet support official (non-development) Python 3.7 on container-based builds env: TOXENV=py37 - os: linux + python: 3.8-dev + env: TOXENV=py38 + - os: linux python: 3.5 env: TOXENV=docs # # Warning: Don't try to use code coverage analysis with pypy as it is insanely slow diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 95185efe..e40f698c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,7 +46,7 @@ The tables below list all prerequisites along with the minimum required version | Prerequisite | Minimum Version | | --------------------------------------------------- | --------------- | -| [python](https://www.python.org/downloads/) | `3.4` | +| [python](https://www.python.org/downloads/) | `3.5` | | [attrs](https://github.com/python-attrs/attrs) | `16.3` | | [colorama](https://github.com/tartley/colorama) | `0.3.7` | | [pyperclip](https://github.com/asweigart/pyperclip) | `1.5.27` | @@ -38,7 +38,7 @@ Main Features - Unicode character support - Good tab-completion of commands, sub-commands, file system paths, and shell commands - Automatic tab-completion of `argparse` flags when using one of the `cmd2` `argparse` decorators -- Support for Python 3.4+ on Windows, macOS, and Linux +- Support for Python 3.5+ on Windows, macOS, and Linux - Trivial to provide built-in help for all commands - Built-in regression testing framework for your applications (transcript-based testing) - Transcripts for use with built-in regression can be automatically generated from `history -t` or `load -t` @@ -59,7 +59,7 @@ On all operating systems, the latest stable version of `cmd2` can be installed u pip install -U cmd2 ``` -cmd2 works with Python 3.4+ on Windows, macOS, and Linux. It is pure Python code with few 3rd-party dependencies. +cmd2 works with Python 3.5+ on Windows, macOS, and Linux. It is pure Python code with few 3rd-party dependencies. For information on other installation options, see [Installation Instructions](https://cmd2.readthedocs.io/en/latest/install.html) in the cmd2 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 906ae1e3..9a05153b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -14,9 +14,6 @@ jobs: # Run the pipeline with multiple Python versions strategy: matrix: - Python34: - python.version: '3.4' - TOXENV: 'py34' Python35: python.version: '3.5' TOXENV: 'py35' diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 02462d96..226e0df7 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -39,6 +39,7 @@ import re import sys import threading from collections import namedtuple +from contextlib import redirect_stdout from typing import Any, Callable, Dict, List, Mapping, Optional, Tuple, Type, Union, IO import colorama @@ -103,12 +104,6 @@ except ImportError: return True return NotImplemented -# Python 3.4 require contextlib2 for temporarily redirecting stderr and stdout -if sys.version_info < (3, 5): - # noinspection PyUnresolvedReferences - from contextlib2 import redirect_stdout -else: - from contextlib import redirect_stdout # Detect whether IPython is installed to determine if the built-in "ipy" command should be included ipython_available = True diff --git a/cmd2/pyscript_bridge.py b/cmd2/pyscript_bridge.py index e5633173..31c1ab9c 100644 --- a/cmd2/pyscript_bridge.py +++ b/cmd2/pyscript_bridge.py @@ -5,17 +5,11 @@ degree of isolation between the two """ import sys +from contextlib import redirect_stdout, redirect_stderr from typing import Optional from .utils import namedtuple_with_defaults, StdSim -# Python 3.4 require contextlib2 for temporarily redirecting stderr and stdout -if sys.version_info < (3, 5): - # noinspection PyUnresolvedReferences - from contextlib2 import redirect_stdout, redirect_stderr -else: - from contextlib import redirect_stdout, redirect_stderr - class CommandResult(namedtuple_with_defaults('CommandResult', ['stdout', 'stderr', 'stop', 'data'])): """Encapsulates the results from a cmd2 app command diff --git a/docs/index.rst b/docs/index.rst index 31bb4771..5f9c4c3d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -73,7 +73,7 @@ Contents: Compatibility ============= -Tested and working with Python 3.4+ on Windows, macOS, and Linux. +Tested and working with Python 3.5+ on Windows, macOS, and Linux. Index ===== diff --git a/docs/install.rst b/docs/install.rst index b0710916..62765704 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -6,7 +6,7 @@ This section covers the basics of how to install, upgrade, and uninstall ``cmd2` Installing ---------- -First you need to make sure you have Python 3.4+, pip_, and setuptools_. Then you can just use pip to +First you need to make sure you have Python 3.5+, pip_, and setuptools_. Then you can just use pip to install from PyPI_. .. _pip: https://pypi.python.org/pypi/pip @@ -25,7 +25,7 @@ install from PyPI_. Requirements for Installing ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* If you have Python 3 >=3.4 installed from `python.org +* If you have Python 3 >=3.5 installed from `python.org <https://www.python.org>`_, you will already have pip_ and setuptools_, but may need to upgrade to the latest versions: @@ -124,10 +124,6 @@ If you wish to permanently uninstall ``cmd2``, this can also easily be done with pip uninstall cmd2 -Extra requirements for Python 3.4 ---------------------------------- -``cmd2`` requires the ``contextlib2`` module for Python 3.4. This is used to temporarily redirect -stdout and stderr. Also when using Python 3.4, ``cmd2`` requires the ``typing`` module backport. Extra requirement for macOS =========================== @@ -21,10 +21,10 @@ Intended Audience :: System Administrators License :: OSI Approved :: MIT License Programming Language :: Python Programming Language :: Python :: 3 -Programming Language :: Python :: 3.4 Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 +Programming Language :: Python :: 3.8 Programming Language :: Python :: Implementation :: CPython Topic :: Software Development :: Libraries :: Python Modules """.splitlines()))) # noqa: E128 @@ -36,14 +36,12 @@ INSTALL_REQUIRES = ['pyperclip >= 1.5.27', 'colorama', 'attrs >= 16.3.0', 'wcwid EXTRAS_REQUIRE = { # Windows also requires pyreadline to ensure tab completion works ":sys_platform=='win32'": ['pyreadline'], - # Python 3.4 and earlier require contextlib2 for temporarily redirecting stderr and stdout - ":python_version<'3.5'": ['contextlib2', 'typing'], # Extra dependencies for running unit tests 'test': ["gnureadline; sys_platform=='darwin'", # include gnureadline on macOS to ensure it is available in tox env - "mock ; python_version<'3.6'", # for python 3.5 and earlier we need the third party mock module + "mock ; python_version<'3.6'", # for python 3.5 we need the third party mock module 'codecov', 'pytest', 'pytest-cov', 'pytest-mock'], # development only dependencies: install with 'pip install -e .[dev]' - 'dev': ["mock ; python_version<'3.6'", # for python 3.5 and earlier we need the third party mock module + 'dev': ["mock ; python_version<'3.6'", # for python 3.5 we need the third party mock module 'pytest', 'codecov', 'pytest-cov', 'pytest-mock', 'tox', 'pylint', 'sphinx', 'sphinx-rtd-theme', 'sphinx-autobuild', 'invoke', 'twine>=1.11', ] @@ -63,7 +61,7 @@ setup( platforms=['any'], packages=['cmd2'], keywords='command prompt console cmd', - python_requires='>=3.4', + python_requires='>=3.5', setup_requires=SETUP_REQUIRES, install_requires=INSTALL_REQUIRES, extras_require=EXTRAS_REQUIRE, diff --git a/tests/conftest.py b/tests/conftest.py index 517e2865..1e124219 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,6 +3,7 @@ Cmd2 unit/functional testing """ import sys +from contextlib import redirect_stdout, redirect_stderr from typing import Optional from unittest import mock @@ -11,12 +12,6 @@ from pytest import fixture import cmd2 from cmd2.utils import StdSim -# Python 3.4 require contextlib2 for temporarily redirecting stderr and stdout -if sys.version_info < (3, 5): - # noinspection PyUnresolvedReferences - from contextlib2 import redirect_stdout, redirect_stderr -else: - from contextlib import redirect_stdout, redirect_stderr # Prefer statically linked gnureadline if available (for macOS compatibility due to issues with libedit) try: @@ -1,5 +1,5 @@ [tox] -envlist = docs,py34,py35,py36,py37 +envlist = docs,py35,py36,py37,py38 [pytest] testpaths = tests |