Skip to content

Commit 41235e6

Browse files
authored
Merge pull request #17 from pritam001/feature-flasgger
Feature flasgger
2 parents c215b7b + 7ba0e69 commit 41235e6

File tree

17 files changed

+129
-27
lines changed

17 files changed

+129
-27
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,6 @@ logs/
141141

142142
# mypy
143143
.mypy_cache/
144+
145+
# terminalizer
146+
config.yml

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ format: #: Format and fix python code with black, isort, autoflake
7373
@echo "\n$(BOLD_CYAN)Flaking$(RESET_STYLES) ❄️"
7474
flake8 --version
7575
autoflake --remove-all-unused-imports --remove-unused-variables --remove-duplicate-keys --ignore-init-module-imports -i -r $(APP_DIR) $(TEST_DIR) $(HOME_DIR_PY_FILES)
76+
@echo "\n"
7677

7778

7879
lint: #: Run static analysis with flake8, radon, mypy and bandit
@@ -91,4 +92,5 @@ lint: #: Run static analysis with flake8, radon, mypy and bandit
9192
@echo "\n$(BOLD_CYAN)Running pre-commit hooks$(RESET_STYLES) 🏁️️️"
9293
pre-commit run --all-files
9394
@echo "\n$(BOLD_CYAN)All checks passed$(RESET_STYLES) 🏳️️️️"
95+
@echo "\n"
9496

