fastapi_swagger2 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. fastapi_swagger2-0.0.1/.gitignore +163 -0
  2. fastapi_swagger2-0.0.1/.ruff_cache/.gitignore +1 -0
  3. fastapi_swagger2-0.0.1/.ruff_cache/.update-informer +1 -0
  4. fastapi_swagger2-0.0.1/.ruff_cache/CACHEDIR.TAG +1 -0
  5. fastapi_swagger2-0.0.1/.ruff_cache/content/10fbfe993ec4be0d +0 -0
  6. fastapi_swagger2-0.0.1/.ruff_cache/content/1a84b0002c6f63c3 +0 -0
  7. fastapi_swagger2-0.0.1/.ruff_cache/content/1abeadf52d9572ab +0 -0
  8. fastapi_swagger2-0.0.1/.ruff_cache/content/26e89fbd03286482 +0 -0
  9. fastapi_swagger2-0.0.1/.ruff_cache/content/2d87409254dbc080 +0 -0
  10. fastapi_swagger2-0.0.1/.ruff_cache/content/3bf02553ad62c3bf +0 -0
  11. fastapi_swagger2-0.0.1/.ruff_cache/content/6d5e270589f4c84f +0 -0
  12. fastapi_swagger2-0.0.1/.ruff_cache/content/8cf332caaea8e79b +0 -0
  13. fastapi_swagger2-0.0.1/.ruff_cache/content/91433f946dd52c35 +0 -0
  14. fastapi_swagger2-0.0.1/.ruff_cache/content/a8a883be09c5919b +0 -0
  15. fastapi_swagger2-0.0.1/.ruff_cache/content/c180a20ea5e70786 +0 -0
  16. fastapi_swagger2-0.0.1/.ruff_cache/content/f16744491f37c6f5 +0 -0
  17. fastapi_swagger2-0.0.1/.ruff_cache/content/f885759af04f4f9e +0 -0
  18. fastapi_swagger2-0.0.1/.ruff_cache/content/fbcf51701267e364 +0 -0
  19. fastapi_swagger2-0.0.1/LICENSE +21 -0
  20. fastapi_swagger2-0.0.1/PKG-INFO +138 -0
  21. fastapi_swagger2-0.0.1/README.md +69 -0
  22. fastapi_swagger2-0.0.1/pyproject.toml +95 -0
  23. fastapi_swagger2-0.0.1/requirements-dev.txt +1 -0
  24. fastapi_swagger2-0.0.1/requirements.txt +1 -0
  25. fastapi_swagger2-0.0.1/scripts/build.sh +3 -0
  26. fastapi_swagger2-0.0.1/scripts/clean.sh +8 -0
  27. fastapi_swagger2-0.0.1/scripts/format.sh +6 -0
  28. fastapi_swagger2-0.0.1/scripts/lint.sh +9 -0
  29. fastapi_swagger2-0.0.1/scripts/publish.sh +5 -0
  30. fastapi_swagger2-0.0.1/scripts/test.sh +9 -0
  31. fastapi_swagger2-0.0.1/src/fastapi_swagger2/__init__.py +145 -0
  32. fastapi_swagger2-0.0.1/src/fastapi_swagger2/constants.py +1 -0
  33. fastapi_swagger2-0.0.1/src/fastapi_swagger2/models.py +353 -0
  34. fastapi_swagger2-0.0.1/src/fastapi_swagger2/utils.py +456 -0
