skillfed

Flask-Pydantic

Flask extension for integration with Pydantic library.

flask-pydantic v0.14.0 635.6K downloads/30d#5,636 on PyPI434
Permissive license AGING released

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-pydantic

uv

uv add flask-pydantic

poetry

poetry add flask-pydantic

Installing 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

Environment :: Web EnvironmentFramework :: FlaskIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonTopic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Software Development :: Libraries :: Python Modules

Tags

flask request validationpydantic flask integrationvalidate flask parametersflask body validationflask query parameter validation
request-validationtype-checking

More Python Modules packages