Skip to content

Commit 7f3816e

Browse files
authored
Merge pull request #1382 from awslabs/release/v1.20.0
Release/v1.20.0
2 parents 1dc386e + ca86a73 commit 7f3816e

File tree

1,012 files changed

+26377
-45275
lines changed

Some content is hidden

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

1,012 files changed

+26377
-45275
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
repos:
2+
- repo: https://github.com/python/black
3+
rev: 19.3b0
4+
hooks:
5+
- id: black
6+
language_version: python3.7
7+
exclude_types: ['markdown', 'ini', 'toml', 'rst']

.travis.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ language: python
55

66
matrix:
77
include:
8+
- python: 3.8
9+
env:
10+
- TOXENV=py38
811
- python: 3.7
912
env:
1013
- TOXENV=py37
@@ -18,6 +21,12 @@ matrix:
1821

1922
install:
2023
# Install the code requirements
24+
- mkdir $HOME/bin-black
25+
- wget -O $HOME/bin-black/black https://github.com/python/black/releases/download/19.3b0/black
26+
- chmod +x $HOME/bin-black/black
27+
- export PATH=$PATH:$HOME/bin-black
28+
- black --version
29+
2130
- make init
2231

2332
# Install Docs requirements

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Here are some questions that you should answer in your plan:
8787
8888
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
8989
90-
When filing an issue, please check [existing open](https://github.com/awslabs/PRIVATE-aws-sam-development/issues), or [recently closed](https://github.com/awslabs/PRIVATE-aws-sam-development/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already
90+
When filing an issue, please check [existing open](https://github.com/awslabs/serverless-application-model/issues), or [recently closed](https://github.com/awslabs/serverless-application-model/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already
9191
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
9292
9393
- A reproducible test case or series of steps

DEVELOPMENT_GUIDE.rst

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ steps manually.
1717

1818
1. Install Python Versions
1919
~~~~~~~~~~~~~~~~~~~~~~~~~~
20-
Our officially supported Python versions are 2.7, 3.6, and 3.7. Follow the idioms from this `excellent cheatsheet`_ to
20+
Our officially supported Python versions are 2.7, 3.6, 3.7 and 3.8. Follow the idioms from this `excellent cheatsheet`_ to
2121
make sure your code is compatible with both Python 2.7 and 3 versions.
2222

2323
Setup Python locally using `pyenv`_
@@ -26,8 +26,23 @@ Setup Python locally using `pyenv`_
2626
#. ``pyenv install 2.7.14``
2727
#. Make the Python version available in the project: ``pyenv local 2.7.14``
2828

29+
2. Install Additional Tooling
30+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31+
1. Black
32+
~~~~~~~~
33+
We format our code using [Black](https://github.com/python/black) and verify the source code is black compliant
34+
in Appveyor during PRs. You can find installation instructions on [Black's docs](https://black.readthedocs.io/en/stable/installation_and_usage.html).
2935

30-
2. Activate Virtualenv
36+
After installing, you can run our formatting through our Makefile by `make black-format` or integrating Black directly in your favorite IDE (instructions
37+
can be found [here](https://black.readthedocs.io/en/stable/editor_integration.html))
38+
39+
Pre-commit
40+
~~~~~~~~~~
41+
If you don't wish to manually run black on each pr or install black manually, we have integrated black into git hooks through [pre-commit](https://pre-commit.com/).
42+
After installing pre-commit, run `pre-commit install` in the root of the project. This will install black for you and run the black formatting on
43+
commit.
44+
45+
3. Activate Virtualenv
3146
~~~~~~~~~~~~~~~~~~~~~~
3247
Virtualenv allows you to install required libraries outside of the Python installation. A good practice is to setup
3348
a different virtualenv for each project. `pyenv`_ comes with a handy plugin that can create virtualenv.
@@ -37,7 +52,7 @@ a different virtualenv for each project. `pyenv`_ comes with a handy plugin that
3752
#. [Optional] Automatically activate the virtualenv in for this folder: ``pyenv local samtranslator27``
3853

3954

40-
3. Install dependencies
55+
4. Install dependencies
4156
~~~~~~~~~~~~~~~~~~~~~~~
4257
Install dependencies by running the following command. Make sure the Virtualenv you created above is active.
4358

Makefile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,23 @@ init:
3939
$(info [*] Install requirements...)
4040
@pip install -r requirements/dev.txt -r requirements/base.txt
4141

42-
flake:
43-
$(info [*] Running flake8...)
44-
@flake8 samtranslator
45-
4642
test:
4743
$(info [*] Run the unit test with minimum code coverage of $(CODE_COVERAGE)%...)
4844
@pytest --cov samtranslator --cov-report term-missing --cov-fail-under $(CODE_COVERAGE) tests
4945

46+
black:
47+
rm -f tests/*.pyc samtranslator/*.pyc
48+
black setup.py samtranslator/* tests/* bin/*
49+
50+
black-check:
51+
rm -f tests/*.pyc samtranslator/*.pyc
52+
black --check setup.py samtranslator/* tests/* bin/*
53+
5054
# Command to run everytime you make changes to verify everything works
51-
dev: flake test
55+
dev: test
5256

5357
# Verifications to run before sending a pull request
54-
pr: init dev
58+
pr: black-check init dev
5559

5660
define HELP_MESSAGE
5761

@@ -64,7 +68,6 @@ TARGETS
6468
init Initialize and install the requirements and dev-requirements for this project.
6569
test Run the Unit tests.
6670
dev Run all development tests after a change.
67-
build-docs Generate the documentation.
6871
pr Perform all checks before submitting a Pull Request.
6972

7073
endef

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Read the [SAM Documentation Contribution Guide](https://github.com/awsdocs/aws-s
8787
started.
8888

8989
### Join the SAM Community on Slack
90-
[Join the SAM developers channel (#samdev)](https://join.slack.com/t/awsdevelopers/shared_invite/enQtMzg3NTc5OTM2MzcxLTdjYTdhYWE3OTQyYTU4Njk1ZWY4Y2ZjYjBhMTUxNGYzNDg5MWQ1ZTc5MTRlOGY0OTI4NTdlZTMwNmI5YTgwOGM/) on Slack to collaborate with fellow community members and the AWS SAM team.
90+
[Join the SAM developers channel (#samdev)](https://join.slack.com/t/awsdevelopers/shared_invite/enQtMzg3NTc5OTM2MzcxLTIxNjc0ZTJkNmYyNWY3OWE4NTFiNzU1ZTM2Y2VkNmFlNjQ2YjI3YTE1ZDA5YjE5NDE2MjVmYWFlYWIxNjE2NjU) on Slack to collaborate with fellow community members and the AWS SAM team.
9191

9292

9393

appveyor.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 1.0.{build}
2+
image: Ubuntu
3+
4+
environment:
5+
matrix:
6+
- TOXENV: py27
7+
- TOXENV: py36
8+
- TOXENV: py37
9+
- TOXENV: py38
10+
11+
build: off
12+
13+
install:
14+
- make init
15+
16+
test_script:
17+
- tox

bin/sam-translate.py

Lines changed: 28 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from docopt import docopt
3030

3131
my_path = os.path.dirname(os.path.abspath(__file__))
32-
sys.path.insert(0, my_path + '/..')
32+
sys.path.insert(0, my_path + "/..")
3333

3434
from samtranslator.public.translator import ManagedPolicyLoader
3535
from samtranslator.translator.transform import transform
@@ -38,18 +38,19 @@
3838

3939
LOG = logging.getLogger(__name__)
4040
cli_options = docopt(__doc__)
41-
iam_client = boto3.client('iam')
41+
iam_client = boto3.client("iam")
4242
cwd = os.getcwd()
4343

44-
if cli_options.get('--verbose'):
44+
if cli_options.get("--verbose"):
4545
logging.basicConfig(level=logging.DEBUG)
4646
else:
4747
logging.basicConfig()
4848

49+
4950
def execute_command(command, args):
5051
try:
51-
aws_cmd = 'aws' if platform.system().lower() != 'windows' else 'aws.cmd'
52-
command_with_args = [aws_cmd, 'cloudformation', command] + list(args)
52+
aws_cmd = "aws" if platform.system().lower() != "windows" else "aws.cmd"
53+
command_with_args = [aws_cmd, "cloudformation", command] + list(args)
5354

5455
LOG.debug("Executing command: %s", command_with_args)
5556

@@ -63,8 +64,8 @@ def execute_command(command, args):
6364

6465

6566
def get_input_output_file_paths():
66-
input_file_option = cli_options.get('--template-file')
67-
output_file_option = cli_options.get('--output-template')
67+
input_file_option = cli_options.get("--template-file")
68+
output_file_option = cli_options.get("--output-template")
6869
input_file_path = os.path.join(cwd, input_file_option)
6970
output_file_path = os.path.join(cwd, output_file_option)
7071

@@ -73,67 +74,58 @@ def get_input_output_file_paths():
7374

7475
def package(input_file_path, output_file_path):
7576
template_file = input_file_path
76-
package_output_template_file = input_file_path + '._sam_packaged_.yaml'
77-
s3_bucket = cli_options.get('--s3-bucket')
77+
package_output_template_file = input_file_path + "._sam_packaged_.yaml"
78+
s3_bucket = cli_options.get("--s3-bucket")
7879
args = [
79-
'--template-file',
80+
"--template-file",
8081
template_file,
81-
'--output-template-file',
82+
"--output-template-file",
8283
package_output_template_file,
83-
'--s3-bucket',
84-
s3_bucket
84+
"--s3-bucket",
85+
s3_bucket,
8586
]
8687

87-
execute_command('package', args)
88+
execute_command("package", args)
8889

8990
return package_output_template_file
9091

9192

9293
def transform_template(input_file_path, output_file_path):
93-
with open(input_file_path, 'r') as f:
94+
with open(input_file_path, "r") as f:
9495
sam_template = yaml_parse(f)
9596

9697
try:
97-
cloud_formation_template = transform(
98-
sam_template, {}, ManagedPolicyLoader(iam_client))
99-
cloud_formation_template_prettified = json.dumps(
100-
cloud_formation_template, indent=2)
98+
cloud_formation_template = transform(sam_template, {}, ManagedPolicyLoader(iam_client))
99+
cloud_formation_template_prettified = json.dumps(cloud_formation_template, indent=2)
101100

102-
with open(output_file_path, 'w') as f:
101+
with open(output_file_path, "w") as f:
103102
f.write(cloud_formation_template_prettified)
104103

105-
print('Wrote transformed CloudFormation template to: ' + output_file_path)
104+
print ("Wrote transformed CloudFormation template to: " + output_file_path)
106105
except InvalidDocumentException as e:
107-
errorMessage = reduce(lambda message, error: message + ' ' + error.message, e.causes, e.message)
106+
errorMessage = reduce(lambda message, error: message + " " + error.message, e.causes, e.message)
108107
LOG.error(errorMessage)
109108
errors = map(lambda cause: cause.message, e.causes)
110109
LOG.error(errors)
111110

112111

113112
def deploy(template_file):
114-
capabilities = cli_options.get('--capabilities')
115-
stack_name = cli_options.get('--stack-name')
116-
args = [
117-
'--template-file',
118-
template_file,
119-
'--capabilities',
120-
capabilities,
121-
'--stack-name',
122-
stack_name
123-
]
113+
capabilities = cli_options.get("--capabilities")
114+
stack_name = cli_options.get("--stack-name")
115+
args = ["--template-file", template_file, "--capabilities", capabilities, "--stack-name", stack_name]
124116

125-
execute_command('deploy', args)
117+
execute_command("deploy", args)
126118

127119
return package_output_template_file
128120

129121

130-
if __name__ == '__main__':
122+
if __name__ == "__main__":
131123
input_file_path, output_file_path = get_input_output_file_paths()
132124

133-
if cli_options.get('package'):
125+
if cli_options.get("package"):
134126
package_output_template_file = package(input_file_path, output_file_path)
135127
transform_template(package_output_template_file, output_file_path)
136-
elif cli_options.get('deploy'):
128+
elif cli_options.get("deploy"):
137129
package_output_template_file = package(input_file_path, output_file_path)
138130
transform_template(package_output_template_file, output_file_path)
139131
deploy(output_file_path)

docs/cloudformation_compatibility.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ DeploymentPreference All
6363
Layers All
6464
AutoPublishAlias Ref of a CloudFormation Parameter Alias resources created by SAM uses a LocicalId <FunctionLogicalId+AliasName>. So SAM either needs a string for alias name, or a Ref to template Parameter that SAM can resolve into a string.
6565
ReservedConcurrentExecutions All
66+
EventInvokeConfig All
6667
============================ ================================== ========================
6768

6869
Events Properties
@@ -139,7 +140,17 @@ Description All
139140
Enabled All
140141
======================== ================================== ========================
141142

142-
CloudWatchEvent
143+
CloudWatchEvent (superseded by EventBridgeRule, see below)
144+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145+
======================== ================================== ========================
146+
Property Name Intrinsic(s) Supported Reasons
147+
======================== ================================== ========================
148+
Pattern All
149+
Input All
150+
InputPath All
151+
======================== ================================== ========================
152+
153+
EventBridgeRule
143154
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
144155
======================== ================================== ========================
145156
Property Name Intrinsic(s) Supported Reasons
@@ -184,6 +195,7 @@ MinimumCompressionSize All
184195
Cors All
185196
TracingEnabled All
186197
OpenApiVersion None
198+
Domain All
187199
================================== ======================== ========================
188200

189201

docs/globals.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Currently, the following resources and properties are being supported:
6969
DeploymentPreference:
7070
PermissionsBoundary:
7171
ReservedConcurrentExecutions:
72+
EventInvokeConfig:
7273
7374
Api:
7475
# Properties of AWS::Serverless::Api
@@ -89,6 +90,7 @@ Currently, the following resources and properties are being supported:
8990
CanarySetting:
9091
TracingEnabled:
9192
OpenApiVersion:
93+
Domain:
9294
9395
HttpApi:
9496
# Properties of AWS::Serverless::HttpApi

0 commit comments

Comments
 (0)