{"categories":[{"label":"Application Frameworks","url":"https://skillfed.io/packages/category/software-development-libraries-application-frameworks/6"}],"enrichment":{"capability":"Provides compatibility mixins and adapters to use either pydantic v1 or v2 API names in a single codebase, regardless of which pydantic version is installed.","skillfed_tags":["pydantic","compatibility-layer","version-bridge"],"use_cases":["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"],"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\u2014for 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.\n\nThe 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.","worth_installing":"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\u2014you 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."},"id":"pydantic-compat","links":{"html":"https://skillfed.io/packages/pydantic-compat","md":"https://skillfed.io/packages/pydantic-compat.md","pypi":"https://pypi.org/project/pydantic-compat/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2023-10-24","license_spdx":null,"license_treatment":"permissive","name":"pydantic-compat","python_support":"supports_current","summary":"Compatibility layer for pydantic v1/v2"},"popularity":{"monthly_downloads":80268,"position":14301,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"0.1.2"}
