Skip to content

Commit bc440e7

Browse files
authored
chore: Remove Support for Running Lambda Builders on Python2 (#300)
* Removed Python2 from CI * Removed Requirements for Python2 * Removed Python2 from Setup * Revert Python39 for Black * Removed Unicode Prefix Used for Python2
1 parent 01031a5 commit bc440e7

File tree

7 files changed

+74
-95
lines changed

7 files changed

+74
-95
lines changed

.appveyor.yml

Lines changed: 63 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -9,92 +9,81 @@ environment:
99
nodejs_version: "10.10.0"
1010

1111
matrix:
12-
13-
- PYTHON: "C:\\Python27-x64"
14-
PYTHON_VERSION: '2.7'
15-
PYTHON_ARCH: '64'
16-
LINE_COVERAGE: '91'
17-
NEW_FLAKE8: 0
18-
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
19-
- PYTHON: "C:\\Python36-x64"
20-
PYTHON_VERSION: '3.6'
21-
PYTHON_ARCH: '64'
22-
LINE_COVERAGE: '91'
23-
NEW_FLAKE8: 0
24-
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
25-
- PYTHON: "C:\\Python37-x64"
26-
PYTHON_VERSION: '3.7'
27-
PYTHON_ARCH: '64'
28-
LINE_COVERAGE: '91'
29-
NEW_FLAKE8: 0
30-
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
31-
- PYTHON: "C:\\Python38-x64"
32-
PYTHON_VERSION: '3.8'
33-
PYTHON_ARCH: '64'
34-
LINE_COVERAGE: '72'
35-
NEW_FLAKE8: 1
36-
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
37-
- PYTHON: "C:\\Python39-x64"
38-
PYTHON_VERSION: '3.9'
39-
PYTHON_ARCH: '64'
40-
LINE_COVERAGE: '72'
41-
NEW_FLAKE8: 1
42-
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
43-
44-
12+
- PYTHON: "C:\\Python36-x64"
13+
PYTHON_VERSION: "3.6"
14+
PYTHON_ARCH: "64"
15+
LINE_COVERAGE: "91"
16+
NEW_FLAKE8: 0
17+
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
18+
- PYTHON: "C:\\Python37-x64"
19+
PYTHON_VERSION: "3.7"
20+
PYTHON_ARCH: "64"
21+
LINE_COVERAGE: "91"
22+
NEW_FLAKE8: 0
23+
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
24+
- PYTHON: "C:\\Python38-x64"
25+
PYTHON_VERSION: "3.8"
26+
PYTHON_ARCH: "64"
27+
LINE_COVERAGE: "72"
28+
NEW_FLAKE8: 1
29+
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
30+
- PYTHON: "C:\\Python39-x64"
31+
PYTHON_VERSION: "3.9"
32+
PYTHON_ARCH: "64"
33+
LINE_COVERAGE: "72"
34+
NEW_FLAKE8: 1
35+
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
4536

4637
build: off
4738

4839
for:
49-
-
50-
matrix:
40+
- matrix:
5141
only:
5242
- image: Visual Studio 2019
5343

5444
environment:
5545
GOPATH: c:\gopath
5646

5747
install:
58-
# To run Nodejs workflow integ tests
59-
- ps: Install-Product node $env:nodejs_version
60-
61-
- "set PATH=%PYTHON%;%PYTHON%\\Scripts;%PYTHON%\\bin;%PATH%"
62-
- "%PYTHON%\\python.exe -m pip install -r requirements/dev.txt"
63-
- "%PYTHON%\\python.exe -m pip install -e ."
64-
- "set PATH=C:\\Ruby25-x64\\bin;%PATH%"
65-
- "gem --version"
66-
- "gem install bundler -v 1.17.3"
67-
- "bundler --version"
68-
- "echo %PATH%"
69-
70-
# setup go
71-
- rmdir c:\go /s /q
72-
- "choco install golang --version 1.15.7"
73-
- "choco install bzr"
74-
- "choco install dep"
75-
- setx PATH "C:\go\bin;C:\gopath\bin;C:\Program Files (x86)\Bazaar\;C:\Program Files\Mercurial;%PATH%;"
76-
- "go version"
77-
# set set GO111MODULE to auto to enable module-aware mode only when a go.mod file is present in the current directory or any parent directory
78-
# https://blog.golang.org/go116-module-changes#TOC_2.
79-
# This is required for the go dep integration tests
80-
- "go env -w GO111MODULE=auto"
81-
- "go env"
82-
83-
# setup Gradle
84-
- "choco install gradle"
85-
86-
# setup make
87-
- "choco install make"
88-
89-
# Echo final Path
90-
- "echo %PATH%"
48+
# To run Nodejs workflow integ tests
49+
- ps: Install-Product node $env:nodejs_version
50+
51+
- "set PATH=%PYTHON%;%PYTHON%\\Scripts;%PYTHON%\\bin;%PATH%"
52+
- "%PYTHON%\\python.exe -m pip install -r requirements/dev.txt"
53+
- "%PYTHON%\\python.exe -m pip install -e ."
54+
- "set PATH=C:\\Ruby25-x64\\bin;%PATH%"
55+
- "gem --version"
56+
- "gem install bundler -v 1.17.3"
57+
- "bundler --version"
58+
- "echo %PATH%"
59+
60+
# setup go
61+
- rmdir c:\go /s /q
62+
- "choco install golang --version 1.15.7"
63+
- "choco install bzr"
64+
- "choco install dep"
65+
- setx PATH "C:\go\bin;C:\gopath\bin;C:\Program Files (x86)\Bazaar\;C:\Program Files\Mercurial;%PATH%;"
66+
- "go version"
67+
# set set GO111MODULE to auto to enable module-aware mode only when a go.mod file is present in the current directory or any parent directory
68+
# https://blog.golang.org/go116-module-changes#TOC_2.
69+
# This is required for the go dep integration tests
70+
- "go env -w GO111MODULE=auto"
71+
- "go env"
72+
73+
# setup Gradle
74+
- "choco install gradle"
75+
76+
# setup make
77+
- "choco install make"
78+
79+
# Echo final Path
80+
- "echo %PATH%"
9181

9282
test_script:
93-
- "%PYTHON%\\python.exe -m pytest --cov aws_lambda_builders --cov-report term-missing tests/unit tests/functional"
94-
- "%PYTHON%\\python.exe -m pytest tests/integration"
83+
- "%PYTHON%\\python.exe -m pytest --cov aws_lambda_builders --cov-report term-missing tests/unit tests/functional"
84+
- "%PYTHON%\\python.exe -m pytest tests/integration"
9585

96-
-
97-
matrix:
86+
- matrix:
9887
only:
9988
- image: Ubuntu
10089

@@ -121,8 +110,8 @@ for:
121110
- sh: "go env -w GO111MODULE=auto"
122111

123112
build_script:
124-
- "python -c \"import sys; print(sys.executable)\""
125-
- "LAMBDA_BUILDERS_DEV=1 pip install -e \".[dev]\""
113+
- 'python -c "import sys; print(sys.executable)"'
114+
- 'LAMBDA_BUILDERS_DEV=1 pip install -e ".[dev]"'
126115

127116
test_script:
128117
- "LAMBDA_BUILDERS_DEV=1 pytest --cov aws_lambda_builders --cov-report term-missing --cov-fail-under ${LINE_COVERAGE} tests/unit tests/functional"

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,3 @@ black-check:
2828

2929
# Verifications to run before sending a pull request
3030
pr: init dev black-check
31-
32-
# Verifications to run before sending a pull request, skipping black check because black requires Python 3.6+
33-
pr2.7: init dev

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.black]
22
line-length = 120
3-
target_version = ['py27', 'py37', 'py36', 'py38']
3+
target_version = ['py37', 'py36', 'py38']
44
exclude = '''
55
66
(

requirements/base.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
six~=1.11
2-
pathlib~=1.0.1; python_version < '3.4'

requirements/dev.txt

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,19 @@ flake8==3.3.0; python_version < '3.8'
33
flake8==3.8.4; python_version >= '3.8'
44
pytest-cov==2.10.1
55

6-
# pylint 2 does not support Python 2. pylint 1.x requires astroid 1.x
7-
astroid~=1.6.0; python_version < '3.6'
8-
pylint~=1.9.5; python_version < '3.6'
9-
pylint~=2.6.0; python_version >= '3.6'
6+
pylint~=2.6.0
107
isort>=4.2.5,<5; python_version < '3.8'
118

129
# Test requirements
13-
pytest>=6.1.1; python_version >= '3.6'
14-
pytest~=4.6.11; python_version < '3.6' # pytest dropped python 2 support after 4.6.x
15-
mock==3.0.5; python_version < '3.6'
16-
mock==4.0.2; python_version >= '3.6'
10+
pytest>=6.1.1
11+
mock==4.0.2
1712
parameterized==0.7.4
18-
pathlib2==2.3.2; python_version<"3.4"
19-
futures==3.2.0; python_version<"3.2.3"
2013
pyelftools~=0.27 # Used to verify the generated Go binary architecture in integration tests (utils.py)
2114

2215

23-
# tempfile backport for < 3.6
16+
# tempfile backport for < 3.7
2417
backports.tempfile==1.0; python_version<"3.7"
2518

2619

2720
# formatter
28-
black==20.8b1; python_version >= '3.6'
21+
black==20.8b1

setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def read_version():
4343
license="Apache License 2.0",
4444
packages=find_packages(exclude=["tests.*", "tests"]),
4545
keywords="AWS Lambda Functions Building",
46-
# Support Python 2.7 and 3.6 or greater
47-
python_requires=(">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"),
46+
# Support 3.6 or greater
47+
python_requires=(">=3.6"),
4848
entry_points={"console_scripts": ["{}=aws_lambda_builders.__main__:main".format(cmd_name)]},
4949
install_requires=read_requirements("base.txt") + read_requirements("python_pip.txt"),
5050
extras_require={"dev": read_requirements("dev.txt")},
@@ -58,9 +58,10 @@ def read_version():
5858
"License :: OSI Approved :: Apache Software License",
5959
"Operating System :: OS Independent",
6060
"Programming Language :: Python",
61-
"Programming Language :: Python :: 2.7",
6261
"Programming Language :: Python :: 3.6",
6362
"Programming Language :: Python :: 3.7",
63+
"Programming Language :: Python :: 3.8",
64+
"Programming Language :: Python :: 3.9",
6465
"Topic :: Internet",
6566
"Topic :: Software Development :: Build Tools",
6667
"Topic :: Utilities",

tests/functional/workflows/python_pip/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def osutils():
1313
class TestOSUtils(object):
1414
def test_can_read_unicode(self, tmpdir, osutils):
1515
filename = str(tmpdir.join("file.txt"))
16-
checkmark = u"\2713"
16+
checkmark = "\2713"
1717
with io.open(filename, "w", encoding="utf-16") as f:
1818
f.write(checkmark)
1919

0 commit comments

Comments
 (0)