Skip to content

Commit 2bc4a90

Browse files
Updated example
1 parent 944f39c commit 2bc4a90

File tree

14 files changed

+4638
-10500
lines changed

14 files changed

+4638
-10500
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[flake8]
2+
ignore = E203, E266, E501, W503, F403, F401
3+
max-line-length = 89
4+
max-complexity = 18
5+
select = B,C,E,F,W,T4,B9
6+
require-plugins =
7+
flake8-bugbear
8+
flake8-black
Lines changed: 139 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,146 @@
1-
# package directories
2-
node_modules
3-
.build
1+
##### IDE's #####
2+
# VisualStudioCode
3+
/.vscode/
4+
.vscode/*
5+
!.vscode/settings.json
6+
!.vscode/tasks.json
7+
!.vscode/launch.json
8+
!.vscode/extensions.json
9+
*.code-workspace
10+
.history
411

5-
# testing
6-
coverage
12+
# IntelliJ IDEA
13+
.idea/*
714

8-
temp
9-
dist
10-
.webpack
11-
.webpackCache
15+
##### Database #####
16+
*.accdb
17+
*.db
18+
*.dbf
19+
*.mdb
20+
*.pdb
21+
*.sqlite3
1222

13-
# Serverless directories
14-
.serverless
23+
##### Logs #####
24+
*.log
25+
*.log*
1526

16-
ideas.txt
17-
.DS_Store
18-
.idea/*
27+
##### Python #####
28+
# Byte-compiled / optimized / DLL files
29+
__pycache__/
30+
*.py[cod]
31+
*$py.class
1932

20-
*.log
33+
# Distribution / packaging
34+
.Python
35+
build/
36+
develop-eggs/
37+
dist/
38+
downloads/
39+
eggs/
40+
.eggs/
41+
lib/
42+
lib64
43+
lib64/
44+
parts/
45+
sdist/
46+
var/
47+
wheels/
48+
pip-wheel-metadata/
49+
share/python-wheels/
50+
*.egg-info/
51+
.installed.cfg
52+
*.egg
53+
MANIFEST
54+
bin/
2155

56+
# Environments
57+
Makefile
2258
.env
59+
.env.*
60+
!.env.example.json
61+
!.env.compose.local
62+
.venv
63+
env/
64+
venv/
65+
ENV/
66+
env.bak/
67+
venv.bak/
68+
.flaskenv
69+
pyvenv.cfg
70+
71+
# PyInstaller
72+
*.manifest
73+
*.spec
74+
75+
# Installer logs
76+
pip-log.txt
77+
pip-delete-this-directory.txt
78+
79+
# Unit test / coverage reports
80+
htmlcov/
81+
.tox/
82+
.nox/
83+
.coverage
84+
.coverage.*
85+
.cache
86+
nosetests.xml
87+
coverage.xml
88+
*.cover
89+
*.py,cover
90+
.hypothesis/
91+
.pytest_cache/
92+
93+
# Flask stuff:
94+
instance/
95+
.webassets-cache
96+
97+
# Translations
98+
*.mo
99+
*.pot
100+
101+
# Sphinx documentation
102+
docs/_build/
103+
104+
# PyBuilder
105+
target/
106+
107+
# IPython
108+
profile_default/
109+
ipython_config.py
110+
111+
# PEP 582
112+
__pypackages__/
113+
114+
# mkdocs documentation
115+
/site
116+
117+
# mypy
118+
.mypy_cache/
119+
.dmypy.json
120+
dmypy.json
121+
122+
# Pyre type checker
123+
.pyre/
124+
125+
# pytype static type analyzer
126+
.pytype/
127+
128+
# C extensions
129+
*.so
130+
131+
##### Heroku (old) #####
132+
Procfile
133+
134+
###
135+
postgres-calculate/
136+
137+
app/authentication/test_view.py
138+
139+
# Serverless
140+
node_modules/
141+
.serverless/
142+
143+
# wsgi
144+
wsgi_handler.py
145+
serverless_wsgi.py
146+
.serverless-wsgi
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"MD041": false,
3+
"MD042": false,
4+
"MD004": false,
5+
"MD013": false,
6+
"MD033": false
7+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v16.13.2
1+
v18.17.0
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/ambv/black
5+
rev: 23.1.0
6+
hooks:
7+
- id: black
8+
language_version: python3
9+
- repo: https://github.com/pycqa/flake8
10+
rev: 6.0.0
11+
hooks:
12+
- id: flake8
13+
additional_dependencies: [flake8-black, flake8-bugbear]

examples/serverless-python-fastapi/README.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,46 @@
1-
# Serverless FastAPI
1+
# Serverless FastAPI example
22

3-
Serverless Framework + FastAPI example with the following features:
4-
5-
- production ready deployment
6-
- local development out of the box
3+
We use [Serverless](https://www.serverless.com/) to deploy our API to AWS Lambda.
74

85
## Requirements
96

10-
**You’ll need to have Node 16.13.2 or later on your local development machine** (but it’s not required on the server). You can use [fnm](https://github.com/Schniz/fnm) to easily switch Node versions between different projects.
7+
**You’ll need to have Node 18.17.0 or later on your local development machine** (but it’s not required on the server). You can use [fnm](https://github.com/Schniz/fnm) to easily switch Node versions between different projects.
118

129
```sh
1310
fnm use
1411
npm install
1512
```
1613

17-
**You'll also need to have Python 3.9 installed on your local development machine**. You can use [pyenv](https://github.com/pyenv/pyenv) to easily switch Python versions between different projects.
14+
**You'll also need to have Python 3.9 installed on your local development machine**. You can use [pyenv](https://github.com/pyenv/pyenv) to easily switch Python versions between different projects. If you are using Windows, you should use [pyenv-win](https://github.com/pyenv-win/pyenv-win).
1815

1916
```sh
2017
pyenv install
2118
pyenv local
2219
```
2320

21+
### Gotchas for Certain Environments
22+
23+
**Depending on your dev environment, it may also be necessary to create and initiate a virtualenv for python**. Do so by running the below commands:
24+
25+
```sh
26+
python3 -m venv venv
27+
source venv/bin/activate
28+
pip3 install -r requirements.txt
29+
```
30+
31+
For windows user using WSL2, you may also need to have Docker Desktop installed, running, and with the [WSL2 connection](https://learn.microsoft.com/en-us/windows/wsl/tutorials/wsl-containers) set up.
32+
2433
## Local Development
2534

2635
In order to develop locally, you'll need to install the dependencies and run the application using Serverless Offline.
2736

28-
### Serverless
29-
30-
#### Install Dependencies
37+
### Install Dependencies
3138

3239
```sh
3340
npm run sls requirements install
3441
```
3542

36-
#### Run the Application
43+
### Run the Application
3744

3845
This repo has a local development set up that uses the file `.env.local` to configure the local environment.
3946
Run the following command to start the local development server:

0 commit comments

Comments
 (0)