Flask-OpenAPI3-Scalar

raw JSON →
1.44.15 verified Fri May 01 auth: no python

Provides Scalar UI integration for flask-openapi3, allowing OpenAPI documentation to be rendered with Scalar's modern UI. Current version: 1.44.15. Release cadence: frequent updates.

pip install flask-openapi3-scalar
error ModuleNotFoundError: No module named 'flask_openapi3_scalar'
cause The package is not installed or installed incorrectly.
fix
Run 'pip install flask-openapi3-scalar' and ensure you use underscores in import.
error AttributeError: module 'flask_openapi3' has no attribute 'ScalarUI'
cause Importing ScalarUI from flask_openapi3 instead of flask_openapi3_scalar.
fix
Change import to 'from flask_openapi3_scalar import ScalarUI'.
error TypeError: ScalarUI() missing 1 required positional argument: 'spec'
cause The 'spec' argument is required but not provided.
fix
Pass the OpenAPI spec object: spec = api.get_spec(); ScalarUI(spec, ...).
breaking The package was originally named 'flask-openapi3-scalar' but the import path may change. Ensure you use the correct module name 'flask_openapi3_scalar' (underscores).
fix Use 'from flask_openapi3_scalar import ScalarUI' instead of hyphens.
gotcha The OpenAPI spec must be passed to ScalarUI. If you don't pass the spec, it may fail silently or show an empty UI.
fix Always pass the spec object: ScalarUI(spec, ...) where spec is obtained from api.get_spec().
deprecated The 'url_prefix' parameter may be renamed or deprecated in future versions. Check changelog.
fix Use the current parameter name as per documentation; if deprecated, use the new name.

Quickstart: create a Flask app with OpenAPI and register ScalarUI to serve interactive documentation at /scalar.

from flask import Flask
from flask_openapi3 import OpenAPI
from flask_openapi3_scalar import ScalarUI

app = Flask(__name__)
api = OpenAPI(app)
spec = api.get_spec()
ScalarUI(spec, url_prefix='/scalar').register(app)

@app.route('/')
def home():
    return 'Hello, World!'

if __name__ == '__main__':
    app.run()