Registry / serialization / docling-core

docling-core

JSON →
library2.92.0pypypi✓ verified 29d ago

Docling Core is a Python library for defining, validating, and structuring data types and schemas. It's designed to align with the Docling specification, offering robust data validation capabilities. Currently at version 2.73.0, it undergoes frequent updates, often with daily or weekly releases in its 2.x series.

pip install docling-core
INSTALL
IMPORT
SIG · DOCLING-CORE
D
docling-core
serializationpythonv2.92.0
Install
13.4s avg
Import
—
Disk
229MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.92.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 230MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 13.4s · import 0.000s · 222MB
229MB installed
● package 229MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DataType
✓ from docling_core import DataType
✗ from docling_core import DataType

This example defines a `User` data type with `Field` validators for name, age, and email. It demonstrates how to instantiate a `DataType` with valid data and handles validation errors for invalid input.

from docling_core import Field, DataType class User(DataType): name = Field(str, description="The user's full name") age = Field(int, min_value=0, description="The user's age") email = Field(str, format="email", description="The user's email address") user_data = { "name": "John Doe", "age": 30, "email": "john.doe@example.com" } try: user = User(user_data) print(f"Validated user: {user.name}, {user.age}, {user.email}") except Exception as e: print(f"Validation error: {e}") # Example of invalid data invalid_user_data = { "name": "Jane Doe", "age": -5, # Invalid age "email": "invalid-email" } try: User(invalid_user_data) except Exception as e: print(f"Validation error for invalid data: {e}")
Debug
Known issues
breakingThe `Type` class was removed and replaced by `DataType`. Code using `from docling_core import Type` or instantiating `Type(...)` will break.
fix
Migrate all `Type` usages to `DataType`. E.g., `from docling_core import DataType`.
affects: >=2.0.0
breakingThe primary exception class for validation errors was renamed from `ValidationError` to `ValidationErrors`.
fix
Update exception handling: `except ValidationErrors as e:` instead of `except ValidationError as e:`.
affects: >=2.0.0
breakingThe `description` argument for `DataType` classes was renamed to `_description` to avoid potential conflicts with user-defined fields.
fix
Change `class MyData(DataType, description="...")` to `class MyData(DataType, _description="...")`.
affects: >=2.0.0
gotchaThe `format` argument in `Field` has stricter validation in 2.x and only accepts specific predefined formats (like 'email', 'uri') or a callable validator. Arbitrary strings might no longer work as expected.
fix
Review `format` usage. Ensure it's one of the supported strings or a callable. Custom format validation might need a separate callable validator.
affects: >=2.0.0
gotchaBy default, `DataType` is strict and will raise `ValidationErrors` if extra fields are provided in the input dictionary that are not defined in the `DataType` schema. Explicitly allow extra fields if needed.
fix
To allow extra fields, define the DataType with `class MyData(DataType, allow_extra_fields=True):`.
affects: >=2.0.0
Upgrade
Version history
2.92.0latest on PyPI · released Aug 19, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
28 hits · last 30 days
node
26
OpenAI (training)
1
Resources
docling-core — pip install docling-core · libregistry