README.md

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,33 @@ Tools
1919
[![Static Typing: mypy](https://img.shields.io/badge/static%20typing-mypy-blue.svg?style=flat)](https://github.com/python/mypy/)
2020
[![Security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg?style=flat)](https://github.com/PyCQA/bandit)
2121
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?style=flat&logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
22+
[![API Specs](https://img.shields.io/badge/specs-flasgger-6D9A00?style=flat&logo=swagger&logoColor=white)](https://github.com/flasgger/flasgger)
2223

2324

2425
Usage Guide
2526
------------------------------------------------------------------------------
2627
This is a template project hosted on GitHub which can be used to create new repositories.
2728

28-
Steps for creating boilerplate project in GitHub
29-
------------------------------------------------------------------------------
30-
0. Create a new repository named "my-pyflask-project" using this template repository *
31-
0. `git clone https://www.github.com/username/my-pyflask-project.git`
32-
0. `cd my-pyflask-project`
33-
0. Create and activate conda environment `conda activate my-conda-venv` **
34-
0. `make setup` : Use pip-tools, pip-compile, pip install to setup python packages
29+
30+
### Steps for creating boilerplate project in GitHub
31+
1. Create a new repository named "my-pyflask-project" using this template repository *
32+
1. `git clone https://www.github.com/username/my-pyflask-project.git`
33+
1. `cd my-pyflask-project`
34+
1. Create and activate conda environment `conda activate my-conda-venv` **
35+
1. `make setup` : Use pip-tools, pip-compile, pip install to setup python packages
3536

3637
\* [GitHub Guide: Creating a repository from a template](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template)
3738
<br>
3839
\** [Guide to Conda environment](https://github.com/pritam001/pyflask-microservice-base/blob/master/documentation/conda.md)
3940

4041

41-
Make Guide
42-
------------------------------------------------------------------------------
42+
### Make Guide
4343
Type `make help` for available commands
4444

4545
<p align="center"><img src="documentation/assets/make-help.gif" /></p>
4646

4747

48-
Linting Guide
49-
------------------------------------------------------------------------------
48+
### Linting Guide
5049
`make format` : Format and fix python code with black, isort, autoflake
5150

5251
<p align="center"><img src="documentation/assets/make-format.gif" /></p>
@@ -56,8 +55,39 @@ Linting Guide
5655
<p align="center"><img src="documentation/assets/make-lint.gif" /></p>
5756

5857

59-
Contributing
58+
### Documentation
59+
Flasgger docs can be found at http://0.0.0.0:8420/api/v1/pyflask-service/swagger
60+
61+
API specs can be found at http://0.0.0.0:8420/api/v1/pyflask-service/swagger_spec
62+
63+
Flasgger UI version: v2 | OpenAPI version: 2
64+
65+
<p align="center"><img src="documentation/assets/flasgger_intro.png" /></p>
66+
67+
68+
Development Setup
6069
------------------------------------------------------------------------------
61-
[![](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/images/0)](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/links/0)[![](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/images/1)](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/links/1)[![](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/images/2)](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/links/2)[![](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/images/3)](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/links/3)[![](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/images/4)](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/links/4)[![](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/images/5)](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/links/5)[![](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/images/6)](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/links/6)[![](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/images/7)](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/links/7)
70+
To be updated
6271

6372

73+
Contributing
74+
------------------------------------------------------------------------------
75+
[![](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/images/0)](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/links/0)
76+
[![](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/images/1)](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/links/1)
77+
[![](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/images/2)](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/links/2)
78+
[![](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/images/3)](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/links/3)
79+
[![](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/images/4)](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/links/4)
80+
[![](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/images/5)](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/links/5)
81+
[![](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/images/6)](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/links/6)
82+
[![](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/images/7)](https://sourcerer.io/fame/pritam001/pritam001/pyflask-microservice-base/links/7)
83+
84+
85+
TODO
86+
-----------------------------------------------------------------------------
87+
- [x] Swagger support
88+
- [ ] Update linting documentation
89+
- [ ] Introduction of testing tools
90+
- [ ] Testing tools documentation
91+
- [ ] Version handling by tbump
92+
- [ ] Add CoC, Contribution guidelines, PR and issue
93+
158 KB
Loading

documentation/assets/make-lint.gif

196 KB
Loading

documentation/flasgger.md

Whitespace-only changes.

requirements/dev-requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ flake8-blind-except
2020
flake8-breakpoint
2121
flake8-builtins
2222
flake8-comprehensions
23+
flake8-eradicate
2324
flake8-logging-format
2425
flake8-print
2526
flake8-pytest

requirements/dev-requirements.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@
66
#
77
appdirs==1.4.4 # via black, virtualenv
88
astroid==2.4.2 # via pylint
9-
attrs==19.3.0 # via black
9+
attrs==19.3.0 # via black, flake8-eradicate
1010
autoflake==1.3.1 # via -r requirements/dev-requirements.in
1111
bandit==1.6.2 # via -r requirements/dev-requirements.in
1212
black==19.10b0 # via -r requirements/dev-requirements.in
1313
cfgv==3.2.0 # via pre-commit
1414
click==7.1.2 # via black
1515
colorama==0.4.3 # via radon
1616
distlib==0.3.1 # via virtualenv
17+
eradicate==1.0 # via flake8-eradicate
1718
filelock==3.0.12 # via virtualenv
1819
flake8-blind-except==0.1.1 # via -r requirements/dev-requirements.in
1920
flake8-breakpoint==1.1.0 # via -r requirements/dev-requirements.in
2021
flake8-builtins==1.5.3 # via -r requirements/dev-requirements.in
2122
flake8-comprehensions==3.2.3 # via -r requirements/dev-requirements.in
23+
flake8-eradicate==0.4.0 # via -r requirements/dev-requirements.in
2224
flake8-flask==0.9.3 # via -r requirements/dev-requirements.in
2325
flake8-logging-format==0.6.0 # via -r requirements/dev-requirements.in
2426
flake8-plugin-utils==1.3.1 # via flake8-breakpoint, flake8-pytest-style, flake8-return
@@ -27,7 +29,7 @@ flake8-print==3.1.4 # via -r requirements/dev-requirements.in
2729
flake8-pytest-style==1.2.3 # via -r requirements/dev-requirements.in
2830
flake8-pytest==1.3 # via -r requirements/dev-requirements.in
2931
flake8-return==1.1.2 # via -r requirements/dev-requirements.in
30-
flake8==3.8.3 # via -r requirements/dev-requirements.in, flake8-builtins, flake8-comprehensions, flake8-flask, flake8-polyfill, flake8-print, flake8-pytest
32+
flake8==3.8.3 # via -r requirements/dev-requirements.in, flake8-builtins, flake8-comprehensions, flake8-eradicate, flake8-flask, flake8-polyfill, flake8-print, flake8-pytest
3133
future==0.18.2 # via radon
3234
gitdb==4.0.5 # via gitpython
3335
gitpython==3.1.7 # via bandit

requirements/requirements.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
Flask
22
dynaconf
3-
flask_apispec
4-
flask_cors
3+
flask_cors
4+
flasgger
5+
marshmallow
6+
apispec

requirements/requirements.txt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,23 @@
44
#
55
# pip-compile --output-file=requirements/requirements.txt requirements/requirements.in
66
#
7-
apispec==3.3.1 # via flask-apispec
7+
apispec==3.3.1 # via -r requirements/requirements.in
8+
attrs==19.3.0 # via jsonschema
89
click==7.1.2 # via flask
910
dynaconf==3.0.0 # via -r requirements/requirements.in
10-
flask-apispec==0.9.0 # via -r requirements/requirements.in
11+
flasgger==0.9.5 # via -r requirements/requirements.in
1112
flask-cors==3.0.8 # via -r requirements/requirements.in
12-
flask==1.1.2 # via -r requirements/requirements.in, flask-apispec, flask-cors
13+
flask==1.1.2 # via -r requirements/requirements.in, flasgger, flask-cors
1314
itsdangerous==1.1.0 # via flask
1415
jinja2==2.11.2 # via flask
16+
jsonschema==3.2.0 # via flasgger
1517
markupsafe==1.1.1 # via jinja2
16-
marshmallow==3.7.1 # via flask-apispec, webargs
17-
six==1.15.0 # via flask-apispec, flask-cors
18-
webargs==5.5.3 # via flask-apispec
18+
marshmallow==3.7.1 # via -r requirements/requirements.in
19+
mistune==0.8.4 # via flasgger
20+
pyrsistent==0.16.0 # via jsonschema
21+
pyyaml==5.3.1 # via flasgger
22+
six==1.15.0 # via flasgger, flask-cors, jsonschema
1923
werkzeug==1.0.1 # via flask
24+
25+
# The following packages are considered to be unsafe in a requirements file:
26+
# setuptools

0 commit comments

Comments
 (0)