Skip to content

Commit fff5ed8

Browse files
authored
Review/Cleanup of master for release prep (#1147)
* 🔧 update for case where expected metadata for given package does not contain 'releases' * :penicl: add warning for case where expected `package_version` is not found. * 🔧 change pipenv req to version greater than previously reported problem version. * 🙈 Add `Pipfile.lock` to `.gitignore` (When supporting multiple versions of python with pipenv don't include the lock file. * 🔧 fix pipenv version restriction. * 🎨 run black on `core.py` * 🎨 fix flake8, run black * 🔧 adjust caching (requirements.txt no longer used. * 🐛 fix Pipfile typo * 🔥 The python3.6 runtime is deprecated by aws (July 18, 2022 [phase-1], Aug 17, 2022 [phase-2]) remove from tests for next release candidate * 🎨 run black 🔧 update black check command. * 🎨 run isort * 📝 change version 0.54.1 -> 0.55.1 🔥 remove 3.6 from SUPPORTED_VERSIONS * 🔥 remove 3.6 support * 🔀 merge with `0.54.2-release` branch to apply 3.9 support documentation updates. 🔥 remove 3.6 support from README * 🔀 merge with `0.54.2-release` branch to apply 3.9 support documentation updates. * ⏪️revert __version__ back to available pypi version Without a pypi available release the `test_slim_handler` testcase fails. ``` ERROR: No matching distribution found for zappa==0.55.1 E................... ====================================================================== ERROR: test_slim_handler (tests.tests.TestZappa) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/runner/work/Zappa/Zappa/tests/tests.py", line 2211, in test_slim_handler zappa_cli.create_package() File "/home/runner/work/Zappa/Zappa/zappa/cli.py", line 2430, in create_package venv=self.zappa.create_handler_venv(), File "/home/runner/work/Zappa/Zappa/zappa/core.py", line 494, in create_handler_venv raise EnvironmentError("Pypi lookup failed") OSError: Pypi lookup failed -------------------- >> begin captured stdout << --------------------- ``` * 📝 update CHANGELOG with committed changes since last release (5b6e241) * 🔥 remove 3.6 from docs * 🔧 address review comments * ✨ change release to 0.55.1 * ♻️ Update to allow specification of the latest pypi version for `test_slim_handler()` * ✅ update `test_slim_handler()` so that lastest pypi version is *not* hardcoded (get from "git tags" result) * 🎨 run black/isort * 🔧 attempt to update github action to retrieve the latest tags. * 🔧 fix bad ci command definition * 📝 created and added issue for python3.6 support removal. * ✨ add `python_requires` to setup(). * 📝 fix issue #900 * 📝 add link to https://slackautoinviter.herokuapp.com to join slack. (the zappateam.slack may be private?) * 🔥 remove `future` (past) requirements basestring usage, replacing with isinstance(x, str) 🔧 change usage of utcnow() -> datetime.datetime.now(datetime.timezone.utc) * 🔥 Remove 'futures' package requirement (#826) * 📝 fix issue #900 * 🔥 remove unnecessary __future__ import 🔧 Start versioning at 0; 0.55.1 -> 0.55.0 * 🎨 fix flake8 * 🐛 fix cd.yaml to only run on push of tag meeting the release tag criteria. (#1152) * 📝 add 1152 to CHANGELOG
1 parent a1e842c commit fff5ed8

33 files changed

+602
-1581
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--- Provide a general summary of the issue in the Title above -->
22
## Context
33
<!--- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug -->
4-
<!--- Also, please make sure that you are running Zappa _from a virtual environment_ and are using Python 3.6/3.7/3.8 -->
4+
<!--- Also, please make sure that you are running Zappa _from a virtual environment_ and are using Python 3.7/3.8/3.9 -->
55

66
## Expected Behavior
77
<!--- Tell us what should happen -->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Before you submit this PR, please make sure that you meet these criteria:
2020
2121
* Did you **make sure this code actually works on Lambda**, as well as locally?
2222
23-
* Did you test this code with all of **Python 3.6**, **Python 3.7** and **Python 3.8** ?
23+
* Did you test this code with all of **Python 3.7**, **Python 3.8** and **Python 3.9** ?
2424
2525
* Does this commit ONLY relate to the issue at hand and have your linter shit all over the code?
2626

.github/workflows/cd.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
name: CD
22

33
on: # yamllint disable-line rule:truthy
4-
create:
4+
# From documentation:
5+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushbranchestagsbranches-ignoretags-ignore
6+
# on.push.tags: If you define only tags/tags-ignore or only branches/branches-ignore, the workflow won't run for events affecting the undefined Git ref.
7+
#
8+
# This workflow will only run when a tag matching the criteria is pushed
9+
push:
510
tags: ["v?[0-9]+.[0-9]+.[0-9]+"]
611

712
jobs:

.github/workflows/ci.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-20.04
1212
strategy:
1313
matrix:
14-
python: [3.6, 3.7, 3.8, 3.9]
14+
python: [3.7, 3.8, 3.9]
1515
steps:
1616
- name: Checkout Code Repository
1717
uses: actions/checkout@v2
@@ -22,8 +22,10 @@ jobs:
2222
- uses: actions/cache@v2
2323
with:
2424
path: ~/.cache/pip
25-
key: ${{ runner.os }}-pip${{ matrix.python }}-${{ hashFiles('requirements.txt') }}
25+
key: ${{ runner.os }}-pip${{ matrix.python }}-${{ hashFiles('Pipfile') }}
2626
restore-keys: ${{ runner.os }}-pip${{ matrix.python }}-
27+
- name: make sure we have version tags
28+
run: git fetch --unshallow --tags
2729
- name: Setup Virtualenv
2830
run: python -m venv .venv
2931
- name: Install

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*~
22
*.zip
3+
Pipfile.lock
34

45
# Byte-compiled / optimized / DLL files
56
__pycache__/

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Zappa Changelog
22

3+
## 0.55.0
4+
* Fix "cd workflow fired event outside of the create tags event" (#1152)
5+
* Remove 'futures' package requirement (#826,#808)
6+
* Remove function invoke command does not need quotes around function (#900)
7+
* Add python_requires to setup.py (#1111)
8+
* Remove python 3.6 support (#1151)
9+
* Update handler to be global if INSTANTIATE_LAMBDA_HANDLER_ON_IMPORT=True (#1096)
10+
* Fix async invocation in Python 3 (#1006)
11+
* Drastically reduce cold start times by calling LambdaHandler externally (#982)
12+
* Support Newest Manylinux Version for dependencies (#1083)
13+
* Decode zappa invoke output regardless of --no-color option (#1069)
14+
* Convert project to using 'pipenv' to manage dependencies (#1077)
15+
* Ensure unique scheduled event names (#1080)
16+
* Check isort in CI (#1078)
17+
* Use 'black' everywhere (#1076)
18+
* Update setup.py (#1050)
19+
20+
## 0.54.2
21+
* Update documentation to reflect python 3.9 support (#1137)
22+
323
## 0.54.1
424
* Increase Lambda client read timeout to 15m (#1065)
525
* Unpin `Werkzeug` from `v0.x` (#1067)

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ clean:
2727
rm -f .coverage
2828

2929
requirements:
30-
pip install pipenv==2021.11.09
30+
pip install pipenv>2021.11.15
3131
pipenv lock
3232
pipenv sync --dev
3333

@@ -39,10 +39,10 @@ mypy:
3939
mypy --show-error-codes --pretty --ignore-missing-imports --strict zappa tests
4040

4141
black:
42-
black .
42+
black --line-length 127 .
4343

4444
black-check:
45-
black . --check
45+
black --line-length 127 . --check
4646
@echo "If this fails, simply run: make black"
4747

4848
isort:
@@ -53,7 +53,7 @@ isort-check:
5353

5454
flake:
5555
flake8 zappa --count --select=E9,F63,F7,F82 --show-source --statistics
56-
flake8 zappa --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
56+
flake8 zappa --count --exit-zero --max-complexity=55 --max-line-length=127 --statistics --ignore F403,F405,E203,E231,E252,W503
5757

5858
test-docs:
5959
nosetests tests/tests_docs.py --with-coverage --cover-package=zappa --with-timer

Pipfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ mock = "*"
1616
mypy = "*"
1717
nose = "*"
1818
nose-timer = "*"
19-
pipenv = "==2021.11.09"
19+
pipenv = ">2021.11.15"
20+
packaging = "*"
2021

2122
[packages]
2223
argcomplete = "*"
2324
boto3 = ">=1.17.28"
2425
durationpy = "*"
25-
future = "*"
2626
hjson = "*"
2727
jmespath = "*"
2828
kappa = "==0.6.0"

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ __Awesome!__
135135

136136
## Installation and Configuration
137137

138-
_Before you begin, make sure you are running Python 3.6/3.7/3.8 and you have a valid AWS account and your [AWS credentials file](https://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs) is properly installed._
138+
_Before you begin, make sure you are running Python 3.7/3.8/3.9 and you have a valid AWS account and your [AWS credentials file](https://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs) is properly installed._
139139

140140
**Zappa** can easily be installed through pip, like so:
141141

@@ -394,11 +394,11 @@ You can execute any function in your application directly at any time by using t
394394

395395
For instance, suppose you have a basic application in a file called "my_app.py", and you want to invoke a function in it called "my_function". Once your application is deployed, you can invoke that function at any time by calling:
396396

397-
$ zappa invoke production 'my_app.my_function'
397+
$ zappa invoke production my_app.my_function
398398

399399
Any remote print statements made and the value the function returned will then be printed to your local console. **Nifty!**
400400

401-
You can also invoke interpretable Python 3.6/3.7/3.8 strings directly by using `--raw`, like so:
401+
You can also invoke interpretable Python 3.7/3.8/3.9 strings directly by using `--raw`, like so:
402402

403403
$ zappa invoke production "print(1 + 2 + 3)" --raw
404404

@@ -929,7 +929,7 @@ to change Zappa's behavior. Use these at your own risk!
929929
"role_name": "MyLambdaRole", // Name of Zappa execution role. Default <project_name>-<env>-ZappaExecutionRole. To use a different, pre-existing policy, you must also set manage_roles to false.
930930
"role_arn": "arn:aws:iam::12345:role/app-ZappaLambdaExecutionRole", // ARN of Zappa execution role. Default to None. To use a different, pre-existing policy, you must also set manage_roles to false. This overrides role_name. Use with temporary credentials via GetFederationToken.
931931
"route53_enabled": true, // Have Zappa update your Route53 Hosted Zones when certifying with a custom domain. Default true.
932-
"runtime": "python3.6", // Python runtime to use on Lambda. Can be one of "python3.6", "python3.7" or "python3.8". Defaults to whatever the current Python being used is.
932+
"runtime": "python3.9", // Python runtime to use on Lambda. Can be one of "python3.7", "python3.8", or "python3.9". Defaults to whatever the current Python being used is.
933933
"s3_bucket": "dev-bucket", // Zappa zip bucket,
934934
"slim_handler": false, // Useful if project >50M. Set true to just upload a small handler to Lambda and load actual project from S3 at runtime. Default false.
935935
"settings_file": "~/Projects/MyApp/settings/dev_settings.py", // Server side settings file location,
@@ -1538,6 +1538,7 @@ If you are adding a non-trivial amount of new code, please include a functioning
15381538
Please include the GitHub issue or pull request URL that has discussion related to your changes as a comment in the code ([example](https://github.com/zappa/Zappa/blob/fae2925431b820eaedf088a632022e4120a29f89/zappa/zappa.py#L241-L243)). This greatly helps for project maintainability, as it allows us to trace back use cases and explain decision making. Similarly, please make sure that you meet all of the requirements listed in the [pull request template](https://raw.githubusercontent.com/zappa/Zappa/master/.github/PULL_REQUEST_TEMPLATE.md).
15391539

15401540
Please feel free to work on any open ticket, especially any ticket marked with the "help-wanted" label. If you get stuck or want to discuss an issue further, please join [our Slack channel](https://zappateam.slack.com/), where you'll find a community of smart and interesting people working dilligently on hard problems.
1541+
[Zappa Slack Auto Invite](https://slackautoinviter.herokuapp.com)
15411542

15421543
Zappa does not intend to conform to PEP8, isolate your commits so that changes to functionality with changes made by your linter.
15431544

example/authmodule.py

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,10 @@ def _addMethod(self, effect, verb, resource, conditions):
106106
the internal list contains a resource ARN and a condition statement. The condition
107107
statement can be null."""
108108
if verb != "*" and not hasattr(HttpVerb, verb):
109-
raise NameError(
110-
"Invalid HTTP verb " + verb + ". Allowed verbs in HttpVerb class"
111-
)
109+
raise NameError("Invalid HTTP verb " + verb + ". Allowed verbs in HttpVerb class")
112110
resourcePattern = re.compile(self.pathRegex)
113111
if not resourcePattern.match(resource):
114-
raise NameError(
115-
"Invalid resource path: "
116-
+ resource
117-
+ ". Path should match "
118-
+ self.pathRegex
119-
)
112+
raise NameError("Invalid resource path: " + resource + ". Path should match " + self.pathRegex)
120113

121114
if resource[:1] == "/":
122115
resource = resource[1:]
@@ -137,13 +130,9 @@ def _addMethod(self, effect, verb, resource, conditions):
137130
)
138131

139132
if effect.lower() == "allow":
140-
self.allowMethods.append(
141-
{"resourceArn": resourceArn, "conditions": conditions}
142-
)
133+
self.allowMethods.append({"resourceArn": resourceArn, "conditions": conditions})
143134
elif effect.lower() == "deny":
144-
self.denyMethods.append(
145-
{"resourceArn": resourceArn, "conditions": conditions}
146-
)
135+
self.denyMethods.append({"resourceArn": resourceArn, "conditions": conditions})
147136

148137
def _getEmptyStatement(self, effect):
149138
"""Returns an empty statement object prepopulated with the correct action and the
@@ -222,11 +211,7 @@ def build(self):
222211
"policyDocument": {"Version": self.version, "Statement": []},
223212
}
224213

225-
policy["policyDocument"]["Statement"].extend(
226-
self._getStatementForEffect("Allow", self.allowMethods)
227-
)
228-
policy["policyDocument"]["Statement"].extend(
229-
self._getStatementForEffect("Deny", self.denyMethods)
230-
)
214+
policy["policyDocument"]["Statement"].extend(self._getStatementForEffect("Allow", self.allowMethods))
215+
policy["policyDocument"]["Statement"].extend(self._getStatementForEffect("Deny", self.denyMethods))
231216

232217
return policy

0 commit comments

Comments
 (0)