pydantic-collections
Collections of pydantic models
What it is and what it does
pydantic-collections wraps a list of pydantic models in a `BaseCollectionModel` class that applies validation, serialization, and type checking to the entire collection. It acts as a container that enforces that all items conform to a specified pydantic model schema, supporting both strict and lenient assignment modes. The class inherits from pydantic's `BaseModel`, so collections can be nested as fields in other models and serialized to JSON or dictionaries using pydantic's standard methods.
The package is designed for workflows where you need to load, validate, and serialize batches of structured data—such as API responses containing arrays of objects, CSV imports, or database result sets. It reduces boilerplate by letting you define a collection type once and reuse it across your codebase. However, the repository is archived and abandoned, with no active maintenance since mid-2026, which may pose a risk if you rely on future compatibility with newer pydantic versions or need bug fixes.
Use it for:
- Validate and type-check a list of API response objects before processing them in your application.
- Wrap CSV or JSON imports in a collection model to ensure all records conform to a schema before persisting.
- Nest a collection of models as a field in a parent pydantic model for hierarchical data validation.
- Serialize a batch of model instances to JSON with automatic datetime and custom type handling.
- Enforce strict type safety when appending items to a collection to catch invalid assignments early.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a `BaseCollectionModel` class that wraps collections of pydantic models with validation, serialization, and type safety.
Yes, if you are using pydantic v1.x or early v2.x and need a lightweight, low-friction way to validate and serialize collections of models. No, if you require active maintenance or plan to upgrade pydantic significantly in the near future—the package is archived and abandoned, with no recent updates. Consider whether pydantic's native list validation (e.g., `list[MyModel]`) or a simple wrapper function meets your needs instead.
Install
pydantic-collections on PyPI
pip
pip install pydantic-collectionsuv
uv add pydantic-collectionspoetry
poetry add pydantic-collectionsInstalling pydantic-collections
Before you install
Low install friction with only two runtime dependencies (pydantic and typing-extensions). However, the repository is archived and marked abandoned as of the fact sheet date, with no commits since 2026-08-05 and the last release over 2 years old.
License in practice
Licensed under Apache 2, a permissive open-source license that allows commercial and private use with minimal restrictions.
Quickstart
pip install pydantic-collections
from pydantic import BaseModel
from pydantic_collections import BaseCollectionModel
class User(BaseModel):
id: int
name: str
class UserCollection(BaseCollectionModel[User]):
pass
users = UserCollection([{'id': 1, 'name': 'Alice'}])
print(users.model_dump_json())
Requires pydantic>=1.8.2,<3.0 and Python>=3.7; behavior differs between pydantic v1.x and v2.x (dict() vs model_dump(), json() vs model_dump_json()).
Verify before relying
- Whether the package works reliably with pydantic 2.x given the archived status and age of last release.
- Whether strict assignment validation (the default) is the right choice for most use cases or if it causes friction.
- Current community adoption and whether alternatives have emerged since abandonment.
Package facts
| License | Apache 2 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — pydantic, typing-extensions |
| Maintenance | abandoned — 766 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 552,306/month — #6,043 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pydantic_collections-0.6.0-py3-none-any.whl
Keywords: python, pydantic, validation, parsing, serialization, models
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
pydantic-numpyIntegrates NumPy arrays into Pydantic models…
permissive · top 15,000 on PyPI
pydantic-factoriesGenerates mock data objects that conform to…
permissive · top 15,000 on PyPI
pydantic_yamlPydantic-YAML adds YAML serialization and…
permissive · top 5,000 on PyPI
drf-pydanticBridges pydantic models and Django REST…
permissive · top 15,000 on PyPI
pydantic-mongoProvides a Repository pattern for MongoDB with…
permissive · top 15,000 on PyPI
stac-pydanticProvides Pydantic models for validating and…
permissive · top 15,000 on PyPI
pydantic-to-pyarrowConverts pydantic model definitions to pyarrow…
permissive · top 15,000 on PyPI
Flask-PydanticAdds Pydantic model validation to Flask route…
permissive · top 15,000 on PyPI
numpydanticNumpydantic adds type annotations and…
permissive · top 15,000 on PyPI
bump-pydanticA CLI tool that automatically refactors…
permissive · top 15,000 on PyPI