$npx skillfedfor your agent

pydantic-numpy

Pydantic Model integration of the NumPy array

Worth itPyPI Python ModulesReleased Aug 2026178.4K downloads / moBSD-3-ClausePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pydantic_numpy-9.0.2-py3-none-any.whl
v9.0.2 · released 2026-08-01 · Python <3.15,>=3.11 · 5 runtime deps: compress-pickle, ruamel-yaml, numpy, pydantic, semver

Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and solves a real gap in Pydantic's NumPy support. It's suitable for production use if you need to validate and serialize NumPy arrays within Pydantic models. The permissive BSD-3-Clause license poses no restriction.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.11 or later (supports current versions, <3.15).
  • Low friction install with five runtime dependencies (pydantic, numpy, ruamel-yaml, compress-pickle, semver).
  • Active maintenance with a release 13 days ago; repo is not archived and has recent commits.

License · maintenance · safety

BSD-3-Clause (permissive) — BSD-3-Clause is permissive; you can use, modify, and distribute this package with minimal restrictions in commercial or open-source projects.

last release 2026-08-01 (13 days) · last repo commit 2026-08-13 · 52 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 178,398 downloads/mo, #10,194 on PyPI

Verify before relying

pip install pydantic-numpy

import numpy as np
from pydantic import BaseModel
import pydantic_numpy.typing as pnd

class MyModel(BaseModel):
    array: pnd.Np1DArrayFp64

model = MyModel(array=np.array([1.5, 2.5, 3.5]))
json_str = model.model_dump_json()
restored = MyModel.model_validate_json(json_str)
  • Whether custom serialization functions can handle all array types and edge cases you need.
  • Performance characteristics when working with very large arrays or deeply nested structures.
  • Compatibility with all Pydantic v2 features beyond the examples shown.
Same gist for agents: .md · .json

What it is and what it does

pydantic-numpy bridges NumPy arrays and Pydantic's validation and serialization framework. It provides typed annotations (like NpNDArrayFp64 for 3D float64 arrays) that work with both BaseModel and dataclass, plus a NumpyModel class for seamless dump/load of arrays to disk. You can instantiate models from raw arrays, NumPy .npy files, or .npz files with keys, and serialize to JSON with full schema compliance.

The package handles the impedance mismatch between NumPy's array semantics and Pydantic's type system by wrapping arrays in validated fields. It supports custom serialization, dimension constraints, dtype specification, and model-agnostic loading when multiple models might match. Runtime dependencies are minimal and well-established (pydantic, numpy, ruamel-yaml, compress-pickle, semver).

Use it for

  • Validate and serialize machine-learning model inputs/outputs that include NumPy arrays as Pydantic models.
  • Define strict dtype and dimension requirements for arrays in data pipelines (e.g., float32 1D arrays only).
  • Persist Pydantic models containing arrays to disk and reload them with automatic type checking.
  • Generate JSON schemas for APIs that accept or return NumPy array data.
  • Combine NumPy arrays with other Pydantic fields in a single validated data structure.

Worth the install?

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

Worth it

Yes.

The package is actively maintained, has no known vulnerabilities, low install friction, and solves a real gap in Pydantic's NumPy support. It's suitable for production use if you need to validate and serialize NumPy arrays within Pydantic models. The permissive BSD-3-Clause license poses no restriction.

Install

pydantic-numpy on PyPI

Before you install

Low friction install with five runtime dependencies (pydantic, numpy, ruamel-yaml, compress-pickle, semver). Active maintenance with a release 13 days ago; repo is not archived and has recent commits.

Requires Python 3.11 or later (supports current versions, <3.15).

License in practice

BSD-3-Clause is permissive; you can use, modify, and distribute this package with minimal restrictions in commercial or open-source projects.

Quickstart

pip install pydantic-numpy

import numpy as np
from pydantic import BaseModel
import pydantic_numpy.typing as pnd

class MyModel(BaseModel):
    array: pnd.Np1DArrayFp64

model = MyModel(array=np.array([1.5, 2.5, 3.5]))
json_str = model.model_dump_json()
restored = MyModel.model_validate_json(json_str)

Verify before relying

  • Whether custom serialization functions can handle all array types and edge cases you need.
  • Performance characteristics when working with very large arrays or deeply nested structures.
  • Compatibility with all Pydantic v2 features beyond the examples shown.

Package facts

LicenseBSD-3-Clause permissive
Python supportSupports the current Python release <3.15,>=3.11
Install frictionLow. Pure-Python wheel
Runtime dependencies
5 packages
compress-pickleruamel-yamlnumpypydanticsemver
MaintenanceActively maintained 13 days since the last release
Last repo commit
First released
Downloads178,398 / month, #10,194 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableOperating System :: OS IndependentTopic :: Software Development :: Libraries :: Python Modules

Evidence: pydantic_numpy-9.0.2-py3-none-any.whl

Tags

Capabilities
numpy array pydantic validationpydantic numpy integrationtyped numpy arraysserialize numpy arrays jsonpydantic numpy modelsnumpy dtype validationarray dimension checking
Topics
numpy-integrationdata-validationserialization
PyPI keywords
pydanticnumpytypingvalidation

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 numpy integration”

  • pydantic-numpyIntegrates NumPy arrays into Pydantic models with type validation,…
  • kumo-apikumo-api defines RESTful API resource schemas as Pydantic dataclasses…
  • numpydanticNumpydantic adds type annotations and validation for arrays with…

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

More Python Modules packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
PyYAML Worth it
PyPI · Python Modules · released Sep 2025

PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.

MITcompiled wheel · 3.8+
1.2Bdownloads / mo
pydantic Worth it
PyPI · Python Modules · released May 2026

Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.

MITpure Python · 3.9+
1.1Bdownloads / mo
annotated-types Worth it
PyPI · Python Modules · released Jul 2026

Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.

Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…

MITpure Python · 3.10+
871.3Mdownloads / mo
typing-inspection Worth it
PyPI · Python Modules · released Aug 2026

Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.

MITpure Python · 3.10+
783.0Mdownloads / mo

See also numpydantic · pydantic-collections · pydantic_yaml · pydantic-zarr · pydantic-to-typescript2 · drf-pydantic · pydantic-scim · pydantic-to-typescript · data-science-types · Flask-Pydantic