Skip to content
This repository was archived by the owner on Mar 7, 2023. It is now read-only.

Commit 257bc61

Browse files
committed
Initial release.
0 parents  commit 257bc61

File tree

16 files changed

+3387
-0
lines changed

16 files changed

+3387
-0
lines changed

.flake8

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
filename = *.py,src/
3+
max-line-length = 88
4+
extend-ignore = D105, D107, D401, E203, E402

.github/workflows/tests.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
---
2+
name: tests
3+
4+
on:
5+
push:
6+
paths-ignore:
7+
- "**.md"
8+
- "LICENSE"
9+
- ".gitignore"
10+
- ".pre-commit-config.yaml"
11+
12+
env:
13+
CACHE_DIR: /tmp/.workflow_cache
14+
POETRY_CACHE_DIR: /tmp/.workflow_cache/.pip_packages
15+
POETRY_VIRTUALENVS_PATH: /tmp/.workflow_cache/.venvs
16+
POETRY_HOME: /tmp/.workflow_cache/.poetry
17+
PIP_CACHE_DIR: /tmp/.workflow_cache/.pip_packages
18+
MYPY_CACHE_DIR: /tmp/.workflow_cache/.mypy
19+
20+
jobs:
21+
tests:
22+
runs-on: ${{ matrix.os }}
23+
strategy:
24+
matrix:
25+
os: ["ubuntu-latest"]
26+
python-version: ["3.x"]
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v3
30+
31+
- name: Set up Python ${{ matrix.python-version }}
32+
uses: actions/setup-python@v4
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
36+
- name: Cache dependencies
37+
uses: actions/cache@v3
38+
id: cache
39+
with:
40+
path: ${{ env.CACHE_DIR }}
41+
key: tests-${{ matrix.os }}-${{ matrix.python-version }}--${{ hashFiles('**/poetry.lock') }}
42+
43+
- name: Install dependencies
44+
run: |
45+
curl -sSL https://install.python-poetry.org | python -
46+
$POETRY_HOME/bin/poetry install -n -E speedups
47+
if: steps.cache.outputs.cache-hit != 'true'
48+
49+
- name: Python code style
50+
run: $POETRY_HOME/bin/poetry run black . --check --diff --preview
51+
if: ${{ always() }}
52+
53+
- name: Python code quality
54+
run: $POETRY_HOME/bin/poetry run flake8 --docstring-convention google
55+
if: ${{ always() }}
56+
57+
- name: Python code typing
58+
run: $POETRY_HOME/bin/poetry run mypy --strict --install-types --non-interactive .
59+
if: ${{ always() }}
60+
61+
- name: Python code complexity
62+
run: $POETRY_HOME/bin/poetry run radon cc -n C starlette_aws_lambda_api_client 1>&2
63+
if: ${{ always() }}
64+
65+
- name: Python code maintainability
66+
run: $POETRY_HOME/bin/poetry run radon mi -n B starlette_aws_lambda_api_client 1>&2
67+
if: ${{ always() }}
68+
69+
- name: Python code security
70+
run: $POETRY_HOME/bin/poetry run bandit starlette_aws_lambda_api_client -rs B404,B603
71+
if: ${{ always() }}
72+
73+
- name: YAML code style
74+
run: $POETRY_HOME/bin/poetry run yamllint -s .
75+
if: ${{ always() }}
76+
77+
- name: Test
78+
run: $POETRY_HOME/bin/poetry run pytest --junitxml=test-results.xml --cov-report xml
79+
if: ${{ always() }}
80+
81+
- name: Collect coverage report
82+
uses: codecov/codecov-action@v3
83+
84+
publish:
85+
runs-on: ${{ matrix.os }}
86+
strategy:
87+
matrix:
88+
os: ["ubuntu-latest"]
89+
python-version: ["3.x"]
90+
if: ${{ github.repository == 'JGoutin/starlette_aws_lambda_api_client' && github.ref_type == 'tag' }}
91+
needs: [tests]
92+
environment: PyPI
93+
permissions:
94+
contents: write
95+
steps:
96+
- name: Checkout repository
97+
uses: actions/checkout@v3
98+
99+
- name: Set up Python ${{ matrix.python-version }}
100+
uses: actions/setup-python@v4
101+
with:
102+
python-version: ${{ matrix.python-version }}
103+
104+
- name: Cache dependencies
105+
uses: actions/cache@v3
106+
id: cache
107+
with:
108+
path: ${{ env.CACHE_DIR }}
109+
key: tests-${{ matrix.os }}-${{ matrix.python-version }}--${{ hashFiles('**/poetry.lock') }}
110+
111+
- name: Build packages
112+
run: $POETRY_HOME/bin/poetry version $(echo -e "${{ github.ref_name }}" | tr -d 'v')
113+
114+
- name: Publish packages on PyPI
115+
run: $POETRY_HOME/bin/poetry publish --build
116+
env:
117+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
118+
119+
- name: Publish release on GitHub
120+
run: |
121+
go install github.com/tcnksm/ghr@latest
122+
~/go/bin/ghr -generatenotes $PRERELEASE -c ${{ github.sha }} ${{ github.ref_name }}
123+
env:
124+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+
PRERELEASE: ${{ contains(github.ref_name, '-') && '-prerelease' || '' }}

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Python compiled files
2+
__pycache__/
3+
*.py[cd]
4+
5+
# OS generated files
6+
.DS_Store
7+
.DS_Store?
8+
._*
9+
.Spotlight-V100
10+
.Trashes
11+
ehthumbs.db
12+
[Dd]esktop.ini
13+
Thumbs.db
14+
*~
15+
*.bak
16+
17+
# IDE generated files
18+
.project
19+
.pydevproject
20+
.spyproject
21+
.spyderproject
22+
.settings/
23+
.idea/
24+
.vscode/
25+
26+
# Tests generated files
27+
.cache/
28+
.coverage
29+
.coverage.*
30+
.mypy_cache/
31+
.pytest_cache/
32+
33+
# Build
34+
dist/

