Skip to content

Commit 270e1da

Browse files
mndeveciCoshUSsriram-mvaahung
authored
feat: release v1.2.0 (#220)
* Added Dynamic Encoding Selection Based on Windows System Default * Fixed dotnet output system dependent encoding * Updated test_custom_make urllib3 Version * Reformatted with black * Rollback Changes to popen for Python 2 Support * Added Doc Page for DotNet Output Encoding * fix(ruby): use stdout stream to raise exceptions from bundler - relevant error information is in stdout instead of stderr for bundler. * chore: bump version to 1.1.0 * chore: Upgrade pytest to 6.1.1 * chore: Upgrade mock to 4.0.2 * chore: Upgrade parameterize to 0.7.4 * chore: Upgrade coverage to 5.3 * chore: Upgrade flake8 to 3.8.4 * chore: Upgrade pylint to 2.6.0 * Consider using Python 3 style super() without arguments (super-with-arguments) * Implicit string concatenation found in assignment (implicit-str-concat) * Consider explicitly re-raising using the 'from' keyword (raise-missing-from) * Only install backports.tempfile for 2.7 & 3.6 * python 2 fallbacks (pylint & mock) * Revert "Consider using Python 3 style super() without arguments (super-with-arguments)" This reverts commit 44284ea. * Revert "Consider explicitly re-raising using the 'from' keyword (raise-missing-from)" This reverts commit cd7c16e. * Disable rules that affecting Python 2 * Manage black version using requirement file (#207) * chore: Manage black version in dev.txt * chore: Update appveyor, use black in pip * chore: Add pre-commit-config * chore: Format with black 20.8b1 * chore: Add make pr2.7 for Python 2 that does not run black * chore: Remove python patch version in AppVeyor to be more robust (#213) * chore: Remove biased language (#212) * fix: run GlobalToolInstallAction in a lock block and only once (#214) * fix: run GlobalToolInstallAction in a lock block and only once * chore: change field name and update unit tests * chore: black formatting * fix: change tests to use threadpool for py2 * chore: update assert call and change usage of Executor * chore: bump version to 1.2.0 (#218) Co-authored-by: Wilton Wang <[email protected]> Co-authored-by: Sriram Madapusi Vasudevan <[email protected]> Co-authored-by: Sriram Madapusi Vasudevan <[email protected]> Co-authored-by: Sam Liu <[email protected]> Co-authored-by: _sam <[email protected]>
1 parent c15fe76 commit 270e1da

File tree

35 files changed

+195
-141
lines changed

35 files changed

+195
-141
lines changed

.appveyor.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ environment:
1212
matrix:
1313

1414
- PYTHON: "C:\\Python27-x64"
15-
PYTHON_VERSION: '2.7.18'
15+
PYTHON_VERSION: '2.7'
1616
PYTHON_ARCH: '64'
1717
LINE_COVERAGE: '91'
1818
NEW_FLAKE8: 0
1919
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
2020
- PYTHON: "C:\\Python36-x64"
21-
PYTHON_VERSION: '3.6.10'
21+
PYTHON_VERSION: '3.6'
2222
PYTHON_ARCH: '64'
2323
LINE_COVERAGE: '91'
2424
NEW_FLAKE8: 0
2525
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
2626
- PYTHON: "C:\\Python37-x64"
27-
PYTHON_VERSION: '3.7.7'
27+
PYTHON_VERSION: '3.7'
2828
PYTHON_ARCH: '64'
2929
LINE_COVERAGE: '91'
3030
NEW_FLAKE8: 0
3131
JAVA_HOME: "C:\\Program Files\\Java\\jdk11"
3232
- PYTHON: "C:\\Python38-x64"
33-
PYTHON_VERSION: '3.8.2'
33+
PYTHON_VERSION: '3.8'
3434
PYTHON_ARCH: '64'
3535
LINE_COVERAGE: '72'
3636
NEW_FLAKE8: 1
@@ -103,11 +103,6 @@ for:
103103
- sh: "sudo unzip -d /opt/gradle /tmp/gradle-*.zip"
104104
- sh: "PATH=/opt/gradle/gradle-5.5/bin:$PATH"
105105

106-
# Install black
107-
- sh: "wget -O /tmp/black https://github.com/python/black/releases/download/19.10b0/black"
108-
- sh: "chmod +x /tmp/black"
109-
- sh: "/tmp/black --version"
110-
111106
build_script:
112107
- "python -c \"import sys; print(sys.executable)\""
113108
- "LAMBDA_BUILDERS_DEV=1 pip install -e \".[dev]\""
@@ -119,5 +114,5 @@ for:
119114
# Runs only in Linux
120115
- "LAMBDA_BUILDERS_DEV=1 pytest -vv tests/integration"
121116

122-
# Validate Code was formatted with Black
123-
- "/tmp/black --check setup.py tests aws_lambda_builders"
117+
# Validate Code was formatted with Black, black is only supported in Python 3
118+
- if [[ $PYTHON_VERSION = "3"* ]]; then black --check setup.py tests aws_lambda_builders; fi

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# black is in dev.txt, so local repo is used here.
2+
repos:
3+
- repo: local
4+
hooks:
5+
- id: black
6+
name: black
7+
entry: black
8+
language: system
9+
types: [python]

.pylintrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# pygtk.require().
88
#init-hook=
99

10-
# Add files or directories to the blacklist. They should be base names, not
10+
# Add files or directories to the ignore list. They should be base names, not
1111
# paths.
1212
ignore=compat.py, utils.py
1313

@@ -60,7 +60,8 @@ confidence=
6060
# no Warning level messages displayed, use"--disable=all --enable=classes
6161
# --disable=W"
6262
# R0205,W0107,R1705,R1710,R1719,R1720,R1714 are all disable due to a forced upgrade to support python3.8
63-
disable=R0201,W0613,I0021,I0020,W1618,W1619,R0902,R0903,W0231,W0611,R0913,W0703,C0330,R0204,I0011,R0904,C0301, R0205,W0107,R1705,R1710,R1719,R1720,R1714
63+
# R1725,W0707 can be removed when we drop Python 2 support
64+
disable=R0201,W0613,I0021,I0020,W1618,W1619,R0902,R0903,W0231,W0611,R0913,W0703,C0330,R0204,I0011,R0904,C0301, R0205,W0107,R1705,R1710,R1719,R1720,R1714,R1725,W0707
6465

6566

6667
[REPORTS]

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ 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

aws_lambda_builders/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
22
AWS Lambda Builder Library
33
"""
4-
__version__ = "1.1.0"
4+
__version__ = "1.2.0"
55
RPC_PROTOCOL_VERSION = "0.3"

aws_lambda_builders/workflows/custom_make/DESIGN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ It is then the responsibility of the make target to make sure the artifacts are
6363
* We only care about certain build targets. so essentially this is a pluggable builder, but nothing beyond that at this point in time.
6464

6565
* Which environment variables are usable in this makefile?
66-
* There are a series of whitelisted environment variables that need to be defined and not be overriden within the Makefile to work. Currently that is just `$ARTIFACTS_DIR`
66+
* There are a series of allowlisted environment variables that need to be defined and not be overridden within the Makefile to work. Currently that is just `$ARTIFACTS_DIR`
6767

6868
* Can this be used even for runtimes that have builders associated with it? eg: python3.8?
6969
* Possibly, some changes would be needed be made to way the corresponding builder is picked up in sam cli. If we changed it such that there is a makefile we pick a makefile builder and if not fall back to the specified language builder.

aws_lambda_builders/workflows/dotnet_clipackage/actions.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Actions for .NET dependency resolution with CLI Package
33
"""
44

5+
import threading
56
import os
67
import logging
78

@@ -14,6 +15,8 @@
1415

1516

1617
class GlobalToolInstallAction(BaseAction):
18+
__lock = threading.Lock()
19+
__tools_installed = False
1720

1821
"""
1922
A Lambda Builder Action which installs the Amazon.Lambda.Tools .NET Core Global Tool
@@ -28,15 +31,30 @@ def __init__(self, subprocess_dotnet):
2831
self.subprocess_dotnet = subprocess_dotnet
2932

3033
def execute(self):
31-
try:
32-
LOG.debug("Installing Amazon.Lambda.Tools Global Tool")
33-
self.subprocess_dotnet.run(["tool", "install", "-g", "Amazon.Lambda.Tools", "--ignore-failed-sources"])
34-
except DotnetCLIExecutionError as ex:
35-
LOG.debug("Error installing probably due to already installed. Attempt to update to latest version.")
34+
# run Amazon.Lambda.Tools update in sync block in case build is triggered in parallel
35+
with GlobalToolInstallAction.__lock:
36+
LOG.debug("Entered synchronized block for updating Amazon.Lambda.Tools")
37+
38+
# check if Amazon.Lambda.Tools updated recently
39+
if GlobalToolInstallAction.__tools_installed:
40+
LOG.info("Skipping to update Amazon.Lambda.Tools install/update, since it is updated recently")
41+
return
42+
3643
try:
37-
self.subprocess_dotnet.run(["tool", "update", "-g", "Amazon.Lambda.Tools", "--ignore-failed-sources"])
44+
LOG.debug("Installing Amazon.Lambda.Tools Global Tool")
45+
self.subprocess_dotnet.run(["tool", "install", "-g", "Amazon.Lambda.Tools", "--ignore-failed-sources"])
46+
GlobalToolInstallAction.__tools_installed = True
3847
except DotnetCLIExecutionError as ex:
39-
raise ActionFailedError("Error configuring the Amazon.Lambda.Tools .NET Core Global Tool: " + str(ex))
48+
LOG.debug("Error installing probably due to already installed. Attempt to update to latest version.")
49+
try:
50+
self.subprocess_dotnet.run(
51+
["tool", "update", "-g", "Amazon.Lambda.Tools", "--ignore-failed-sources"]
52+
)
53+
GlobalToolInstallAction.__tools_installed = True
54+
except DotnetCLIExecutionError as ex:
55+
raise ActionFailedError(
56+
"Error configuring the Amazon.Lambda.Tools .NET Core Global Tool: " + str(ex)
57+
)
4058

4159

4260
class RunPackageAction(BaseAction):

aws_lambda_builders/workflows/python_pip/packager.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class DependencyBuilder(object):
157157
"manylinux2010_x86_64",
158158
"manylinux2014_x86_64",
159159
}
160-
_COMPATIBLE_PACKAGE_WHITELIST = {"sqlalchemy"}
160+
_COMPATIBLE_PACKAGE_ALLOWLIST = {"sqlalchemy"}
161161

162162
def __init__(self, osutils, runtime, pip_runner=None):
163163
"""Initialize a DependencyBuilder.
@@ -291,9 +291,9 @@ def _download_dependencies(self, directory, requirements_filename):
291291
# Now there is still the case left over where the setup.py has been
292292
# made in such a way to be incompatible with python's setup tools,
293293
# causing it to lie about its compatibility. To fix this we have a
294-
# manually curated whitelist of packages that will work, despite
294+
# manually curated allowlist of packages that will work, despite
295295
# claiming otherwise.
296-
compatible_wheels, incompatible_wheels = self._apply_wheel_whitelist(compatible_wheels, incompatible_wheels)
296+
compatible_wheels, incompatible_wheels = self._apply_wheel_allowlist(compatible_wheels, incompatible_wheels)
297297
missing_wheels = deps - compatible_wheels
298298
LOG.debug("Final compatible: %s", compatible_wheels)
299299
LOG.debug("Final incompatible: %s", incompatible_wheels)
@@ -305,7 +305,7 @@ def _download_all_dependencies(self, requirements_filename, directory):
305305
# Download dependencies prefering wheel files but falling back to
306306
# raw source dependences to get the transitive closure over
307307
# the dependency graph. Return the set of all package objects
308-
# which will serve as the master list of dependencies needed to deploy
308+
# which will serve as the primary list of dependencies needed to deploy
309309
# successfully.
310310
self._pip.download_all_dependencies(requirements_filename, directory)
311311
deps = {Package(directory, filename) for filename in self._osutils.get_directory_contents(directory)}
@@ -365,11 +365,11 @@ def _is_compatible_wheel_filename(self, filename):
365365
# Don't know what we have but it didn't pass compatibility tests.
366366
return False
367367

368-
def _apply_wheel_whitelist(self, compatible_wheels, incompatible_wheels):
368+
def _apply_wheel_allowlist(self, compatible_wheels, incompatible_wheels):
369369
compatible_wheels = set(compatible_wheels)
370370
actual_incompatible_wheels = set()
371371
for missing_package in incompatible_wheels:
372-
if missing_package.name in self._COMPATIBLE_PACKAGE_WHITELIST:
372+
if missing_package.name in self._COMPATIBLE_PACKAGE_ALLOWLIST:
373373
compatible_wheels.add(missing_package)
374374
else:
375375
actual_incompatible_wheels.add(missing_package)
@@ -550,7 +550,7 @@ def main(self, args, env_vars=None, shim=None):
550550
class PipRunner(object):
551551
"""Wrapper around pip calls used by chalice."""
552552

553-
_LINK_IS_DIR_PATTERN = "Processing (.+?)\n" " Link is a directory," " ignoring download_dir"
553+
_LINK_IS_DIR_PATTERN = "Processing (.+?)\n Link is a directory, ignoring download_dir"
554554

555555
def __init__(self, python_exe, pip, osutils=None):
556556
if osutils is None:

requirements/dev.txt

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1-
coverage==4.3.4
1+
coverage==5.3
22
flake8==3.3.0; python_version < '3.8'
3-
flake8==3.7.9; python_version >= '3.8'
4-
pytest-cov==2.4.0
5-
# astroid > 2.0.4 is not compatible with pylint1.7
6-
astroid>=1.5.8,<2.1.0; python_version < '3.8'
7-
pylint==1.7.2; python_version < '3.8'
8-
pylint==2.4.4; python_version >= '3.8'
3+
flake8==3.8.4; python_version >= '3.8'
4+
pytest-cov==2.10.1
5+
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'
910
isort>=4.2.5,<5; python_version < '3.8'
1011

1112
# Test requirements
12-
pytest==3.0.7
13-
py==1.4.33
14-
mock==2.0.0
15-
parameterized==0.6.1
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'
17+
parameterized==0.7.4
1618
pathlib2==2.3.2; python_version<"3.4"
1719
futures==3.2.0; python_version<"3.2.3"
18-
# Py3.2 backport
19-
backports.tempfile==1.0
20+
21+
# tempfile backport for < 3.6
22+
backports.tempfile==1.0; python_version<"3.7"
23+
24+
25+
# formatter
26+
black==20.8b1; python_version >= '3.6'

tests/functional/test_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ def test_run_hello_workflow_with_exec_paths(self):
5959
with open(self.expected_filename, "r") as fp:
6060
contents = fp.read()
6161

62-
self.assertEquals(contents, self.expected_contents)
62+
self.assertEqual(contents, self.expected_contents)

0 commit comments

Comments
 (0)