File tree Expand file tree Collapse file tree 3 files changed +16
-12
lines changed Expand file tree Collapse file tree 3 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -19,11 +19,7 @@ ci: typecheck test lint
1919
2020typecheck :
2121@echo check types
22- mypy ./ \
23- --disallow-untyped-defs \
24- --disallow-any-expr \
25- --no-implicit-optional \
26- --no-site-packages \
22+ mypy ./python_api_template
2723
2824lint :
2925@echo check style
3733# #### application
3834GUNICORN_CONFIG_PATH := config/gunicorn.py
3935
40- install :
41- poetry install
42-
4336launch :
4437gunicorn app:app -c ${GUNICORN_CONFIG_PATH}
4538
Original file line number Diff line number Diff line change 1+ # Global options:
2+
3+ [mypy]
4+ python_version = 3.7
5+ disallow_untyped_defs = True
6+ no_implicit_optional = True
7+
8+ # Per-module options:
9+ [tests/*]
10+ ignore_errors = True
Original file line number Diff line number Diff line change 11
22from flask import Blueprint , Flask , jsonify
3+ from flask .wrappers import Response
34
45
56dummy = Blueprint ('dummy' , __name__ )
67api = Blueprint ('api' , __name__ )
78
89
910@dummy .route ('/' , methods = ["GET" ])
10- def dummy_home ():
11+ def dummy_home () -> Response :
1112 return jsonify ({
1213 "msg" : "hello {}" .format (dummy .name )
1314 })
1415
1516
1617@api .route ('/' , methods = ["GET" ])
17- def api_home ():
18+ def api_home () -> Response :
1819 return jsonify ({
1920 "msg" : "hey {}" .format (api .name )
2021 })
2122
2223
23- def create_app (env = None ) :
24+ def create_app () -> Flask :
2425 app = Flask (__name__ )
2526 app .url_map .strict_slashes = False
2627 app .register_blueprint (dummy , url_prefix = '/dummy' )
2728 app .register_blueprint (api , url_prefix = '/api' )
2829
2930 @app .route ("/health" )
30- def health ():
31+ def health () -> Response :
3132 return jsonify ({
3233 "msg" : "I'm healthy"
3334 })
You can’t perform that action at this time.
0 commit comments