skillfed

docarray

The data structure for multimodal data

docarray v0.41.0 109.0K downloads/30d#12,531 on PyPI3,125
Permissive license Apache 2.0 Active released

What it is and what it does

DocArray is a Python library for defining, organizing, and working with multimodal data in machine learning workflows. It provides Pydantic-based schema definitions that let you declare document types with typed fields—including tensors with explicit shapes—and then collect them into vectorized or list-based containers for batch processing. The library integrates with NumPy and other tensor frameworks, and is designed to work seamlessly with web frameworks and microservice platforms.

You use DocArray when you need to represent complex, heterogeneous data (images, text, embeddings, metadata) in a structured way that mirrors how machine learning models consume it. It handles both single documents and bulk collections: DocVec stacks tensors for efficient batch operations, while DocList preserves individual tensor structures for streaming or re-ranking. The library also supports nested document composition and can serialize data as JSON over HTTP or Protobuf over gRPC.

Use it for:

  • Define typed schemas for multimodal training data with tensor shape validation, then batch them for model training.
  • Build API endpoints that accept and return structured multimodal documents with automatic validation.
  • Organize and transmit image, text, and embedding data together in a single document structure for neural search applications.
  • Compose nested document hierarchies (e.g., a document containing both image and text sub-documents) for complex data pipelines.
  • Serialize multimodal collections to JSON or Protobuf for inter-service communication in microservice architectures.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

DocArray provides a Python data structure for representing, transmitting, storing, and retrieving multimodal data, with built-in support for tensors from NumPy, PyTorch, TensorFlow, and JAX.

Yes. DocArray is actively maintained, has low install friction, carries a permissive Apache 2.0 license, and solves a real problem for machine learning workflows involving multimodal data. It integrates well with the Python ecosystem and is particularly valuable if you're building systems that need structured tensor and metadata handling. No known vulnerabilities.

Install

docarray on PyPI

pip

pip install docarray

uv

uv add docarray

poetry

poetry add docarray

Installing docarray

Before you install

Low install friction with six runtime dependencies (pydantic, numpy, orjson, typing-inspect, types-requests, rich). Active maintenance with last commit on 2026-03-27 and 3125 repository stars.

License in practice

Licensed under Apache 2.0 (permissive), allowing free use, modification, and distribution in both open-source and commercial projects with minimal restrictions.

Quickstart

pip install docarray

from docarray import BaseDoc, DocVec
from docarray.typing import ImageUrl
import numpy as np

class MyDocument(BaseDoc):
    description: str
    image_url: ImageUrl
    tensor: np.ndarray

vec = DocVec[MyDocument]([
    MyDocument(
        description="A cat",
        image_url="https://example.com/cat.jpg",
        tensor=np.zeros((3, 224, 224)),
    )
])

Verify before relying

  • Whether vector database integrations (Weaviate, Qdrant, ElasticSearch, Redis, Mongo Atlas, HNSWLib) are included in base install or require optional dependencies.
  • Performance characteristics when working with very large document collections or high-dimensional tensors.
  • Compatibility details with specific versions of PyTorch, TensorFlow, and JAX beyond the general native support claim.

Package facts

License Apache 2.0 (permissive)
Python support supports the current Python release (<4.0,>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 6 — pydantic, numpy, orjson, typing-inspect, types-requests, rich
Maintenance actively maintained — 511 days since the last release
Last repo commit
First released
Downloads 109,045/month — #12,531 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: docarray-0.41.0-py3-none-any.whl

Keywords: docarray, deep-learning, data-structures cross-modal multi-modal, unstructured-data, nested-data, neural-search

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseLicense :: Other/Proprietary LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Unix ShellTopic :: Database :: Database Engines/ServersTopic :: Internet :: WWW/HTTP :: Indexing/SearchTopic :: Multimedia :: VideoTopic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Scientific/Engineering :: Image RecognitionTopic :: Scientific/Engineering :: MathematicsTopic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules

Tags

multimodal data structuretensor data representationdocument vector storagemachine learning data handlingnested document schemabatch tensor processingpydantic-based data model
multimodal-datatensor-handlingml-data-structures

More Software Development packages