Skip to content

Commit b375999

Browse files
authored
Merge pull request #700 from python-cmd2/deprecate_34
Deprecate Python 3.4 and add support and testing for Python 3.8
2 parents 57ac00c + 7a30803 commit b375999

File tree

12 files changed

+24
-45
lines changed

12 files changed

+24
-45
lines changed

.travis.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
language: python
22

3-
sudo: false # false enables container-based build for fast boot times on Linux
4-
53
matrix:
64
include:
7-
- os: linux
8-
python: 3.4
9-
env: TOXENV=py34
105
- os: linux
116
python: 3.5
127
env: TOXENV=py35
@@ -16,8 +11,11 @@ matrix:
1611
- os: linux
1712
python: 3.7
1813
dist: xenial
19-
sudo: true # Travis CI doesn't yet support official (non-development) Python 3.7 on container-based builds
2014
env: TOXENV=py37
15+
- os: linux
16+
python: 3.8-dev
17+
dist: xenial
18+
env: TOXENV=py38
2119
- os: linux
2220
python: 3.5
2321
env: TOXENV=docs

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.9.14 (TBD, 2019
2+
* Enhancements
3+
* Added support for and testing with Python 3.8, starting with 3.8 beta
4+
* Breaking Changes
5+
* Python 3.4 reached its [end of life](https://www.python.org/dev/peps/pep-0429/) on March 18, 2019 and is no longer supported by `cmd2`
6+
17
## 0.9.13 (June 14, 2019)
28
* Bug Fixes
39
* Fixed issue where the wrong terminator was being appended by `Statement.expanded_command_line()`

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The tables below list all prerequisites along with the minimum required version
4646

4747
| Prerequisite | Minimum Version |
4848
| --------------------------------------------------- | --------------- |
49-
| [python](https://www.python.org/downloads/) | `3.4` |
49+
| [python](https://www.python.org/downloads/) | `3.5` |
5050
| [attrs](https://github.com/python-attrs/attrs) | `16.3` |
5151
| [colorama](https://github.com/tartley/colorama) | `0.3.7` |
5252
| [pyperclip](https://github.com/asweigart/pyperclip) | `1.5.27` |

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Main Features
3838
- Unicode character support
3939
- Good tab-completion of commands, sub-commands, file system paths, and shell commands
4040
- Automatic tab-completion of `argparse` flags when using one of the `cmd2` `argparse` decorators
41-
- Support for Python 3.4+ on Windows, macOS, and Linux
41+
- Support for Python 3.5+ on Windows, macOS, and Linux
4242
- Trivial to provide built-in help for all commands
4343
- Built-in regression testing framework for your applications (transcript-based testing)
4444
- 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
5959
pip install -U cmd2
6060
```
6161

62-
cmd2 works with Python 3.4+ on Windows, macOS, and Linux. It is pure Python code with few 3rd-party dependencies.
62+
cmd2 works with Python 3.5+ on Windows, macOS, and Linux. It is pure Python code with few 3rd-party dependencies.
6363

6464
For information on other installation options, see
6565
[Installation Instructions](https://cmd2.readthedocs.io/en/latest/install.html) in the cmd2

azure-pipelines.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ jobs:
1414
# Run the pipeline with multiple Python versions
1515
strategy:
1616
matrix:
17-
Python34:
18-
python.version: '3.4'
19-
TOXENV: 'py34'
2017
Python35:
2118
python.version: '3.5'
2219
TOXENV: 'py35'

cmd2/cmd2.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import sys
4040
import threading
4141
from collections import namedtuple
42+
from contextlib import redirect_stdout
4243
from typing import Any, Callable, Dict, List, Mapping, Optional, Tuple, Type, Union, IO
4344

4445
import colorama
@@ -103,12 +104,6 @@ def __subclasshook__(cls, C):
103104
return True
104105
return NotImplemented
105106

106-
# Python 3.4 require contextlib2 for temporarily redirecting stderr and stdout
107-
if sys.version_info < (3, 5):
108-
# noinspection PyUnresolvedReferences
109-
from contextlib2 import redirect_stdout
110-
else:
111-
from contextlib import redirect_stdout
112107

113108
# Detect whether IPython is installed to determine if the built-in "ipy" command should be included
114109
ipython_available = True

cmd2/pyscript_bridge.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,11 @@
55
"""
66

77
import sys
8+
from contextlib import redirect_stdout, redirect_stderr
89
from typing import Optional
910

1011
from .utils import namedtuple_with_defaults, StdSim
1112

12-
# Python 3.4 require contextlib2 for temporarily redirecting stderr and stdout
13-
if sys.version_info < (3, 5):
14-
# noinspection PyUnresolvedReferences
15-
from contextlib2 import redirect_stdout, redirect_stderr
16-
else:
17-
from contextlib import redirect_stdout, redirect_stderr
18-
1913

2014
class CommandResult(namedtuple_with_defaults('CommandResult', ['stdout', 'stderr', 'stop', 'data'])):
2115
"""Encapsulates the results from a cmd2 app command

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Contents:
7373
Compatibility
7474
=============
7575

76-
Tested and working with Python 3.4+ on Windows, macOS, and Linux.
76+
Tested and working with Python 3.5+ on Windows, macOS, and Linux.
7777

7878
Index
7979
=====

docs/install.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This section covers the basics of how to install, upgrade, and uninstall ``cmd2`
66

77
Installing
88
----------
9-
First you need to make sure you have Python 3.4+, pip_, and setuptools_. Then you can just use pip to
9+
First you need to make sure you have Python 3.5+, pip_, and setuptools_. Then you can just use pip to
1010
install from PyPI_.
1111

1212
.. _pip: https://pypi.python.org/pypi/pip
@@ -25,7 +25,7 @@ install from PyPI_.
2525

2626
Requirements for Installing
2727
~~~~~~~~~~~~~~~~~~~~~~~~~~~
28-
* If you have Python 3 >=3.4 installed from `python.org
28+
* If you have Python 3 >=3.5 installed from `python.org
2929
<https://www.python.org>`_, you will already have pip_ and
3030
setuptools_, but may need to upgrade to the latest versions:
3131

@@ -124,10 +124,6 @@ If you wish to permanently uninstall ``cmd2``, this can also easily be done with
124124

125125
pip uninstall cmd2
126126

127-
Extra requirements for Python 3.4
128-
---------------------------------
129-
``cmd2`` requires the ``contextlib2`` module for Python 3.4. This is used to temporarily redirect
130-
stdout and stderr. Also when using Python 3.4, ``cmd2`` requires the ``typing`` module backport.
131127

132128
Extra requirement for macOS
133129
===========================

setup.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
License :: OSI Approved :: MIT License
2222
Programming Language :: Python
2323
Programming Language :: Python :: 3
24-
Programming Language :: Python :: 3.4
2524
Programming Language :: Python :: 3.5
2625
Programming Language :: Python :: 3.6
2726
Programming Language :: Python :: 3.7
27+
Programming Language :: Python :: 3.8
2828
Programming Language :: Python :: Implementation :: CPython
2929
Topic :: Software Development :: Libraries :: Python Modules
3030
""".splitlines()))) # noqa: E128
@@ -36,14 +36,12 @@
3636
EXTRAS_REQUIRE = {
3737
# Windows also requires pyreadline to ensure tab completion works
3838
":sys_platform=='win32'": ['pyreadline'],
39-
# Python 3.4 and earlier require contextlib2 for temporarily redirecting stderr and stdout
40-
":python_version<'3.5'": ['contextlib2', 'typing'],
4139
# Extra dependencies for running unit tests
4240
'test': ["gnureadline; sys_platform=='darwin'", # include gnureadline on macOS to ensure it is available in tox env
43-
"mock ; python_version<'3.6'", # for python 3.5 and earlier we need the third party mock module
41+
"mock ; python_version<'3.6'", # for python 3.5 we need the third party mock module
4442
'codecov', 'pytest', 'pytest-cov', 'pytest-mock'],
4543
# development only dependencies: install with 'pip install -e .[dev]'
46-
'dev': ["mock ; python_version<'3.6'", # for python 3.5 and earlier we need the third party mock module
44+
'dev': ["mock ; python_version<'3.6'", # for python 3.5 we need the third party mock module
4745
'pytest', 'codecov', 'pytest-cov', 'pytest-mock', 'tox', 'pylint',
4846
'sphinx', 'sphinx-rtd-theme', 'sphinx-autobuild', 'invoke', 'twine>=1.11',
4947
]
@@ -63,7 +61,7 @@
6361
platforms=['any'],
6462
packages=['cmd2'],
6563
keywords='command prompt console cmd',
66-
python_requires='>=3.4',
64+
python_requires='>=3.5',
6765
setup_requires=SETUP_REQUIRES,
6866
install_requires=INSTALL_REQUIRES,
6967
extras_require=EXTRAS_REQUIRE,

0 commit comments

Comments
 (0)