$npx skillfedfor your agent

pydantic-compat

Compatibility layer for pydantic v1/v2

With conditionsPyPI Application FrameworksReleased Oct 202380.3K downloads / moBSD 3-Clause LicensePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pydantic_compat-0.1.2-py3-none-any.whl
v0.1.2 · released 2023-10-24 · Python >=3.7 · 2 runtime deps: importlib-metadata, pydantic

Yes, if you are a library author needing to support both pydantic v1 and v2 in the same codebase. The low install friction and active maintenance make it a practical choice. However, be aware that this is a name adapter, not a full semantic bridge—you will still need to test against both pydantic versions and handle any deeper API differences yourself. Not necessary if you can pin pydantic to a single version.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low install friction with only two runtime dependencies (importlib-metadata and pydantic).
  • Actively maintained as of 2026-08-03, though the last release was in 2023-10-24.

License · maintenance · safety

BSD 3-Clause License (permissive) — BSD 3-Clause License (permissive) allows use in most commercial and open-source projects without significant restrictions.

last release 2023-10-24 (1025 days) · last repo commit 2026-08-03 · 13 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 80,268 downloads/mo, #14,301 on PyPI

Verify before relying

from pydantic import BaseModel
from pydantic_compat import PydanticCompatMixin, field_validator

class MyModel(PydanticCompatMixin, BaseModel):
    x: int
    @field_validator('x', mode='after')
    def check_x(cls, v):
        return v

obj = MyModel(x=42)
data = obj.model_dump()  # works in both v1 and v2
  • Whether the package's API coverage is sufficient for your specific pydantic usage patterns beyond the documented examples
  • How well custom type handling works across both pydantic versions when using this adapter
Same gist for agents: .md · .json

What it is and what it does

pydantic-compat is a compatibility layer that lets you write pydantic models using either v1 or v2 API names while supporting both pydantic versions in a single codebase. It works by providing a mixin class and adapter functions that translate between the two APIs—for example, mapping `obj.dict()` to `obj.model_dump()` or vice versa depending on which pydantic version is installed. This eliminates the need for version-specific conditionals and boilerplate throughout your library code.

The package is not a full semantic bridge: it translates names and provides basic compatibility for common operations like validation, serialization, and schema access, but does not attempt to hide deeper behavioral differences between v1 and v2. You still need to test your code against both pydantic versions and understand what's changing under the hood. It's designed for library authors who want to support a range of pydantic versions without forcing users to pin a specific version.

Use it for

  • Library author supporting both pydantic v1 and v2 without version pinning or deprecation warnings
  • Migrating a codebase from pydantic v1 to v2 incrementally while maintaining compatibility
  • Defining models that work seamlessly when users have either pydantic version installed
  • Reducing conditional version-checking code in model definitions and validation logic

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you are a library author needing to support both pydantic v1 and v2 in the same codebase.

The low install friction and active maintenance make it a practical choice. However, be aware that this is a name adapter, not a full semantic bridge—you will still need to test against both pydantic versions and handle any deeper API differences yourself. Not necessary if you can pin pydantic to a single version.

Install

pydantic-compat on PyPI

Before you install

Low install friction with only two runtime dependencies (importlib-metadata and pydantic). Actively maintained as of 2026-08-03, though the last release was in 2023-10-24.

License in practice

BSD 3-Clause License (permissive) allows use in most commercial and open-source projects without significant restrictions.

Quickstart

from pydantic import BaseModel
from pydantic_compat import PydanticCompatMixin, field_validator

class MyModel(PydanticCompatMixin, BaseModel):
    x: int
    @field_validator('x', mode='after')
    def check_x(cls, v):
        return v

obj = MyModel(x=42)
data = obj.model_dump()  # works in both v1 and v2

Verify before relying

  • Whether the package's API coverage is sufficient for your specific pydantic usage patterns beyond the documented examples
  • How well custom type handling works across both pydantic versions when using this adapter

Package facts

LicenseBSD 3-Clause License permissive
Python supportSupports the current Python release >=3.7
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
importlib-metadatapydantic
MaintenanceActively maintained 1,025 days since the last release
Last repo commit
First released
Downloads80,268 / month, #14,301 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 3 - AlphaFramework :: PydanticLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Typing :: Typed

Evidence: pydantic_compat-0.1.2-py3-none-any.whl

Tags

Capabilities
pydantic v1 v2 compatibilitypydantic version adaptercross-version pydantic supportpydantic api translationpydantic migration helperunified pydantic interfacepydantic compatibility layer
Topics
pydanticcompatibility-layerversion-bridge

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “pydantic v1 v2 compatibility”

  • pydantic-compatProvides compatibility mixins and adapters to use either pydantic v1…
  • bump-pydanticA CLI tool that automatically refactors Pydantic V1 code to V2 by…
  • django-pydantic-fieldProvides type-safe Pydantic model schemas for Django JSONFields with…

Give your agent the search over MCP, or paste the wish link into any chat.

More Application Frameworks packages

fastapi Worth it
PyPI · Software Development · released Jul 2026

FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.

MITpure Python · 3.10+
568.6Mdownloads / mo
annotated-doc With conditions
PyPI · Software Development · released Jul 2026

Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.

MITpure Python · 3.9+
456.2Mdownloads / mo
textual Worth it
PyPI · Application Frameworks · released Jun 2026

Textual is a Python framework for building cross-platform user interfaces that run in the terminal or web browser using a modern, component-based API.

Install it if you're developing CLI tools, dashboards, or interactive terminal applications.

MITpure Python
443.6Mdownloads / mo
typer Worth it
PyPI · Software Development · released Aug 2026

Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.

Install it if you are building CLIs in Python.

MITpure Python · 3.10+
369.3Mdownloads / mo
mcp Worth it
PyPI · Application Frameworks · released Jul 2026

Build and connect to Model Context Protocol servers that expose tools, resources, and prompts to LLM applications over stdio, HTTP, or SSE transports.

Install it if you need to build or connect to servers.

MITpure Python · 3.10+
319.3Mdownloads / mo
Werkzeug Worth it
PyPI · Application Frameworks · released Apr 2026

Werkzeug is a WSGI utility library providing request/response objects, URL routing, an interactive debugger, HTTP utilities, and a development server for building web applications.

BSD-3-Clausepure Python · 3.9+
268.1Mdownloads / mo

See also bump-pydantic · prime-pydantic-config · pydantic-function-models · django-pydantic-field · pylint-pydantic · pydantic-to-typescript2 · pydantic-extra-types · drf-pydantic · pydantic_yaml · json-schema-to-pydantic