flask-openapi-scalar 1.43.8__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.
- flask_openapi_scalar-1.43.8/.gitignore +141 -0
- flask_openapi_scalar-1.43.8/PKG-INFO +22 -0
- flask_openapi_scalar-1.43.8/flask_openapi_scalar/__init__.py +3 -0
- flask_openapi_scalar-1.43.8/flask_openapi_scalar/__version__.py +3 -0
- flask_openapi_scalar-1.43.8/flask_openapi_scalar/plugins.py +38 -0
- flask_openapi_scalar-1.43.8/flask_openapi_scalar/templates/__init__.py +29 -0
- flask_openapi_scalar-1.43.8/flask_openapi_scalar/templates/scalar/images/scalar.svg +4 -0
- flask_openapi_scalar-1.43.8/flask_openapi_scalar/templates/scalar/js/scalar.standalone.js +8 -0
- flask_openapi_scalar-1.43.8/pyproject.toml +51 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
### Python template
|
|
2
|
+
# Byte-compiled / optimized / DLL files
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*$py.class
|
|
6
|
+
|
|
7
|
+
# C extensions
|
|
8
|
+
*.so
|
|
9
|
+
|
|
10
|
+
# Distribution / packaging
|
|
11
|
+
.Python
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
99
|
+
__pypackages__/
|
|
100
|
+
|
|
101
|
+
# Celery stuff
|
|
102
|
+
celerybeat-schedule
|
|
103
|
+
celerybeat.pid
|
|
104
|
+
|
|
105
|
+
# SageMath parsed files
|
|
106
|
+
*.sage.py
|
|
107
|
+
|
|
108
|
+
# Environments
|
|
109
|
+
.env
|
|
110
|
+
.venv
|
|
111
|
+
env/
|
|
112
|
+
venv/
|
|
113
|
+
ENV/
|
|
114
|
+
env.bak/
|
|
115
|
+
venv.bak/
|
|
116
|
+
|
|
117
|
+
# Spyder project settings
|
|
118
|
+
.spyderproject
|
|
119
|
+
.spyproject
|
|
120
|
+
|
|
121
|
+
# Rope project settings
|
|
122
|
+
.ropeproject
|
|
123
|
+
|
|
124
|
+
# mkdocs documentation
|
|
125
|
+
/site
|
|
126
|
+
|
|
127
|
+
# mypy
|
|
128
|
+
.mypy_cache/
|
|
129
|
+
.dmypy.json
|
|
130
|
+
dmypy.json
|
|
131
|
+
|
|
132
|
+
# Pyre type checker
|
|
133
|
+
.pyre/
|
|
134
|
+
|
|
135
|
+
# pytype static type analyzer
|
|
136
|
+
.pytype/
|
|
137
|
+
|
|
138
|
+
# Cython debug symbols
|
|
139
|
+
cython_debug/
|
|
140
|
+
|
|
141
|
+
.idea
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flask-openapi-scalar
|
|
3
|
+
Version: 1.43.8
|
|
4
|
+
Summary: Provide Scalar UI for flask-openapi.
|
|
5
|
+
Project-URL: Homepage, https://github.com/luolingchun/flask-openapi-plugins/tree/master/flask-openapi-scalar
|
|
6
|
+
Project-URL: Documentation, https://luolingchun.github.io/flask-openapi/latest/Usage/UI_Templates/
|
|
7
|
+
Maintainer-email: llc <luolingchun@outlook.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Environment :: Web Environment
|
|
11
|
+
Classifier: Framework :: Flask
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Requires-Python: >=3.8
|
|
19
|
+
Requires-Dist: flask-openapi
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
Provide Scalar UI for [flask-openapi](https://github.com/luolingchun/flask-openapi).
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# @Author : llc
|
|
3
|
+
# @Time : 2024/4/22 16:13
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
from flask import Blueprint, render_template_string, current_app
|
|
7
|
+
from flask_openapi.plugins import BasePlugin
|
|
8
|
+
|
|
9
|
+
from .templates import scalar_html_string
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class RegisterPlugin(BasePlugin):
|
|
13
|
+
name = "scalar"
|
|
14
|
+
display_name = "Scalar"
|
|
15
|
+
|
|
16
|
+
@classmethod
|
|
17
|
+
def register(cls, doc_url: str) -> Blueprint:
|
|
18
|
+
_here = os.path.dirname(__file__)
|
|
19
|
+
template_folder = os.path.join(_here, "templates")
|
|
20
|
+
static_folder = os.path.join(template_folder, cls.name)
|
|
21
|
+
blueprint = Blueprint(
|
|
22
|
+
cls.name,
|
|
23
|
+
__name__,
|
|
24
|
+
template_folder=template_folder,
|
|
25
|
+
static_folder=static_folder
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
blueprint.add_url_rule(
|
|
29
|
+
rule=f"/{cls.name}",
|
|
30
|
+
endpoint=cls.name,
|
|
31
|
+
view_func=lambda: render_template_string(
|
|
32
|
+
current_app.config.get("SCALAR_HTML_STRING") or scalar_html_string,
|
|
33
|
+
doc_url=doc_url,
|
|
34
|
+
scalar_config=current_app.config.get("SCALAR_CONFIG")
|
|
35
|
+
)
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
return blueprint
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# @Author : llc
|
|
3
|
+
# @Time : 2024/4/23 14:46
|
|
4
|
+
scalar_html_string = """
|
|
5
|
+
<!doctype html>
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<title>Scalar API</title>
|
|
9
|
+
<meta charset="utf-8" />
|
|
10
|
+
<meta
|
|
11
|
+
name="viewport"
|
|
12
|
+
content="width=device-width, initial-scale=1" />
|
|
13
|
+
<link rel="shortcut icon" href="scalar/images/scalar.svg">
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<script
|
|
17
|
+
id="api-reference"
|
|
18
|
+
data-url="{{ doc_url }}">
|
|
19
|
+
</script>
|
|
20
|
+
<script>
|
|
21
|
+
const scalar_config = JSON.parse(`{{ scalar_config|default('{}')|tojson }}`);
|
|
22
|
+
var configuration = {...scalar_config};
|
|
23
|
+
var apiReference = document.getElementById('api-reference');
|
|
24
|
+
apiReference.dataset.configuration = JSON.stringify(configuration);
|
|
25
|
+
</script>
|
|
26
|
+
<script src="scalar/js/scalar.standalone.js"></script>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
29
|
+
"""
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 593 593">
|
|
2
|
+
<path fill="black" fill-rule="evenodd"
|
|
3
|
+
d="M347 0c6 0 12 5 12 12v134l94-95c5-5 13-5 17 0l72 72c4 4 5 12 0 16v1l-95 94h134c7 0 12 5 12 12v101c0 7-5 12-12 12H447l95 94c4 5 5 13 0 17l-72 72c-4 4-12 5-16 0h-1l-94-95v134c0 7-5 12-12 12H246c-7 0-12-5-12-12v-70c0-22 9-43 24-59l130-130c14-14 14-37 0-51L259 142a84 84 0 0 1-25-59V12c0-7 5-12 12-12h101ZM138 52h1l219 219c14 14 14 37 0 51L139 542c-4 5-12 5-17 0l-71-70c-4-5-5-12 0-17l95-96H12c-7 0-12-5-12-12V246c0-7 5-12 12-12h134l-95-94c-4-5-4-12 0-17l71-71c4-5 12-5 16 0Z" />
|
|
4
|
+
</svg>
|