.pre-commit-config.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
repos:
3+
- repo: local
4+
hooks:
5+
- id: black
6+
name: Black (Formatting)
7+
entry: poetry run black . --preview
8+
language: system
9+
pass_filenames: false
10+
- id: mypy
11+
name: Mypy (Typing)
12+
entry: poetry run mypy --strict .
13+
language: system
14+
pass_filenames: false
15+
- id: flake8
16+
name: Flake8 (Quality)
17+
entry: poetry run flake8 --docstring-convention google
18+
language: system
19+
pass_filenames: false
20+
- id: radon_cc
21+
name: Radon (Cyclomatic complexity)
22+
entry: poetry run radon cc -n C starlette_aws_lambda_api_client
23+
language: system
24+
pass_filenames: false
25+
verbose: true
26+
- id: radon_mi
27+
name: Radon (Maintainability index)
28+
entry: poetry run radon mi -n B starlette_aws_lambda_api_client
29+
language: system
30+
pass_filenames: false
31+
verbose: true
32+
- id: bandit
33+
name: Bandit (Security)
34+
entry: poetry run bandit starlette_aws_lambda_api_client -qrs B404,B603
35+
language: system
36+
pass_filenames: false

.yamllint.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
extends: default
3+
rules:
4+
line-length: disable
5+
truthy: disable

LICENSE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Copyright 2022 Accelize
2+
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
5+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
7+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8+
9+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
![Tests](https://github.com/JGoutin/starlette_aws_lambda_api_client/workflows/tests/badge.svg)
2+
[![codecov](https://codecov.io/gh/JGoutin/starlette_aws_lambda_api_client/branch/main/graph/badge.svg)](https://codecov.io/gh/JGoutin/starlette_aws_lambda_api_client)
3+
[![PyPI](https://img.shields.io/pypi/v/starlette_aws_lambda_api_client.svg)](https://pypi.org/project/starlette_aws_lambda_api_client)
4+
5+
WIP

lint

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
poetry run pre-commit run --all-files

0 commit comments

Comments
 (0)