# Docling Core
[![PyPI version](https://img.shields.io/pypi/v/docling-core)](https://pypi.org/project/docling-core/)
![Python](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%20%203.11%20%7C%203.12%20%7C%203.13-blue)
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![License MIT](https://img.shields.io/github/license/ds4sd/docling-core)](https://opensource.org/licenses/MIT)
Docling Core is a library that defines the data types in [Docling](https://github.com/DS4SD/docling), leveraging pydantic models.
## Installation
To use Docling Core, simply install `docling-core` from your package manager, e.g. pip:
```bash
pip install docling-core
```
### Development setup
To develop for Docling Core, you need Python 3.9 / 3.10 / 3.11 / 3.12 / 3.13 and Poetry. You can then install from your local clone's root dir:
```bash
poetry install
```
To run the pytest suite, execute:
```
poetry run pytest test
```
## Basic Usage
- You can validate your JSON objects using the pydantic class definition.
```py
from docling_core.types import DoclingDocument
data_dict = {...} # here the object you want to validate, as a dictionary
DoclingDocument.model_validate(data_dict)
data_str = {...} # here the object as a JSON string
DoclingDocument.model_validate_json(data_str)
```
- You can generate the JSON schema of a model with the script `generate_jsonschema`.
```py
# for the `DoclingDocument` type
generate_jsonschema DoclingDocument
# for the use `Record` type
generate_jsonschema Record
```
## Documentation
Docling Core contains 3 top-level data types:
- **DoclingDocument** for publications like books, articles, reports, or patents. The JSON that can be exported using Docling follows this schema.
The DoclingDocument type also models the metadata that may be attached to the converted document.
Check [DoclingDocument](docs/DoclingDocument.json) for the full JSON schema.
- **Record** for structured database records, centered on an entity or _subject_ that is provided with a list of attributes.
Related to records, the statements can represent annotations on text by Natural Language Processing (NLP) tools.
Check [Record](docs/Record.json) for the full JSON schema.
- **Generic** for any data representation, ensuring minimal configuration and maximum flexibility.
Check [Generic](docs/Generic.json) for the full JSON schema.
The data schemas are defined using [pydantic](https://pydantic-docs.helpmanual.io/) models, which provide built-in processes to support the creation of data that adhere to those models.
## Contributing
Please read [Contributing to Docling Core](./CONTRIBUTING.md) for details.
## References
If you use Docling Core in your projects, please consider citing the following:
```bib
@techreport{Docling,
author = "Deep Search Team",
month = 8,
title = "Docling Technical Report",
url = "https://arxiv.org/abs/2408.09869",
eprint = "2408.09869",
doi = "10.48550/arXiv.2408.09869",
version = "1.0.0",
year = 2024
}
```
## License
The Docling Core codebase is under MIT license.
For individual model usage, please refer to the model licenses found in the original packages.
Raw data
{
"_id": null,
"home_page": "https://ds4sd.github.io/",
"name": "docling-core",
"maintainer": "Cesar Berrospi Ramis",
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": "ceb@zurich.ibm.com",
"keywords": "docling, discovery, etl, information retrieval, analytics, database, database schema, schema, JSON",
"author": "Cesar Berrospi Ramis",
"author_email": "ceb@zurich.ibm.com",
"download_url": "https://files.pythonhosted.org/packages/e6/aa/26c2fe64009da64195609a1cabdebe0305c08e2920f00532eabfe5205408/docling_core-2.12.1.tar.gz",
"platform": null,
"description": "# Docling Core\n\n[![PyPI version](https://img.shields.io/pypi/v/docling-core)](https://pypi.org/project/docling-core/)\n![Python](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%20%203.11%20%7C%203.12%20%7C%203.13-blue)\n[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)\n[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)\n[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)\n[![License MIT](https://img.shields.io/github/license/ds4sd/docling-core)](https://opensource.org/licenses/MIT)\n\nDocling Core is a library that defines the data types in [Docling](https://github.com/DS4SD/docling), leveraging pydantic models.\n\n## Installation\n\nTo use Docling Core, simply install `docling-core` from your package manager, e.g. pip:\n```bash\npip install docling-core\n```\n\n### Development setup\n\nTo develop for Docling Core, you need Python 3.9 / 3.10 / 3.11 / 3.12 / 3.13 and Poetry. You can then install from your local clone's root dir:\n```bash\npoetry install\n```\n\nTo run the pytest suite, execute:\n```\npoetry run pytest test\n```\n\n## Basic Usage\n\n- You can validate your JSON objects using the pydantic class definition.\n\n ```py\n from docling_core.types import DoclingDocument\n\n data_dict = {...} # here the object you want to validate, as a dictionary\n DoclingDocument.model_validate(data_dict)\n\n data_str = {...} # here the object as a JSON string\n DoclingDocument.model_validate_json(data_str)\n ```\n\n- You can generate the JSON schema of a model with the script `generate_jsonschema`.\n\n ```py\n # for the `DoclingDocument` type\n generate_jsonschema DoclingDocument\n\n # for the use `Record` type\n generate_jsonschema Record\n ```\n\n## Documentation\n\nDocling Core contains 3 top-level data types:\n\n- **DoclingDocument** for publications like books, articles, reports, or patents. The JSON that can be exported using Docling follows this schema.\n The DoclingDocument type also models the metadata that may be attached to the converted document.\n Check [DoclingDocument](docs/DoclingDocument.json) for the full JSON schema.\n- **Record** for structured database records, centered on an entity or _subject_ that is provided with a list of attributes.\n Related to records, the statements can represent annotations on text by Natural Language Processing (NLP) tools.\n Check [Record](docs/Record.json) for the full JSON schema.\n- **Generic** for any data representation, ensuring minimal configuration and maximum flexibility.\n Check [Generic](docs/Generic.json) for the full JSON schema.\n\nThe data schemas are defined using [pydantic](https://pydantic-docs.helpmanual.io/) models, which provide built-in processes to support the creation of data that adhere to those models.\n\n## Contributing\n\nPlease read [Contributing to Docling Core](./CONTRIBUTING.md) for details.\n\n## References\n\nIf you use Docling Core in your projects, please consider citing the following:\n\n```bib\n@techreport{Docling,\n author = \"Deep Search Team\",\n month = 8,\n title = \"Docling Technical Report\",\n url = \"https://arxiv.org/abs/2408.09869\",\n eprint = \"2408.09869\",\n doi = \"10.48550/arXiv.2408.09869\",\n version = \"1.0.0\",\n year = 2024\n}\n```\n\n## License\n\nThe Docling Core codebase is under MIT license.\nFor individual model usage, please refer to the model licenses found in the original packages.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A python library to define and validate data types in Docling.",
"version": "2.12.1",
"project_urls": {
"Homepage": "https://ds4sd.github.io/",
"Repository": "https://github.com/DS4SD/docling-core"
},
"split_keywords": [
"docling",
" discovery",
" etl",
" information retrieval",
" analytics",
" database",
" database schema",
" schema",
" json"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a3b4e95ce57b770383044dd3d264a77f26c490c23710ffbe380675c1cc07452f",
"md5": "26904654e51f13379fe4ed4b72dc7888",
"sha256": "1d7ea73cece73292cdbc68d85ff0175e88274ba9cf7babad6ce162fcaa654925"
},
"downloads": -1,
"filename": "docling_core-2.12.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "26904654e51f13379fe4ed4b72dc7888",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 90673,
"upload_time": "2024-12-17T15:33:46",
"upload_time_iso_8601": "2024-12-17T15:33:46.016770Z",
"url": "https://files.pythonhosted.org/packages/a3/b4/e95ce57b770383044dd3d264a77f26c490c23710ffbe380675c1cc07452f/docling_core-2.12.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e6aa26c2fe64009da64195609a1cabdebe0305c08e2920f00532eabfe5205408",
"md5": "d814a81869e2e7012b4f05ca299dfcd5",
"sha256": "26708db3e1cf90f91b987bdfc0c00a50b0966ecf474a650b1b5232a9210e28c4"
},
"downloads": -1,
"filename": "docling_core-2.12.1.tar.gz",
"has_sig": false,
"md5_digest": "d814a81869e2e7012b4f05ca299dfcd5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 70496,
"upload_time": "2024-12-17T15:33:47",
"upload_time_iso_8601": "2024-12-17T15:33:47.719263Z",
"url": "https://files.pythonhosted.org/packages/e6/aa/26c2fe64009da64195609a1cabdebe0305c08e2920f00532eabfe5205408/docling_core-2.12.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-17 15:33:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DS4SD",
"github_project": "docling-core",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "docling-core"
}