@@ -0,0 +1,163 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
148
+
149
+ # pytype static type analyzer
150
+ .pytype/
151
+
152
+ # Cython debug symbols
153
+ cython_debug/
154
+
155
+ # PyCharm
156
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
159
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
+ #.idea/
161
+
162
+
163
+ .DS_Store
@@ -0,0 +1 @@
1
+ *
@@ -0,0 +1 @@
1
+ v0.0.272
@@ -0,0 +1 @@
1
+ Signature: 8a477f597d28d172789f06886806bc55
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Viraj Kanwade
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.
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.1
2
+ Name: fastapi_swagger2
3
+ Version: 0.0.1
4
+ Summary: Swagger2 support for FastAPI framework
5
+ Project-URL: Homepage, https://github.com/virajkanwade/fastapi_swagger2
6
+ Project-URL: Documentation, https://github.com/virajkanwade/fastapi_swagger2
7
+ Author-email: Viraj Kanwade <virajk.oib@gmail.com>
8
+ License: MIT License
9
+
10
+ Copyright (c) 2023 Viraj Kanwade
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+ License-File: LICENSE
30
+ Classifier: Environment :: Web Environment
31
+ Classifier: Framework :: AsyncIO
32
+ Classifier: Framework :: FastAPI
33
+ Classifier: Framework :: Pydantic
34
+ Classifier: Framework :: Pydantic :: 1
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: Intended Audience :: Information Technology
37
+ Classifier: Intended Audience :: System Administrators
38
+ Classifier: License :: OSI Approved :: MIT License
39
+ Classifier: Operating System :: OS Independent
40
+ Classifier: Programming Language :: Python
41
+ Classifier: Programming Language :: Python :: 3
42
+ Classifier: Programming Language :: Python :: 3 :: Only
43
+ Classifier: Programming Language :: Python :: 3.8
44
+ Classifier: Programming Language :: Python :: 3.9
45
+ Classifier: Programming Language :: Python :: 3.10
46
+ Classifier: Programming Language :: Python :: 3.11
47
+ Classifier: Topic :: Internet
48
+ Classifier: Topic :: Internet :: WWW/HTTP
49
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
50
+ Classifier: Topic :: Software Development
51
+ Classifier: Topic :: Software Development :: Libraries
52
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
53
+ Classifier: Typing :: Typed
54
+ Requires-Python: >=3.8
55
+ Requires-Dist: fastapi>=0.79.0
56
+ Provides-Extra: all
57
+ Requires-Dist: httpx>=0.23.0; extra == 'all'
58
+ Provides-Extra: dev
59
+ Requires-Dist: ruff==0.0.272; extra == 'dev'
60
+ Provides-Extra: test
61
+ Requires-Dist: black==23.3.0; extra == 'test'
62
+ Requires-Dist: coverage[toml]<8.0,>=6.5.0; extra == 'test'
63
+ Requires-Dist: httpx<0.24.0,>=0.23.0; extra == 'test'
64
+ Requires-Dist: isort<6.0.0,>=5.0.6; extra == 'test'
65
+ Requires-Dist: mypy==1.3.0; extra == 'test'
66
+ Requires-Dist: pytest<8.0.0,>=7.1.3; extra == 'test'
67
+ Requires-Dist: ruff==0.0.272; extra == 'test'
68
+ Description-Content-Type: text/markdown
69
+
70
+ # fastapi_swagger2
71
+ <p align="center">
72
+ Swagger2 support for FastAPI
73
+ </p>
74
+ <p align="center">
75
+ <a href="https://pypi.org/project/fastapi_swagger2" target="_blank">
76
+ <img src="https://img.shields.io/pypi/v/fastapi_swagger2?color=%2334D058&label=pypi%20package" alt="Package version">
77
+ </a>
78
+ <a href="https://pypi.org/project/fastapi_swagger2" target="_blank">
79
+ <img src="https://img.shields.io/pypi/pyversions/fastapi_swagger2.svg?color=%2334D058" alt="Supported Python versions">
80
+ </a>
81
+ </p>
82
+
83
+ ---
84
+
85
+ _Reason behind this library:_
86
+
87
+ Few API GW services like Google Cloud API GW still support only Swagger 2.0 spec. Since FastAPI only supports OAS3, it is a challenge. Converting from OAS3 to Swagger 2.0 requires some manual steps which would hinder CI/CD.
88
+
89
+ ---
90
+
91
+ ## Requirements
92
+
93
+ Python 3.8+
94
+
95
+ FastAPI 0.79.0+
96
+
97
+ ## Installation
98
+
99
+ <div class="termy">
100
+
101
+ ```console
102
+ $ pip install fastapi_swagger2
103
+ ```
104
+
105
+ </div>
106
+
107
+ ## Example
108
+
109
+ ```Python
110
+ from typing import Union
111
+
112
+ from fastapi import FastAPI
113
+ from fastapi_swagger2 import FastAPISwagger2
114
+
115
+ app = FastAPI()
116
+ FastAPISwagger2(app)
117
+
118
+
119
+ @app.get("/")
120
+ def read_root():
121
+ return {"Hello": "World"}
122
+
123
+
124
+ @app.get("/items/{item_id}")
125
+ def read_item(item_id: int, q: Union[str, None] = None):
126
+ return {"item_id": item_id, "q": q}
127
+ ```
128
+
129
+ This adds following endpoints:
130
+ * http://localhost:8000/swagger2.json
131
+ * http://localhost:8000/swagger2/docs
132
+ * http://localhost:8000/swagger2/redoc
133
+
134
+ ## Development
135
+
136
+ ```console
137
+ $ pip install "/path/to/fastapi_swagger2/repo[test,all]"
138
+ ```
@@ -0,0 +1,69 @@
1
+ # fastapi_swagger2
2
+ <p align="center">
3
+ Swagger2 support for FastAPI
4
+ </p>
5
+ <p align="center">
6
+ <a href="https://pypi.org/project/fastapi_swagger2" target="_blank">
7
+ <img src="https://img.shields.io/pypi/v/fastapi_swagger2?color=%2334D058&label=pypi%20package" alt="Package version">
8
+ </a>
9
+ <a href="https://pypi.org/project/fastapi_swagger2" target="_blank">
10
+ <img src="https://img.shields.io/pypi/pyversions/fastapi_swagger2.svg?color=%2334D058" alt="Supported Python versions">
11
+ </a>
12
+ </p>
13
+
14
+ ---
15
+
16
+ _Reason behind this library:_
17
+
18
+ Few API GW services like Google Cloud API GW still support only Swagger 2.0 spec. Since FastAPI only supports OAS3, it is a challenge. Converting from OAS3 to Swagger 2.0 requires some manual steps which would hinder CI/CD.
19
+
20
+ ---
21
+
22
+ ## Requirements
23
+
24
+ Python 3.8+
25
+
26
+ FastAPI 0.79.0+
27
+
28
+ ## Installation
29
+
30
+ <div class="termy">
31
+
32
+ ```console
33
+ $ pip install fastapi_swagger2
34
+ ```
35
+
36
+ </div>
37
+
38
+ ## Example
39
+
40
+ ```Python
41
+ from typing import Union
42
+
43
+ from fastapi import FastAPI
44
+ from fastapi_swagger2 import FastAPISwagger2
45
+
46
+ app = FastAPI()
47
+ FastAPISwagger2(app)
48
+
49
+
50
+ @app.get("/")
51
+ def read_root():
52
+ return {"Hello": "World"}
53
+
54
+
55
+ @app.get("/items/{item_id}")
56
+ def read_item(item_id: int, q: Union[str, None] = None):
57
+ return {"item_id": item_id, "q": q}
58
+ ```
59
+
60
+ This adds following endpoints:
61
+ * http://localhost:8000/swagger2.json
62
+ * http://localhost:8000/swagger2/docs
63
+ * http://localhost:8000/swagger2/redoc
64
+
65
+ ## Development
66
+
67
+ ```console
68
+ $ pip install "/path/to/fastapi_swagger2/repo[test,all]"
69
+ ```
@@ -0,0 +1,95 @@
1
+ [build-system]
2
+ requires = ["hatchling", "flit_core >=3.2,<4"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "fastapi_swagger2"
7
+ description = "Swagger2 support for FastAPI framework"
8
+ readme = "README.md"
9
+ requires-python = ">=3.8"
10
+ license = { file="LICENSE" }
11
+ authors = [
12
+ { name = "Viraj Kanwade", email = "virajk.oib@gmail.com" },
13
+ ]
14
+ classifiers = [
15
+ "Intended Audience :: Information Technology",
16
+ "Intended Audience :: System Administrators",
17
+ "Operating System :: OS Independent",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python",
20
+ "Topic :: Internet",
21
+ "Topic :: Software Development :: Libraries :: Python Modules",
22
+ "Topic :: Software Development :: Libraries",
23
+ "Topic :: Software Development",
24
+ "Typing :: Typed",
25
+ "Environment :: Web Environment",
26
+ "Framework :: AsyncIO",
27
+ "Framework :: FastAPI",
28
+ "Framework :: Pydantic",
29
+ "Framework :: Pydantic :: 1",
30
+ "Intended Audience :: Developers",
31
+ "License :: OSI Approved :: MIT License",
32
+ "Programming Language :: Python :: 3 :: Only",
33
+ "Programming Language :: Python :: 3.8",
34
+ "Programming Language :: Python :: 3.9",
35
+ "Programming Language :: Python :: 3.10",
36
+ "Programming Language :: Python :: 3.11",
37
+ "Topic :: Internet :: WWW/HTTP :: HTTP Servers",
38
+ "Topic :: Internet :: WWW/HTTP",
39
+ ]
40
+ dependencies = [
41
+ "fastapi>=0.79.0",
42
+ ]
43
+ dynamic = ["version"]
44
+
45
+ [project.urls]
46
+ Homepage = "https://github.com/virajkanwade/fastapi_swagger2"
47
+ Documentation = "https://github.com/virajkanwade/fastapi_swagger2"
48
+
49
+ [project.optional-dependencies]
50
+ test = [
51
+ "pytest >=7.1.3,<8.0.0",
52
+ "coverage[toml] >= 6.5.0,< 8.0",
53
+ "mypy ==1.3.0",
54
+ "ruff ==0.0.272",
55
+ "black == 23.3.0",
56
+ "isort >=5.0.6,<6.0.0",
57
+ "httpx >=0.23.0,<0.24.0",
58
+ ]
59
+ dev = [
60
+ "ruff ==0.0.272",
61
+ ]
62
+ all = [
63
+ "httpx >=0.23.0",
64
+ ]
65
+
66
+ [tool.hatch.version]
67
+ path = "src/fastapi_swagger2/__init__.py"
68
+
69
+ [tool.isort]
70
+ profile = "black"
71
+ known_third_party = ["fastapi", "pydantic", "starlette"]
72
+
73
+ [tool.mypy]
74
+ strict = true
75
+
76
+ [tool.ruff]
77
+ select = [
78
+ "E", # pycodestyle errors
79
+ "W", # pycodestyle warnings
80
+ "F", # pyflakes
81
+ # "I", # isort
82
+ "C", # flake8-comprehensions
83
+ "B", # flake8-bugbear
84
+ ]
85
+ ignore = [
86
+ "E501", # line too long, handled by black
87
+ "B008", # do not perform function calls in argument defaults
88
+ "C901", # too complex
89
+ ]
90
+
91
+ [tool.ruff.per-file-ignores]
92
+ "__init__.py" = ["F401"]
93
+
94
+ [tool.ruff.isort]
95
+ known-third-party = ["fastapi", "pydantic", "starlette"]
@@ -0,0 +1 @@
1
+ -e .[dev,test,all]
@@ -0,0 +1 @@
1
+ -e .[all]
@@ -0,0 +1,3 @@
1
+ #!/bin/sh -e
2
+
3
+ hatchling build
@@ -0,0 +1,8 @@
1
+ #!/bin/sh -e
2
+
3
+ if [ -d 'dist' ] ; then
4
+ rm -r dist
5
+ fi
6
+ if [ -d 'site' ] ; then
7
+ rm -r site
8
+ fi
@@ -0,0 +1,6 @@
1
+ #!/bin/sh -e
2
+ set -x
3
+
4
+ ruff src/fastapi_swagger2 tests scripts --fix
5
+ black src/fastapi_swagger2 tests scripts
6
+ isort src/fastapi_swagger2 tests scripts
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+ set -x
5
+
6
+ mypy src/fastapi_swagger2
7
+ ruff src/fastapi_swagger2 tests scripts
8
+ black src/fastapi_swagger2 tests --check
9
+ isort src/fastapi_swagger2 tests scripts --check-only
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ hatch publish
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+ set -x
5
+
6
+ # # Check README.md is up to date
7
+ # python ./scripts/docs.py verify-readme
8
+ # export PYTHONPATH=./docs_src
9
+ coverage run -m pytest tests ${@}