Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Commit 07f10ec

Browse files
committed
Move common SNS subscription filter policy logic to its own app
1 parent f1f0d03 commit 07f10ec

File tree

15 files changed

+1127
-0
lines changed

15 files changed

+1127
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length = 120
3+
ignore = E126
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"python.unitTest.unittestEnabled": false,
3+
"python.unitTest.nosetestsEnabled": false,
4+
"python.unitTest.pyTestEnabled": true,
5+
"python.unitTest.pyTestPath": "pipenv",
6+
"python.unitTest.pyTestArgs": [
7+
"run",
8+
"py.test",
9+
"--cov",
10+
"app",
11+
"--cov-fail-under",
12+
"85",
13+
"-vv",
14+
"test/unit"
15+
],
16+
"python.linting.pylintEnabled": false,
17+
"python.linting.ignorePatterns": [
18+
".vscode/*.py",
19+
"**/site-packages/**/*.py",
20+
"dist/**/*.py"
21+
],
22+
"python.linting.flake8Enabled": true,
23+
"python.linting.flake8Path": "pipenv",
24+
"python.linting.flake8Args": [
25+
"run",
26+
"flake8",
27+
"app"
28+
],
29+
"python.linting.pydocstyleEnabled": true,
30+
"python.linting.pydocstylePath": "pipenv",
31+
"python.linting.pydocstyleArgs": [
32+
"run",
33+
"pydocstyle",
34+
"app"
35+
],
36+
"python.formatting.autopep8Path": "pipenv",
37+
"python.formatting.autopep8Args": [
38+
"run",
39+
"autopep8",
40+
"--max-line-length=120",
41+
"--ignore",
42+
"E126,E226,E24,W503"
43+
]
44+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
SHELL := /bin/sh
2+
PY_VERSION := 3.6
3+
4+
export PYTHONUNBUFFERED := 1
5+
6+
BUILD_DIR := dist
7+
8+
# Required environment variables (user must override)
9+
10+
# S3 bucket used for packaging SAM templates
11+
PACKAGE_BUCKET ?= your-bucket-here
12+
13+
# user can optionally override the following by setting environment variables with the same names before running make
14+
15+
# Path to system pip
16+
PIP ?= pip
17+
# Default AWS CLI region
18+
AWS_DEFAULT_REGION ?= us-east-1
19+
20+
PYTHON := $(shell /usr/bin/which python$(PY_VERSION))
21+
22+
.DEFAULT_GOAL := build
23+
24+
clean:
25+
rm -rf $(BUILD_DIR)
26+
27+
# used once just after project creation to lock and install dependencies
28+
bootstrap:
29+
$(PYTHON) -m $(PIP) install pipenv --user
30+
pipenv lock
31+
pipenv sync --dev
32+
33+
# used by CI build to install dependencies
34+
init:
35+
$(PYTHON) -m $(PIP) install pipenv --user
36+
pipenv sync --dev
37+
38+
compile:
39+
mkdir -p $(BUILD_DIR)
40+
pipenv run flake8 src
41+
pipenv run pydocstyle src
42+
pipenv run cfn-lint template.yml
43+
pipenv run py.test --cov=src --cov-fail-under=85 -vv test/unit
44+
45+
build: compile
46+
47+
package: compile
48+
cp -r template.yml src $(BUILD_DIR)
49+
50+
# package dependencies in lib dir
51+
pipenv lock --requirements > $(BUILD_DIR)/requirements.txt
52+
pipenv run pip install -t $(BUILD_DIR)/src/lib -r $(BUILD_DIR)/requirements.txt
53+
54+
# replace code local references with S3
55+
pipenv run sam package --template-file $(BUILD_DIR)/template.yml --s3-bucket $(PACKAGE_BUCKET) --output-template-file $(BUILD_DIR)/packaged-template.yml
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[[source]]
2+
url = "https://pypi.python.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
boto3 = "*"
8+
aws-xray-sdk = "*"
9+
cfn-resource = "*"
10+
11+
[dev-packages]
12+
flake8 = "*"
13+
autopep8 = "*"
14+
pydocstyle = "*"
15+
cfn-lint = "*"
16+
aws-sam-cli = "*"
17+
awscli = "*"
18+
pytest = "*"
19+
pytest-mock = "*"
20+
pytest-cov = "*"
21+
22+
[requires]
23+
python_version = "3.6"

0 commit comments

Comments
 (0)