Skip to content

Commit 0eebbec

Browse files
authored
Merge pull request #2358 from aws/release/v1.43.0
Release/v1.43.0
2 parents 480ce19 + 594c54f commit 0eebbec

File tree

334 files changed

+15453
-2735
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

334 files changed

+15453
-2735
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66

77
*Checklist:*
88

9-
- [ ] Add/update tests using:
9+
- [ ] Add/update [unit tests](https://github.com/aws/serverless-application-model/blob/develop/DEVELOPMENT_GUIDE.md#unit-testing-with-multiple-python-versions) using:
1010
- [ ] Correct values
1111
- [ ] Bad/wrong values (None, empty, wrong type, length, etc.)
1212
- [ ] [Intrinsic Functions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html)
13+
- [ ] Add/update [integration tests](https://github.com/aws/serverless-application-model/blob/develop/INTEGRATION_TESTS.md)
1314
- [ ] `make pr` passes
1415
- [ ] Update documentation
1516
- [ ] Verify transformed template deploys and application functions as expected

.github/workflows/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
This folder has Github Actions for this repo.
2+
3+
** pr-labler **
4+
5+
This is responsible for tagging our prs automattically. The primary thing it does is tags internal vs external (to the team) PRs.
6+
This is run on `pull_request_target` which only runs what is in the repo not what is in the Pull Request. This is done to help guard against
7+
a PR running and changing. For this, the Action should NEVER download or checkout the PR. It is purely for tagging/labeling not CI.

.github/workflows/pr-labeler.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Pull Request Labeler"
2+
on:
3+
pull_request_target:
4+
types: [opened]
5+
6+
jobs:
7+
apply-internal-external-label:
8+
permissions:
9+
pull-requests: write
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/github-script@v5
13+
with:
14+
github-token: ${{secrets.GITHUB_TOKEN}}
15+
script: |
16+
const maintainers = ['jfuss', 'c2tarun', 'hoffa', 'awood45', 'CoshUS', 'aahung', 'hawflau', 'mndeveci', 'ssenchenko', 'wchengru', 'mingkun2020', 'qingchm', 'moelasmar', 'xazhao', 'mildaniel', 'marekaiv', 'torresxb1']
17+
if (maintainers.includes(context.payload.sender.login)) {
18+
github.rest.issues.addLabels({
19+
issue_number: context.issue.number,
20+
owner: context.repo.owner,
21+
repo: context.repo.repo,
22+
labels: ['pr/internal']
23+
})
24+
} else {
25+
github.rest.issues.addLabels({
26+
issue_number: context.issue.number,
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
labels: ['pr/external']
30+
})
31+
}

.pylintrc

Lines changed: 114 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,21 @@
99

1010
# Add files or directories to the ignore list. They should be base names, not
1111
# paths.
12-
ignore=compat.py
12+
ignore=compat.py, __main__.py
1313

1414
# Pickle collected data for later comparisons.
1515
persistent=yes
1616

1717
# List of plugins (as comma separated values of python modules names) to load,
1818
# usually to register additional checkers.
1919
load-plugins=
20+
pylint.extensions.check_elif, # Else If Used checker
21+
pylint.extensions.emptystring, # compare to empty string
22+
pylint.extensions.comparetozero, # compare to 0
23+
pylint.extensions.docparams, # Parameter documentation checker
2024

2125
# Use multiple processes to speed up Pylint.
26+
# Pylint has a bug on multitread, turn it off.
2227
jobs=1
2328

2429
# Allow loading of arbitrary C extensions. Extensions are imported into the
@@ -59,7 +64,103 @@ confidence=
5964
# --enable=similarities". If you want to run only the classes checker, but have
6065
# no Warning level messages displayed, use"--disable=all --enable=classes
6166
# --disable=W"
62-
disable=R0201,W0613,I0021,I0020,W1618,W1619,R0902,R0903,W0231,W0611,R0913,W0703,C0330,R0204,I0011,R0904
67+
disable=
68+
W0613, # Unused argument %r
69+
W0640, # Cell variable %s defined in loop A variable used in a closure is defined in a loop
70+
R0902, # Too many instance attributes (%s/%s)
71+
R0903, # Too few public methods (%s/%s)
72+
R0913, # Too many arguments (%s/%s)
73+
W0703, # Catching too general exception %s
74+
R0904, # Too many public methods (%s/%s)
75+
R0914, # Too many local variables (%s/%s)
76+
R0915, # Too many statements
77+
C0415, # Import outside toplevel (%s) Used when an import statement is used anywhere other than the module toplevel. Move this import to the top of the file.
78+
C0115, # missing-class-docstring
79+
# below are docstring lint rules, in order to incrementally improve our docstring while
80+
# without introduce too much effort at a time, we exclude most of the docstring lint rules.
81+
# We will remove them one by one.
82+
# W9005, # "%s" has constructor parameters documented in class and __init__
83+
W9006, # "%s" not documented as being raised
84+
# W9008, # Redundant returns documentation
85+
# W9010, # Redundant yields documentation
86+
W9011, # Missing return documentation
87+
W9012, # Missing return type documentation
88+
# W9013, # Missing yield documentation
89+
# W9014, # Missing yield type documentation
90+
# W9015, # "%s" missing in parameter documentation
91+
W9016, # "%s" missing in parameter type documentation
92+
# W9017, # "%s" differing in parameter documentation
93+
# W9018, # "%s" differing in parameter type documentation
94+
# W9019, # "%s" useless ignored parameter documentation
95+
# W9020, # "%s" useless ignored parameter type documentation
96+
# Constant name style warnings. We will remove them one by one.
97+
C0103, # Class constant name "%s" doesn't conform to UPPER_CASE naming style ('([^\\W\\da-z][^\\Wa-z]*|__.*__)$' pattern) (invalid-name)
98+
# New recommendations, disable for now to avoid introducing behaviour changes.
99+
R1729, # Use a generator instead '%s' (use-a-generator)
100+
R1732, # Consider using 'with' for resource-allocating operations (consider-using-with)
101+
# This applies to CPython only.
102+
I1101, # Module 'math' has no 'pow' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
103+
# Added to allow linting. Need to work on removing over time
104+
R0801, # dupilcated code
105+
R0401, # Cyclic import
106+
C0411, # import ordering
107+
W9015, # missing parameter in doc strings
108+
W0612, # unused variable
109+
R0205, # useless-object-inheritanc
110+
C0301, # line to long
111+
R0201, # no self use, method could be a function
112+
C0114, # missing-module-docstring
113+
W1202, # Use lazy % formatting in logging functions (logging-format-interpolation)
114+
E1101, # No member
115+
W0622, # Redefining built-in 'property' (redefined-builtin)
116+
W0611, # unused imports
117+
W0231, # super not called
118+
W0212, # protected-access
119+
W0201, # attribute-defined-outside-init
120+
R1725, # Consider using Python 3 style super() without arguments (super-with-arguments)
121+
C2001, # Avoid comparisons to zero (compare-to-zero)
122+
R0912, # too many branches
123+
W0235, # Useless super delegation in method '__init__' (useless-super-delegation)
124+
C0412, # Imports from package samtranslator are not grouped (ungrouped-imports)
125+
W0223, # abstract-method
126+
W0107, # unnecessary-pass
127+
W0707, # raise-missing-from
128+
R1720, # no-else-raise
129+
W0621, # redefined-outer-name
130+
E0203, # access-member-before-definition
131+
W0221, # arguments-differ
132+
R1710, # inconsistent-return-statements
133+
R1702, # too-many-nested-blocks
134+
C0123, # Use isinstance() rather than type() for a typecheck. (unidiomatic-typecheck)
135+
W0105, # String statement has no effect (pointless-string-statement)
136+
C0206, # Consider iterating with .items() (consider-using-dict-items)
137+
W9008, # Redundant returns documentation (redundant-returns-doc)
138+
E0602, # undefined-variable
139+
C0112, # empty-docstring
140+
C0116, # missing-function-docstring
141+
C0200, # consider-using-enumerate
142+
R5501, # Consider using "elif" instead of "else if" (else-if-used)
143+
W9017, # differing-param-doc
144+
W9018, # differing-type-doc
145+
W0511, # fixme
146+
C0325, # superfluous-parens
147+
R1701, # consider-merging-isinstance
148+
C0302, # too-many-lines
149+
C0303, # trailing-whitespace
150+
R1721, # unnecessary-comprehension
151+
C0121, # singleton-comparison
152+
E1305, # too-many-format-args
153+
R1724, # no-else-continue
154+
E0611, # no-name-in-module
155+
W9013, # missing-yield-doc
156+
W9014, # missing-yield-type-doc
157+
C0201, # consider-iterating-dictionary
158+
W0237, # arguments-renamed
159+
R1718, # consider-using-set-comprehension
160+
R1723, # no-else-break
161+
E1133, # not-an-iterable
162+
E1135, # unsupported-membership-test
163+
R1705, # no-else-return
63164

64165

65166
[REPORTS]
@@ -162,18 +263,20 @@ module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
162263
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
163264

164265
# Regular expression matching correct method names
165-
method-rgx=[a-z_][a-z0-9_]{2,30}$
266+
method-rgx=[a-z_][a-z0-9_]{2,50}$
166267

167268
# Naming hint for method names
168269
method-name-hint=[a-z_][a-z0-9_]{2,30}$
169270

170271
# Regular expression which should only match function or class names that do
171272
# not require a docstring.
172-
no-docstring-rgx=.*
273+
no-docstring-rgx=^_
173274

174275
# Minimum line length for functions/classes that require docstrings, shorter
175276
# ones are exempt.
176-
docstring-min-length=-1
277+
# To improve our docstring without spending too much effort at a time,
278+
# here set it to 30 and decrease it gradually in the future.
279+
docstring-min-length=30
177280

178281

179282
[FORMAT]
@@ -221,16 +324,16 @@ notes=FIXME,XXX
221324
[SIMILARITIES]
222325

223326
# Minimum lines number of a similarity.
224-
min-similarity-lines=5
327+
min-similarity-lines=12
225328

226329
# Ignore comments when computing similarities.
227-
ignore-comments=no
330+
ignore-comments=yes
228331

229332
# Ignore docstrings when computing similarities.
230-
ignore-docstrings=no
333+
ignore-docstrings=yes
231334

232335
# Ignore imports when computing similarities.
233-
ignore-imports=no
336+
ignore-imports=yes
234337

235338

236339
[SPELLING]
@@ -259,7 +362,7 @@ ignore-mixin-members=yes
259362
# List of module names for which member attributes should not be checked
260363
# (useful for modules/projects where namespaces are manipulated during runtime
261364
# and thus existing member attributes cannot be deduced by static analysis
262-
ignored-modules=six.moves
365+
ignored-modules=
263366

264367
# List of classes names for which member attributes should not be checked
265368
# (useful for classes with attributes dynamically set).
@@ -315,7 +418,7 @@ max-args=5
315418
ignored-argument-names=_.*
316419

317420
# Maximum number of locals for function / method body
318-
max-locals=15
421+
max-locals=17
319422

320423
# Maximum number of return / yield for function / method body
321424
max-returns=6

DEVELOPMENT_GUIDE.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Windows users, consider using [pipenv](https://docs.pipenv.org/).
1515
-------------------------
1616
For setting up a local development environment, we recommend using Gitpod - a service that allows you to spin up an in-browser Visual Studio Code-compatible editor, with everything set up and ready to go for development on this project. Just click the button below to create your private workspace:
1717

18-
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/awslabs/aws-sam-cli)
18+
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/aws/serverless-application-model.git)
1919

2020
This will start a new Gitpod workspace, and immediately kick off a build of the code. Once it's done, you can start working.
2121

@@ -26,9 +26,8 @@ Environment Setup
2626
-----------------
2727
### 1. Install Python Versions
2828

29-
Our officially supported Python versions are 2.7, 3.6, 3.7 and 3.8. Follow the idioms from this [excellent cheatsheet](http://python-future.org/compatible_idioms.html) to
30-
make sure your code is compatible with both Python 2.7 and 3 (>=3.6) versions.
31-
Our CI/CD pipeline is setup to run unit tests against both Python 2.7 and 3 versions. So make sure you test it with both versions before sending a Pull Request.
29+
Our officially supported Python versions are 3.6, 3.7 and 3.8.
30+
Our CI/CD pipeline is setup to run unit tests against Python 3 versions. Make sure you test it before sending a Pull Request.
3231
See [Unit testing with multiple Python versions](#unit-testing-with-multiple-python-versions).
3332

3433
[pyenv](https://github.com/pyenv/pyenv) is a great tool to
@@ -41,12 +40,11 @@ easily setup multiple Python versions. For
4140
1. Install PyEnv -
4241
`curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash`
4342
1. Restart shell so the path changes take effect - `exec $SHELL`
44-
1. `pyenv install 2.7.17`
4543
1. `pyenv install 3.6.12`
4644
1. `pyenv install 3.7.9`
4745
1. `pyenv install 3.8.6`
4846
1. Make Python versions available in the project:
49-
`pyenv local 2.7.17 3.6.12 3.7.9 3.8.6`
47+
`pyenv local 3.6.12 3.7.9 3.8.6`
5048

5149
Note: also make sure the following lines were written into your `.bashrc` (or `.zshrc`, depending on which shell you are using):
5250
```
@@ -117,11 +115,10 @@ Running Tests
117115
### Unit testing with one Python version
118116

119117
If you're trying to do a quick run, it's ok to use the current python version. Run `make pr`.
120-
If you're using Python2.7, you can run `make pr2.7` instead.
121118

122119
### Unit testing with multiple Python versions
123120

124-
Currently, our officially supported Python versions are 2.7, 3.6, 3.7 and 3.8. For the most
121+
Currently, our officially supported Python versions are 3.6, 3.7 and 3.8. For the most
125122
part, code that works in Python3.6 will work in Python3.7 and Python3.8. You only run into problems if you are
126123
trying to use features released in a higher version (for example features introduced into Python3.7
127124
will not work in Python3.6). If you want to test in many versions, you can create a virtualenv for

INTEGRATION_TESTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
These tests run SAM against AWS services by translating SAM templates, deploying them to Cloud Formation and verifying the resulting objects.
44

5-
They must run successfully under Python 2 and 3.
5+
They must run successfully under Python 3.
66

77
## Run the tests
88

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ recursive-include samtranslator/validator/sam_schema *.json
55
include samtranslator/policy_templates_data/policy_templates.json
66
include samtranslator/policy_templates_data/schema.json
77
include README.md
8+
include THIRD_PARTY_LICENSES
89

910
prune tests

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ init:
66
pip install -e '.[dev]'
77

88
test:
9-
pytest --cov samtranslator --cov-report term-missing --cov-fail-under 95 tests/*
9+
pytest --cov samtranslator --cov-report term-missing --cov-fail-under 95 -n auto tests/*
1010

1111
test-cov-report:
1212
pytest --cov samtranslator --cov-report term-missing --cov-report html --cov-fail-under 95 tests/*
@@ -20,14 +20,15 @@ black:
2020
black-check:
2121
black --check setup.py samtranslator/* tests/* integration/* bin/*.py
2222

23+
lint:
24+
# Linter performs static analysis to catch latent bugs
25+
pylint --rcfile .pylintrc samtranslator
26+
2327
# Command to run everytime you make changes to verify everything works
2428
dev: test
2529

2630
# Verifications to run before sending a pull request
27-
pr: black-check init dev
28-
29-
# Verifications to run before sending a pull request, skipping black check because black requires Python 3.6+
30-
pr2.7: init dev
31+
pr: black-check lint init dev
3132

3233
define HELP_MESSAGE
3334

THIRD_PARTY_LICENSES

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
The AWS Serverless Application Model includes the following third-party software/licensing:
2+
3+
** py27hash; version 1.0.2 -- https://pypi.org/project/py27hash/
4+
Copyright (c) 2020 NeuML LLC
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.
23+
----------------

appveyor-integration-test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ image: Ubuntu
33

44
environment:
55
matrix:
6-
- TOXENV: py27
7-
PYTHON_VERSION: '2.7'
8-
- TOXENV: py36
9-
PYTHON_VERSION: '3.6'
106
- TOXENV: py37
117
PYTHON_VERSION: '3.7'
128
- TOXENV: py38
139
PYTHON_VERSION: '3.8'
10+
- TOXENV: py39
11+
PYTHON_VERSION: '3.9'
12+
- TOXENV: py310
13+
PYTHON_VERSION: '3.10'
1414

1515
build: off
1616

0 commit comments

Comments
 (0)