Skip to content

Commit

Permalink
chore: Remove Support for Running Lambda Builders on Python2 (#300)
Browse files Browse the repository at this point in the history
* Removed Python2 from CI

* Removed Requirements for Python2

* Removed Python2 from Setup

* Revert Python39 for Black

* Removed Unicode Prefix Used for Python2
  • Loading branch information
CoshUS authored Oct 7, 2021
1 parent 01031a5 commit bc440e7
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 95 deletions.
137 changes: 63 additions & 74 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,92 +9,81 @@ environment:
nodejs_version: "10.10.0"

matrix:

- PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: '2.7'
PYTHON_ARCH: '64'
LINE_COVERAGE: '91'
NEW_FLAKE8: 0
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: '3.6'
PYTHON_ARCH: '64'
LINE_COVERAGE: '91'
NEW_FLAKE8: 0
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
- PYTHON: "C:\\Python37-x64"
PYTHON_VERSION: '3.7'
PYTHON_ARCH: '64'
LINE_COVERAGE: '91'
NEW_FLAKE8: 0
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
- PYTHON: "C:\\Python38-x64"
PYTHON_VERSION: '3.8'
PYTHON_ARCH: '64'
LINE_COVERAGE: '72'
NEW_FLAKE8: 1
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
- PYTHON: "C:\\Python39-x64"
PYTHON_VERSION: '3.9'
PYTHON_ARCH: '64'
LINE_COVERAGE: '72'
NEW_FLAKE8: 1
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"


- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6"
PYTHON_ARCH: "64"
LINE_COVERAGE: "91"
NEW_FLAKE8: 0
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
- PYTHON: "C:\\Python37-x64"
PYTHON_VERSION: "3.7"
PYTHON_ARCH: "64"
LINE_COVERAGE: "91"
NEW_FLAKE8: 0
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
- PYTHON: "C:\\Python38-x64"
PYTHON_VERSION: "3.8"
PYTHON_ARCH: "64"
LINE_COVERAGE: "72"
NEW_FLAKE8: 1
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
- PYTHON: "C:\\Python39-x64"
PYTHON_VERSION: "3.9"
PYTHON_ARCH: "64"
LINE_COVERAGE: "72"
NEW_FLAKE8: 1
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"

build: off

for:
-
matrix:
- matrix:
only:
- image: Visual Studio 2019

environment:
GOPATH: c:\gopath

install:
# To run Nodejs workflow integ tests
- ps: Install-Product node $env:nodejs_version

- "set PATH=%PYTHON%;%PYTHON%\\Scripts;%PYTHON%\\bin;%PATH%"
- "%PYTHON%\\python.exe -m pip install -r requirements/dev.txt"
- "%PYTHON%\\python.exe -m pip install -e ."
- "set PATH=C:\\Ruby25-x64\\bin;%PATH%"
- "gem --version"
- "gem install bundler -v 1.17.3"
- "bundler --version"
- "echo %PATH%"

# setup go
- rmdir c:\go /s /q
- "choco install golang --version 1.15.7"
- "choco install bzr"
- "choco install dep"
- setx PATH "C:\go\bin;C:\gopath\bin;C:\Program Files (x86)\Bazaar\;C:\Program Files\Mercurial;%PATH%;"
- "go version"
# 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
# https://blog.golang.org/go116-module-changes#TOC_2.
# This is required for the go dep integration tests
- "go env -w GO111MODULE=auto"
- "go env"

# setup Gradle
- "choco install gradle"

# setup make
- "choco install make"

# Echo final Path
- "echo %PATH%"
# To run Nodejs workflow integ tests
- ps: Install-Product node $env:nodejs_version

- "set PATH=%PYTHON%;%PYTHON%\\Scripts;%PYTHON%\\bin;%PATH%"
- "%PYTHON%\\python.exe -m pip install -r requirements/dev.txt"
- "%PYTHON%\\python.exe -m pip install -e ."
- "set PATH=C:\\Ruby25-x64\\bin;%PATH%"
- "gem --version"
- "gem install bundler -v 1.17.3"
- "bundler --version"
- "echo %PATH%"

# setup go
- rmdir c:\go /s /q
- "choco install golang --version 1.15.7"
- "choco install bzr"
- "choco install dep"
- setx PATH "C:\go\bin;C:\gopath\bin;C:\Program Files (x86)\Bazaar\;C:\Program Files\Mercurial;%PATH%;"
- "go version"
# 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
# https://blog.golang.org/go116-module-changes#TOC_2.
# This is required for the go dep integration tests
- "go env -w GO111MODULE=auto"
- "go env"

# setup Gradle
- "choco install gradle"

# setup make
- "choco install make"

# Echo final Path
- "echo %PATH%"

test_script:
- "%PYTHON%\\python.exe -m pytest --cov aws_lambda_builders --cov-report term-missing tests/unit tests/functional"
- "%PYTHON%\\python.exe -m pytest tests/integration"
- "%PYTHON%\\python.exe -m pytest --cov aws_lambda_builders --cov-report term-missing tests/unit tests/functional"
- "%PYTHON%\\python.exe -m pytest tests/integration"

-
matrix:
- matrix:
only:
- image: Ubuntu

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

build_script:
- "python -c \"import sys; print(sys.executable)\""
- "LAMBDA_BUILDERS_DEV=1 pip install -e \".[dev]\""
- 'python -c "import sys; print(sys.executable)"'
- 'LAMBDA_BUILDERS_DEV=1 pip install -e ".[dev]"'

test_script:
- "LAMBDA_BUILDERS_DEV=1 pytest --cov aws_lambda_builders --cov-report term-missing --cov-fail-under ${LINE_COVERAGE} tests/unit tests/functional"
Expand Down
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,3 @@ black-check:

# Verifications to run before sending a pull request
pr: init dev black-check

# Verifications to run before sending a pull request, skipping black check because black requires Python 3.6+
pr2.7: init dev
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.black]
line-length = 120
target_version = ['py27', 'py37', 'py36', 'py38']
target_version = ['py37', 'py36', 'py38']
exclude = '''
(
Expand Down
1 change: 0 additions & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
six~=1.11
pathlib~=1.0.1; python_version < '3.4'
17 changes: 5 additions & 12 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,19 @@ flake8==3.3.0; python_version < '3.8'
flake8==3.8.4; python_version >= '3.8'
pytest-cov==2.10.1

# pylint 2 does not support Python 2. pylint 1.x requires astroid 1.x
astroid~=1.6.0; python_version < '3.6'
pylint~=1.9.5; python_version < '3.6'
pylint~=2.6.0; python_version >= '3.6'
pylint~=2.6.0
isort>=4.2.5,<5; python_version < '3.8'

# Test requirements
pytest>=6.1.1; python_version >= '3.6'
pytest~=4.6.11; python_version < '3.6' # pytest dropped python 2 support after 4.6.x
mock==3.0.5; python_version < '3.6'
mock==4.0.2; python_version >= '3.6'
pytest>=6.1.1
mock==4.0.2
parameterized==0.7.4
pathlib2==2.3.2; python_version<"3.4"
futures==3.2.0; python_version<"3.2.3"
pyelftools~=0.27 # Used to verify the generated Go binary architecture in integration tests (utils.py)


# tempfile backport for < 3.6
# tempfile backport for < 3.7
backports.tempfile==1.0; python_version<"3.7"


# formatter
black==20.8b1; python_version >= '3.6'
black==20.8b1
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def read_version():
license="Apache License 2.0",
packages=find_packages(exclude=["tests.*", "tests"]),
keywords="AWS Lambda Functions Building",
# Support Python 2.7 and 3.6 or greater
python_requires=(">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"),
# Support 3.6 or greater
python_requires=(">=3.6"),
entry_points={"console_scripts": ["{}=aws_lambda_builders.__main__:main".format(cmd_name)]},
install_requires=read_requirements("base.txt") + read_requirements("python_pip.txt"),
extras_require={"dev": read_requirements("dev.txt")},
Expand All @@ -58,9 +58,10 @@ def read_version():
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Internet",
"Topic :: Software Development :: Build Tools",
"Topic :: Utilities",
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/workflows/python_pip/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def osutils():
class TestOSUtils(object):
def test_can_read_unicode(self, tmpdir, osutils):
filename = str(tmpdir.join("file.txt"))
checkmark = u"\2713"
checkmark = "\2713"
with io.open(filename, "w", encoding="utf-16") as f:
f.write(checkmark)

Expand Down

0 comments on commit bc440e7

Please sign in to comment.