diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e36224b..ca396ef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,20 +18,25 @@ jobs: - uses: actions/setup-python@v1 with: python-version: 3.8 + - name: Store installed Python version + run: | + echo "::set-env name=PY_VERSION::"\ + "$(python -c "import platform;print(platform.python_version())")" - name: Cache pip test requirements uses: actions/cache@v1 with: path: ${{ env.PIP_CACHE_DIR }} - key: "${{ runner.os }}-pip-test-\ + key: "${{ runner.os }}-pip-test-py${{ env.PY_VERSION }}-\ ${{ hashFiles('**/requirements-test.txt') }}" restore-keys: | + ${{ runner.os }}-pip-test-py${{ env.PY_VERSION }}- ${{ runner.os }}-pip-test- ${{ runner.os }}-pip- - name: Cache pre-commit hooks uses: actions/cache@v1 with: path: ${{ env.PRE_COMMIT_CACHE_DIR }} - key: "${{ runner.os }}-pre-commit-\ + key: "${{ runner.os }}-pre-commit-py${{ env.PY_VERSION }}-\ ${{ hashFiles('**/.pre-commit-config.yaml') }}" - name: Install dependencies run: | @@ -46,13 +51,18 @@ jobs: - uses: actions/setup-python@v1 with: python-version: 3.8 + - name: Store installed Python version + run: | + echo "::set-env name=PY_VERSION::"\ + "$(python -c "import platform;print(platform.python_version())")" - name: Cache pip test requirements uses: actions/cache@v1 with: path: ${{ env.PIP_CACHE_DIR }} - key: "${{ runner.os }}-pip-test-\ + key: "${{ runner.os }}-pip-test-py${{ env.PY_VERSION }}-\ ${{ hashFiles('**/requirements-test.txt') }}" restore-keys: | + ${{ runner.os }}-pip-test-py${{ env.PY_VERSION }}- ${{ runner.os }}-pip-test- ${{ runner.os }}-pip- - name: Install dependencies @@ -76,13 +86,18 @@ jobs: - uses: actions/setup-python@v1 with: python-version: 3.8 + - name: Store installed Python version + run: | + echo "::set-env name=PY_VERSION::"\ + "$(python -c "import platform;print(platform.python_version())")" - name: Cache pip build requirements uses: actions/cache@v1 with: path: ${{ env.PIP_CACHE_DIR }} - key: "${{ runner.os }}-pip-build-\ + key: "${{ runner.os }}-pip-build-py${{ env.PY_VERSION }}-\ ${{ hashFiles('**/requirements.txt') }}" restore-keys: | + ${{ runner.os }}-pip-build-py${{ env.PY_VERSION }}- ${{ runner.os }}-pip-build- ${{ runner.os }}-pip- - name: Install dependencies diff --git a/.gitignore b/.gitignore index 724760e..2d46316 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ -*.egg-info +.mypy_cache __pycache__ -.python-version .coverage .pytest_cache +.python-version +*.egg-info +skeleton-aws-lambda.zip diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1522593..df79e95 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -47,7 +47,7 @@ repos: additional_dependencies: - flake8-docstrings - repo: https://github.com/asottile/pyupgrade - rev: v1.26.2 + rev: v2.0.0 hooks: - id: pyupgrade # Run bandit on "tests" tree with a configuration @@ -84,7 +84,7 @@ repos: rev: v4.2.0 hooks: - id: ansible-lint - # files: molecule/default/playbook.yml + # files: molecule/default/playbook.yml - repo: https://github.com/antonbabenko/pre-commit-terraform.git rev: v1.12.0 hooks: @@ -98,3 +98,7 @@ repos: rev: 1.19.1 hooks: - id: prettier + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.761 + hooks: + - id: mypy diff --git a/lambda_handler.py b/lambda_handler.py index 9cbaafe..7428cfa 100644 --- a/lambda_handler.py +++ b/lambda_handler.py @@ -25,10 +25,10 @@ # and # https://stackoverflow.com/questions/37703609/using-python-logging-with-aws-lambda # for more details. -root = logging.getLogger() -if root.handlers: - for handler in root.handlers: - root.removeHandler(handler) +logging_root = logging.getLogger() +if logging_root.handlers: + for logging_handler in logging_root.handlers: + logging_root.removeHandler(logging_handler) def handler(event, context):