Skip to content

Commit d526325

Browse files
committed
Project scaffolding
1 parent e90cc45 commit d526325

File tree

17 files changed

+660
-0
lines changed

17 files changed

+660
-0
lines changed

.flake8

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length=120
3+
exclude=.git,__pycache__,build,dist

.gitignore

Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
2+
# Created by https://www.toptal.com/developers/gitignore/api/jetbrains,python
3+
# Edit at https://www.toptal.com/developers/gitignore?templates=jetbrains,python
4+
5+
### JetBrains ###
6+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
7+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
8+
9+
# User-specific stuff
10+
.idea/**/workspace.xml
11+
.idea/**/tasks.xml
12+
.idea/**/usage.statistics.xml
13+
.idea/**/dictionaries
14+
.idea/**/shelf
15+
16+
# Generated files
17+
.idea/**/contentModel.xml
18+
19+
# Sensitive or high-churn files
20+
.idea/**/dataSources/
21+
.idea/**/dataSources.ids
22+
.idea/**/dataSources.local.xml
23+
.idea/**/sqlDataSources.xml
24+
.idea/**/dynamic.xml
25+
.idea/**/uiDesigner.xml
26+
.idea/**/dbnavigator.xml
27+
28+
# Gradle
29+
.idea/**/gradle.xml
30+
.idea/**/libraries
31+
32+
# Gradle and Maven with auto-import
33+
# When using Gradle or Maven with auto-import, you should exclude module files,
34+
# since they will be recreated, and may cause churn. Uncomment if using
35+
# auto-import.
36+
# .idea/artifacts
37+
# .idea/compiler.xml
38+
# .idea/jarRepositories.xml
39+
# .idea/modules.xml
40+
# .idea/*.iml
41+
# .idea/modules
42+
# *.iml
43+
# *.ipr
44+
45+
# CMake
46+
cmake-build-*/
47+
48+
# Mongo Explorer plugin
49+
.idea/**/mongoSettings.xml
50+
51+
# File-based project format
52+
*.iws
53+
54+
# IntelliJ
55+
out/
56+
57+
# mpeltonen/sbt-idea plugin
58+
.idea_modules/
59+
60+
# JIRA plugin
61+
atlassian-ide-plugin.xml
62+
63+
# Cursive Clojure plugin
64+
.idea/replstate.xml
65+
66+
# Crashlytics plugin (for Android Studio and IntelliJ)
67+
com_crashlytics_export_strings.xml
68+
crashlytics.properties
69+
crashlytics-build.properties
70+
fabric.properties
71+
72+
# Editor-based Rest Client
73+
.idea/httpRequests
74+
75+
# Android studio 3.1+ serialized cache file
76+
.idea/caches/build_file_checksums.ser
77+
78+
### JetBrains Patch ###
79+
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
80+
81+
# *.iml
82+
# modules.xml
83+
# .idea/misc.xml
84+
# *.ipr
85+
86+
# Sonarlint plugin
87+
# https://plugins.jetbrains.com/plugin/7973-sonarlint
88+
.idea/**/sonarlint/
89+
90+
# SonarQube Plugin
91+
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
92+
.idea/**/sonarIssues.xml
93+
94+
# Markdown Navigator plugin
95+
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
96+
.idea/**/markdown-navigator.xml
97+
.idea/**/markdown-navigator-enh.xml
98+
.idea/**/markdown-navigator/
99+
100+
# Cache file creation bug
101+
# See https://youtrack.jetbrains.com/issue/JBR-2257
102+
.idea/$CACHE_FILE$
103+
104+
# CodeStream plugin
105+
# https://plugins.jetbrains.com/plugin/12206-codestream
106+
.idea/codestream.xml
107+
108+
### Python ###
109+
# Byte-compiled / optimized / DLL files
110+
__pycache__/
111+
*.py[cod]
112+
*$py.class
113+
114+
# C extensions
115+
*.so
116+
117+
# Distribution / packaging
118+
.Python
119+
build/
120+
develop-eggs/
121+
dist/
122+
downloads/
123+
eggs/
124+
.eggs/
125+
lib/
126+
lib64/
127+
parts/
128+
sdist/
129+
wheels/
130+
pip-wheel-metadata/
131+
share/python-wheels/
132+
*.egg-info/
133+
.installed.cfg
134+
*.egg
135+
MANIFEST
136+
137+
# PyInstaller
138+
# Usually these files are written by a python script from a template
139+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
140+
*.manifest
141+
*.spec
142+
143+
# Installer logs
144+
pip-log.txt
145+
pip-delete-this-directory.txt
146+
147+
# Unit test / coverage reports
148+
htmlcov/
149+
.tox/
150+
.nox/
151+
.coverage
152+
.coverage.*
153+
.cache
154+
nosetests.xml
155+
coverage.xml
156+
*.cover
157+
*.py,cover
158+
.hypothesis/
159+
.pytest_cache/
160+
pytestdebug.log
161+
162+
# Translations
163+
*.mo
164+
*.pot
165+
166+
# Django stuff:
167+
*.log
168+
local_settings.py
169+
db.sqlite3
170+
db.sqlite3-journal
171+
172+
# Flask stuff:
173+
instance/
174+
.webassets-cache
175+
176+
# Scrapy stuff:
177+
.scrapy
178+
179+
# Sphinx documentation
180+
docs/_build/
181+
doc/_build/
182+
183+
# PyBuilder
184+
target/
185+
186+
# Jupyter Notebook
187+
.ipynb_checkpoints
188+
189+
# IPython
190+
profile_default/
191+
ipython_config.py
192+
193+
# pyenv
194+
.python-version
195+
196+
# pipenv
197+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
198+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
199+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
200+
# install all needed dependencies.
201+
#Pipfile.lock
202+
203+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
204+
__pypackages__/
205+
206+
# Celery stuff
207+
celerybeat-schedule
208+
celerybeat.pid
209+
210+
# SageMath parsed files
211+
*.sage.py
212+
213+
# Environments
214+
.env
215+
.venv
216+
env/
217+
venv/
218+
ENV/
219+
env.bak/
220+
venv.bak/
221+
pythonenv*
222+
223+
# Spyder project settings
224+
.spyderproject
225+
.spyproject
226+
227+
# Rope project settings
228+
.ropeproject
229+
230+
# mkdocs documentation
231+
/site
232+
233+
# mypy
234+
.mypy_cache/
235+
.dmypy.json
236+
dmypy.json
237+
238+
# Pyre type checker
239+
.pyre/
240+
241+
# pytype static type analyzer
242+
.pytype/
243+
244+
# profiling data
245+
.prof
246+
247+
# End of https://www.toptal.com/developers/gitignore/api/jetbrains,python

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
graft mrmat_python_api_flask/templates
2+
graft mrmat_python_api_flask/static
3+
global-exclude *.pyc

mrmat_python_api_flask/__init__.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2021 Mathieu Imfeld
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
23+
import os
24+
import pkg_resources
25+
26+
__version__ = pkg_resources.get_distribution('mrmat-python-api-flask').version
27+
__swagger__ = os.path.join(os.path.dirname(__file__), 'swagger')
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2021 Mathieu Imfeld
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
23+
from .healthz import bp as api_healthz
24+
from .greetingV1 import bp as api_greeting_v1
25+
from .greetingV2 import bp as api_greeting_v2
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2021 Mathieu Imfeld
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
23+
from flask import Blueprint
24+
25+
bp = Blueprint('greeting_v1', __name__)
26+
27+
28+
@bp.route('/', methods=['GET'])
29+
def get():
30+
return {'message': 'Hello World'}, 200
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2021 Mathieu Imfeld
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
23+
from flask import Blueprint, request
24+
25+
bp = Blueprint('greeting_v2', __name__)
26+
27+
28+
@bp.route('/', methods=['GET'])
29+
def get():
30+
name: str = request.args.get('name') or 'World'
31+
return {'message': f'Hello {name}'}, 200

0 commit comments

Comments
 (0)