Flask-Pydantic
Flask extension for integration with Pydantic library.
What it is and what it does
Flask-Pydantic is a Flask extension that bridges Flask request handling with Pydantic's validation framework. It provides a `@validate()` decorator that intercepts incoming HTTP requests, extracts parameters from query strings, request bodies, form data, and URL paths, validates them against Pydantic models, and makes the validated data available to your route handler either through function arguments or via Flask's request object.
The decorator automatically returns a 400 response with detailed validation errors if any parameter fails validation. It supports customizing success status codes, handling multiple models in responses or request bodies, and leverages Pydantic's alias feature for field name mapping. The package depends on Flask, Pydantic, and typing_extensions, making it a lightweight addition to existing Flask applications that already use Pydantic.
Use it for:
- Validate incoming JSON request bodies against Pydantic models before processing in POST/PUT endpoints
- Enforce type checking and required fields on query parameters without manual parsing or try-catch blocks
- Parse and validate URL path parameters (e.g., `/users/<user_id>`) as typed integers or other Pydantic-supported types
- Combine validation of query, body, and form data in a single route handler with clear type hints
- Automatically serialize Pydantic model instances back to JSON responses with optional field aliasing
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds Pydantic model validation to Flask route handlers, automatically parsing and validating query parameters, request bodies, form data, and URL path parameters.
Yes, with conditions. Install if you are building Flask applications that already use Pydantic and want to reduce boilerplate around request validation. The low install friction, permissive license, and backing from the Pallets Community Ecosystem make it a safe choice. However, note that maintenance is aging (235 days since last release); verify compatibility with your specific Flask and Pydantic versions before adopting.
Install
flask-pydantic on PyPI
pip
pip install flask-pydanticuv
uv add flask-pydanticpoetry
poetry add flask-pydanticInstalling Flask-Pydantic
Before you install
Low friction install with three straightforward runtime dependencies. Maintenance status is aging—last release was 235 days ago—but the repository remains active and part of the Pallets Community Ecosystem, which provides organizational backing for Flask extensions.
License in practice
Licensed under the MIT License (permissive), allowing free use, modification, and distribution with minimal restrictions.
Quickstart
pip install Flask-Pydantic
from flask import Flask
from pydantic import BaseModel
from flask_pydantic import validate
app = Flask(__name__)
class QueryModel(BaseModel):
age: int
@app.route('/', methods=['GET'])
@validate()
def get(query: QueryModel):
return {'age': query.age}
Requires Python 3.7 or later; Flask and Pydantic must be installed as runtime dependencies.
Verify before relying
- Whether the aging maintenance status (235 days since last release) affects compatibility with recent Flask or Pydantic versions
- Performance characteristics when validating large request payloads or complex nested models
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — Flask, pydantic, typing_extensions |
| Maintenance | aging — 235 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 635,560/month — #5,636 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: flask_pydantic-0.14.0-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
flask-pydantic-specAdds OpenAPI documentation generation and…
unclear · top 15,000 on PyPI
flask-openapi3Builds REST APIs on Flask with automatic…
permissive · top 15,000 on PyPI
pydantic-handlebarsRenders Handlebars templates for composing LLM…
permissive · top 5,000 on PyPI
APIFlaskAPIFlask is a lightweight web API framework…
permissive · top 15,000 on PyPI
drf-pydanticBridges pydantic models and Django REST…
permissive · top 15,000 on PyPI
pydantic-partialConverts pydantic models into partial variants…
permissive · top 15,000 on PyPI
bump-pydanticA CLI tool that automatically refactors…
permissive · top 15,000 on PyPI
pydantic_corepydantic-core provides the high-performance…
permissive · top 100 on PyPI
Flask-WTFFlask-WTF integrates WTForms with Flask to…
permissive · top 5,000 on PyPI
Flask-CachingFlask-Caching adds caching support to Flask…
permissive · top 5,000 on PyPI