Registry / type-stubs / types-smorest

types-smorest

JSON →
library1.1.2pypypi✓ verified 23d ago

types-smorest provides PEP 561 compatible type stubs for the `flask-smorest` library, a REST API framework built upon Flask and Marshmallow. It allows static type checkers like MyPy to perform type verification on `flask-smorest` applications, enhancing code quality and maintainability. The library is currently at version 1.1.2 and receives updates as needed to track `flask-smorest` features and fixes.

pip install types-smorest
INSTALL
IMPORT
SIG · TYPES-SMOREST
T
types-smorest
type-stubspythonv1.1.2
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Api
from flask_smorest_stubs import Api
from flask_smorest_stubs import Api

This quickstart demonstrates a basic `flask-smorest` application. Installing `types-smorest` alongside `flask-smorest` allows static type checkers like MyPy to analyze this code for type consistency. The stubs provide type information for `Api`, `Blueprint`, and other `flask-smorest` constructs, ensuring that method arguments, return types, and decorator usage are correctly typed according to `flask-smorest`'s API.

from flask import Flask from flask.views import MethodView from marshmallow import Schema, fields from flask_smorest import Api, Blueprint, abort app = Flask(__name__) app.config["API_TITLE"] = "My API" app.config["API_VERSION"] = "v1" app.config["OPENAPI_VERSION"] = "3.0.2" api = Api(app) class ItemSchema(Schema): id = fields.Int(dump_only=True) name = fields.String(required=True) price = fields.Float(required=True) blp = Blueprint("items", "items", url_prefix="/items", description="Operations on items") api.register_blueprint(blp) @blp.route("/") class Items(MethodView): @blp.response(200, ItemSchema(many=True)) def get(self) -> list[dict]: """List all items""" # In a real app, this would fetch from a database items = [{ "id": 1, "name": "Example Item", "price": 10.99 }] return items @blp.arguments(ItemSchema) @blp.response(201, ItemSchema) def post(self, new_item_data: dict) -> dict: """Create a new item""" # In a real app, this would save to a database new_item_data['id'] = len(self.get()) + 1 # Simulate ID generation return new_item_data # To run this example (requires flask-smorest, marshmallow): # 1. pip install Flask flask-smorest marshmallow # 2. Save as app.py # 3. export FLASK_APP=app.py # 4. flask run # # To use with type checking (requires types-smorest, mypy): # 1. pip install types-smorest mypy # 2. mypy app.py
Debug
Known issues
gotchaThis is a type stub package; it contains no runtime code. You should never import modules or symbols directly from `types_smorest` in your application's runtime code. Its sole purpose is to provide type hints for static analysis tools like MyPy.
fix
Always import symbols from the original library, `flask_smorest`, e.g., `from flask_smorest import Api`.
affects: All versions
gotcha`types-smorest` is a partial stub package. This means it may not cover every function, class, or object available in `flask-smorest`, leading to some `Any` types or incomplete type checking in certain scenarios.
fix
Consult the `types-smorest` GitHub repository for details on covered components. Contributions to expand stub coverage are welcome.
affects: All versions
gotchaCompatibility between `types-smorest` and `flask-smorest` versions is crucial. Breaking changes in `flask-smorest` might not be immediately reflected in `types-smorest`, potentially leading to incorrect type hints or errors during static analysis. `types-smorest` v1.1.2 was released in Dec 2022, while `flask-smorest` has continued to release updates, including v0.47.0 in March 2026.
fix
Ensure that the `types-smorest` version is compatible with your `flask-smorest` version. Check the `types-smorest` GitHub releases and issue tracker for specific compatibility notes. Consider pinning both `flask-smorest` and `types-smorest` versions in your project's dependencies.
affects: All versions, especially when using newer `flask-smorest` versions with older `types-smorest`
Upgrade
Version history
1.1.2latest on PyPI · released Dec 13, 2022
Audit
Dependencies
flask-smorestrequiredThis package provides type stubs for `flask-smorest`. It is not a runtime dependency, but a dependency for static type checking (e.g., with MyPy).
Agent activity
32 hits · last 30 days
node
28
OpenAI (training)
1
Resources
types-smorest — pip install types-smorest · libregistry