Skip to content

Commit

Permalink
Remove support for python < 3.6 (#1386)
Browse files Browse the repository at this point in the history
* Remove support for python2.7

Python 2.7 is officially dead and we are not going to make any new
release that supports it.

This removes py27 code but a follow-up will address other changes
like dropping the need to use six library.

* Remove python 3.5

* Restore travis

Co-authored-by: Andrey Shpak <ashpak@ashpak.ru>
  • Loading branch information
ssbarnea and insspb committed May 26, 2020
1 parent 0ee527d commit d9bd728
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 116 deletions.
40 changes: 0 additions & 40 deletions .github/workflows/main.yml
Expand Up @@ -19,24 +19,16 @@ jobs:
name:
- "linting"

- "ubuntu-py27"
- "ubuntu-py35"
- "ubuntu-py36"
- "ubuntu-py37"
- "ubuntu-py38"
- "ubuntu-pypy"
- "ubuntu-pypy3"

- "macos-py27"
- "macos-py35"
- "macos-py36"
- "macos-py37"
- "macos-py38"
- "macos-pypy"
- "macos-pypy3"

- "windows-py27"
- "windows-py35"
- "windows-py36"
- "windows-py37"
- "windows-py38"
Expand All @@ -47,14 +39,6 @@ jobs:
os: ubuntu-latest
tox_env: "lint"

- name: "ubuntu-py27"
python: "2.7"
os: ubuntu-latest
tox_env: "py27"
- name: "ubuntu-py35"
python: "3.5"
os: ubuntu-latest
tox_env: "py35"
- name: "ubuntu-py36"
python: "3.6"
os: ubuntu-latest
Expand All @@ -67,23 +51,11 @@ jobs:
python: "3.8"
os: ubuntu-latest
tox_env: "py38"
- name: "ubuntu-pypy"
python: "pypy2"
os: ubuntu-latest
tox_env: "pypy"
- name: "ubuntu-pypy3"
python: "pypy3"
os: ubuntu-latest
tox_env: "pypy3"

- name: "macos-py27"
python: "2.7"
os: macos-latest
tox_env: "py27"
- name: "macos-py35"
python: "3.5"
os: macos-latest
tox_env: "py35"
- name: "macos-py36"
python: "3.6"
os: macos-latest
Expand All @@ -96,23 +68,11 @@ jobs:
python: "3.8"
os: macos-latest
tox_env: "py38"
- name: "macos-pypy"
python: "pypy2"
os: macos-latest
tox_env: "pypy"
- name: "macos-pypy3"
python: "pypy3"
os: macos-latest
tox_env: "pypy3"

- name: "windows-py27"
python: "2.7"
os: windows-latest
tox_env: "py27"
- name: "windows-py35"
python: "3.5"
os: windows-latest
tox_env: "py35"
- name: "windows-py36"
python: "3.6"
os: windows-latest
Expand Down
47 changes: 7 additions & 40 deletions .travis.yml
Expand Up @@ -7,55 +7,23 @@ jobs:
include:
- python: 3.7
env: TOXENV=lint
- python: 2.7
env: TOXENV=py27
- python: 3.5
env: TOXENV=py35
- python: 3.6
env: TOXENV=py36
- python: 3.7
env: TOXENV=py37
- python: 3.8
env: TOXENV=py38
- python: pypy
env: TOXENV=pypy
- python: pypy3
env: TOXENV=pypy3
- name: "Python 2.7 on Windows"
os: windows
language: shell
before_install:
- choco install python2
- python --version
- python -m pip install --upgrade pip
- pip install --upgrade virtualenv wheel
- virtualenv $HOME/venv
- source $HOME/venv/Scripts/activate
env:
- TOXENV=py27
- PATH=/c/Python27:/c/Python27/Scripts:$PATH
- name: "Python 3.5 on Windows"
os: windows
language: shell
before_install:
- choco install python --version 3.5.4
- python --version
- python -m pip install --upgrade pip
- pip3 install --upgrade virtualenv wheel
- virtualenv $HOME/venv
- source $HOME/venv/Scripts/activate
env:
- TOXENV=py35
- PATH=/c/Python35:/c/Python35/Scripts:$PATH
- name: "Python 3.6 on Windows"
os: windows
language: shell
before_install:
- choco install python --version 3.6.7
- python --version
- python -m pip install --upgrade pip
- pip3 install --upgrade virtualenv wheel
- virtualenv $HOME/venv
- python -m pip install --upgrade virtualenv wheel
- python -m virtualenv $HOME/venv
- source $HOME/venv/Scripts/activate
env:
- TOXENV=py36
Expand All @@ -67,8 +35,8 @@ jobs:
- choco install python --version 3.7.2
- python --version
- python -m pip install --upgrade pip
- pip3 install --upgrade virtualenv wheel
- virtualenv $HOME/venv
- python -m pip install --upgrade virtualenv wheel
- python -m virtualenv $HOME/venv
- source $HOME/venv/Scripts/activate
env:
- TOXENV=py37
Expand All @@ -80,8 +48,8 @@ jobs:
- choco install python --version 3.8.0
- python --version
- python -m pip install --upgrade pip
- pip3 install --upgrade virtualenv wheel
- virtualenv $HOME/venv
- python -m pip install --upgrade virtualenv wheel
- python -m virtualenv $HOME/venv
- source $HOME/venv/Scripts/activate
env:
- TOXENV=py38
Expand All @@ -90,8 +58,7 @@ jobs:
script: tox

install:
- pip install tox

- python -m pip install tox

after_success:
# Report coverage results to codecov.io
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Expand Up @@ -198,10 +198,10 @@ This configuration file setup the pytest-cov plugin and it is an additional depe
It is possible to tests with some versions of python, to do this the command is:

```bash
tox -e py27,py35,pypy
tox -e py36,pypy3
```

Will run py.test with the python2.7, python3.5 and pypy interpreters, for example.
Will run py.test with the python3.6 and pypy3 interpreters, for example.

## Core Committer Guide

Expand Down
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -28,9 +28,9 @@ Did someone say features?

* Cross-platform: Windows, Mac, and Linux are officially supported.
* You don't have to know/write Python code to use Cookiecutter
* Works with Python 2.7, 3.5, 3.6, 3.7, 3.8, PyPy and PyPy3.
* Project templates can be in any programming language or markup format:
Python, JavaScript, Ruby, CoffeeScript, RST, Markdown, CSS, HTML, you name it.
* Works with Python 3.6, 3.7, 3.8 and PyPy3.
* Project templates can be in any programming language or markup format:
Python, JavaScript, Ruby, CoffeeScript, RST, Markdown, CSS, HTML, you name it.
You can use multiple languages in the same project template.
* Simple command line usage:

Expand Down
5 changes: 1 addition & 4 deletions cookiecutter/vcs.py
Expand Up @@ -6,11 +6,8 @@
import logging
import os
import subprocess
from shutil import which

try:
from shutil import which
except ImportError:
from whichcraft import which

from cookiecutter.exceptions import (
RepositoryNotFound,
Expand Down
8 changes: 1 addition & 7 deletions cookiecutter/zipfile.py
Expand Up @@ -4,16 +4,10 @@

import os
import tempfile
from zipfile import ZipFile
from zipfile import BadZipFile, ZipFile

import requests

try:
# BadZipfile was renamed to BadZipFile in Python 3.2.
from zipfile import BadZipFile
except ImportError:
from zipfile import BadZipfile as BadZipFile

from cookiecutter.exceptions import InvalidZipRepository
from cookiecutter.prompt import read_repo_password
from cookiecutter.utils import make_sure_path_exists, prompt_and_delete
Expand Down
7 changes: 3 additions & 4 deletions docs/installation.rst
Expand Up @@ -18,7 +18,6 @@ You can install the Python binaries from `python.org <https://www.python.org/dow

.. code-block:: bash
# for python 3.x
$ brew install python3
Expand Down Expand Up @@ -60,7 +59,7 @@ You may also install `Windows Subsystem for Linux <https://msdn.microsoft.com/e
Packaging tools
^^^^^^^^^^^^^^^

``pip`` and ``setuptools`` now come with Python 2 >=2.7.9 or Python 3 >=3.5. See the Python Packaging Authority's (PyPA) documentation `Requirements for Installing Packages <https://packaging.python.org/en/latest/installing/#requirements-for-installing-packages>`_ for full details.
``pip`` and ``setuptools`` now come with Python 3 >=3.6. See the Python Packaging Authority's (PyPA) documentation `Requirements for Installing Packages <https://packaging.python.org/en/latest/installing/#requirements-for-installing-packages>`_ for full details.


Install cookiecutter
Expand All @@ -70,7 +69,7 @@ At the command line:

.. code-block:: bash
$ pip install --user cookiecutter
$ python3 -m pip install --user cookiecutter
Or, if you do not have pip:

Expand Down Expand Up @@ -133,6 +132,6 @@ Or with pip:

.. code-block:: bash
$ pip install --upgrade cookiecutter
$ python3 -m pip install --upgrade cookiecutter
Then you should be good to go.
2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -2,4 +2,4 @@
skip-string-normalization = true
exclude = '/(tests/hooks-abort-render/hooks|docs\/HelloCookieCutter1)/'
line-length = 88
target-version = ['py27']
target-version = ['py36']
28 changes: 16 additions & 12 deletions setup.py
Expand Up @@ -9,7 +9,7 @@

from setuptools import setup

version = "1.7.2"
version = "2.0.0"

if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
Expand Down Expand Up @@ -58,9 +58,8 @@
package_dir={'cookiecutter': 'cookiecutter'},
entry_points={'console_scripts': ['cookiecutter = cookiecutter.__main__:main']},
include_package_data=True,
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
python_requires='>=3.6',
install_requires=requirements,
extras_require={':python_version<"3.3"': ['whichcraft>=0.4.0']},
license='BSD',
zip_safe=False,
classifiers=[
Expand All @@ -69,21 +68,26 @@
"Intended Audience :: Developers",
"Natural Language :: English",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"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",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python",
"Topic :: Software Development",
],
keywords=(
'cookiecutter, Python, projects, project templates, Jinja2, '
'skeleton, scaffolding, project directory, setup.py, package, '
'packaging'
),
keywords=[
"cookiecutter",
"Python",
"projects",
"project templates",
"Jinja2",
"skeleton",
"scaffolding",
"project directory",
"package",
"packaging",
],
)
3 changes: 0 additions & 3 deletions tox.ini
@@ -1,12 +1,9 @@
[tox]
envlist =
lint
py27
py35
py36
py37
py38
pypy
pypy3
minversion = 3.14.2
requires =
Expand Down

0 comments on commit d9bd728

Please sign in to comment.