docling 2.3.1__tar.gz → 2.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {docling-2.3.1 → docling-2.4.0}/PKG-INFO +3 -3
  2. {docling-2.3.1 → docling-2.4.0}/docling/cli/main.py +38 -8
  3. {docling-2.3.1 → docling-2.4.0}/docling/datamodel/pipeline_options.py +3 -3
  4. {docling-2.3.1 → docling-2.4.0}/pyproject.toml +4 -10
  5. {docling-2.3.1 → docling-2.4.0}/LICENSE +0 -0
  6. {docling-2.3.1 → docling-2.4.0}/README.md +0 -0
  7. {docling-2.3.1 → docling-2.4.0}/docling/__init__.py +0 -0
  8. {docling-2.3.1 → docling-2.4.0}/docling/backend/__init__.py +0 -0
  9. {docling-2.3.1 → docling-2.4.0}/docling/backend/abstract_backend.py +0 -0
  10. {docling-2.3.1 → docling-2.4.0}/docling/backend/asciidoc_backend.py +0 -0
  11. {docling-2.3.1 → docling-2.4.0}/docling/backend/docling_parse_backend.py +0 -0
  12. {docling-2.3.1 → docling-2.4.0}/docling/backend/docling_parse_v2_backend.py +0 -0
  13. {docling-2.3.1 → docling-2.4.0}/docling/backend/html_backend.py +0 -0
  14. {docling-2.3.1 → docling-2.4.0}/docling/backend/md_backend.py +0 -0
  15. {docling-2.3.1 → docling-2.4.0}/docling/backend/mspowerpoint_backend.py +0 -0
  16. {docling-2.3.1 → docling-2.4.0}/docling/backend/msword_backend.py +0 -0
  17. {docling-2.3.1 → docling-2.4.0}/docling/backend/pdf_backend.py +0 -0
  18. {docling-2.3.1 → docling-2.4.0}/docling/backend/pypdfium2_backend.py +0 -0
  19. {docling-2.3.1 → docling-2.4.0}/docling/cli/__init__.py +0 -0
  20. {docling-2.3.1 → docling-2.4.0}/docling/datamodel/__init__.py +0 -0
  21. {docling-2.3.1 → docling-2.4.0}/docling/datamodel/base_models.py +0 -0
  22. {docling-2.3.1 → docling-2.4.0}/docling/datamodel/document.py +0 -0
  23. {docling-2.3.1 → docling-2.4.0}/docling/datamodel/settings.py +0 -0
  24. {docling-2.3.1 → docling-2.4.0}/docling/document_converter.py +0 -0
  25. {docling-2.3.1 → docling-2.4.0}/docling/models/__init__.py +0 -0
  26. {docling-2.3.1 → docling-2.4.0}/docling/models/base_model.py +0 -0
  27. {docling-2.3.1 → docling-2.4.0}/docling/models/base_ocr_model.py +0 -0
  28. {docling-2.3.1 → docling-2.4.0}/docling/models/ds_glm_model.py +0 -0
  29. {docling-2.3.1 → docling-2.4.0}/docling/models/easyocr_model.py +0 -0
  30. {docling-2.3.1 → docling-2.4.0}/docling/models/layout_model.py +0 -0
  31. {docling-2.3.1 → docling-2.4.0}/docling/models/page_assemble_model.py +0 -0
  32. {docling-2.3.1 → docling-2.4.0}/docling/models/page_preprocessing_model.py +0 -0
  33. {docling-2.3.1 → docling-2.4.0}/docling/models/table_structure_model.py +0 -0
  34. {docling-2.3.1 → docling-2.4.0}/docling/models/tesseract_ocr_cli_model.py +0 -0
  35. {docling-2.3.1 → docling-2.4.0}/docling/models/tesseract_ocr_model.py +0 -0
  36. {docling-2.3.1 → docling-2.4.0}/docling/pipeline/__init__.py +0 -0
  37. {docling-2.3.1 → docling-2.4.0}/docling/pipeline/base_pipeline.py +0 -0
  38. {docling-2.3.1 → docling-2.4.0}/docling/pipeline/simple_pipeline.py +0 -0
  39. {docling-2.3.1 → docling-2.4.0}/docling/pipeline/standard_pdf_pipeline.py +0 -0
  40. {docling-2.3.1 → docling-2.4.0}/docling/utils/__init__.py +0 -0
  41. {docling-2.3.1 → docling-2.4.0}/docling/utils/export.py +0 -0
  42. {docling-2.3.1 → docling-2.4.0}/docling/utils/layout_utils.py +0 -0
  43. {docling-2.3.1 → docling-2.4.0}/docling/utils/profiling.py +0 -0
  44. {docling-2.3.1 → docling-2.4.0}/docling/utils/utils.py +0 -0
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: docling
3
- Version: 2.3.1
4
- Summary: Docling PDF conversion package
3
+ Version: 2.4.0
4
+ Summary: SDK and CLI for parsing PDF, DOCX, HTML, and more, to a unified document representation for powering downstream workflows such as gen AI applications.
5
5
  Home-page: https://github.com/DS4SD/docling
6
6
  License: MIT
7
- Keywords: docling,convert,document,pdf,layout model,segmentation,table structure,table former
7
+ Keywords: docling,convert,document,pdf,docx,html,markdown,layout model,segmentation,table structure,table former
8
8
  Author: Christoph Auer
9
9
  Author-email: cau@zurich.ibm.com
10
10
  Requires-Python: >=3.10,<4.0
@@ -5,12 +5,15 @@ import time
5
5
  import warnings
6
6
  from enum import Enum
7
7
  from pathlib import Path
8
- from typing import Annotated, Dict, Iterable, List, Optional
8
+ from typing import Annotated, Dict, Iterable, List, Optional, Type
9
9
 
10
10
  import typer
11
11
  from docling_core.utils.file import resolve_file_source
12
12
 
13
13
  from docling.backend.docling_parse_backend import DoclingParseDocumentBackend
14
+ from docling.backend.docling_parse_v2_backend import DoclingParseV2DocumentBackend
15
+ from docling.backend.pdf_backend import PdfDocumentBackend
16
+ from docling.backend.pypdfium2_backend import PyPdfiumDocumentBackend
14
17
  from docling.datamodel.base_models import (
15
18
  ConversionStatus,
16
19
  FormatToExtensions,
@@ -22,6 +25,7 @@ from docling.datamodel.pipeline_options import (
22
25
  EasyOcrOptions,
23
26
  OcrOptions,
24
27
  PdfPipelineOptions,
28
+ TableFormerMode,
25
29
  TesseractCliOcrOptions,
26
30
  TesseractOcrOptions,
27
31
  )
@@ -58,9 +62,10 @@ def version_callback(value: bool):
58
62
 
59
63
 
60
64
  # Define an enum for the backend options
61
- class Backend(str, Enum):
65
+ class PdfBackend(str, Enum):
62
66
  PYPDFIUM2 = "pypdfium2"
63
- DOCLING = "docling"
67
+ DLPARSE_V1 = "dlparse_v1"
68
+ DLPARSE_V2 = "dlparse_v2"
64
69
 
65
70
 
66
71
  # Define an enum for the ocr engines
@@ -90,28 +95,28 @@ def export_documents(
90
95
  # Export Deep Search document JSON format:
91
96
  if export_json:
92
97
  fname = output_dir / f"{doc_filename}.json"
93
- with fname.open("w") as fp:
98
+ with fname.open("w", encoding="utf8") as fp:
94
99
  _log.info(f"writing JSON output to {fname}")
95
100
  fp.write(json.dumps(conv_res.document.export_to_dict()))
96
101
 
97
102
  # Export Text format:
98
103
  if export_txt:
99
104
  fname = output_dir / f"{doc_filename}.txt"
100
- with fname.open("w") as fp:
105
+ with fname.open("w", encoding="utf8") as fp:
101
106
  _log.info(f"writing Text output to {fname}")
102
107
  fp.write(conv_res.document.export_to_markdown(strict_text=True))
103
108
 
104
109
  # Export Markdown format:
105
110
  if export_md:
106
111
  fname = output_dir / f"{doc_filename}.md"
107
- with fname.open("w") as fp:
112
+ with fname.open("w", encoding="utf8") as fp:
108
113
  _log.info(f"writing Markdown output to {fname}")
109
114
  fp.write(conv_res.document.export_to_markdown())
110
115
 
111
116
  # Export Document Tags format:
112
117
  if export_doctags:
113
118
  fname = output_dir / f"{doc_filename}.doctags"
114
- with fname.open("w") as fp:
119
+ with fname.open("w", encoding="utf8") as fp:
115
120
  _log.info(f"writing Doc Tags output to {fname}")
116
121
  fp.write(conv_res.document.export_to_document_tokens())
117
122
 
@@ -151,6 +156,17 @@ def convert(
151
156
  ocr_engine: Annotated[
152
157
  OcrEngine, typer.Option(..., help="The OCR engine to use.")
153
158
  ] = OcrEngine.EASYOCR,
159
+ pdf_backend: Annotated[
160
+ PdfBackend, typer.Option(..., help="The PDF backend to use.")
161
+ ] = PdfBackend.DLPARSE_V1,
162
+ table_mode: Annotated[
163
+ TableFormerMode,
164
+ typer.Option(..., help="The mode to use in the table structure model."),
165
+ ] = TableFormerMode.FAST,
166
+ artifacts_path: Annotated[
167
+ Optional[Path],
168
+ typer.Option(..., help="If provided, the location of the model artifacts."),
169
+ ] = None,
154
170
  abort_on_error: Annotated[
155
171
  bool,
156
172
  typer.Option(
@@ -217,11 +233,25 @@ def convert(
217
233
  do_table_structure=True,
218
234
  )
219
235
  pipeline_options.table_structure_options.do_cell_matching = True # do_cell_matching
236
+ pipeline_options.table_structure_options.mode = table_mode
237
+
238
+ if artifacts_path is not None:
239
+ pipeline_options.artifacts_path = artifacts_path
240
+
241
+ match pdf_backend:
242
+ case PdfBackend.DLPARSE_V1:
243
+ backend: Type[PdfDocumentBackend] = DoclingParseDocumentBackend
244
+ case PdfBackend.DLPARSE_V2:
245
+ backend = DoclingParseV2DocumentBackend
246
+ case PdfBackend.PYPDFIUM2:
247
+ backend = PyPdfiumDocumentBackend
248
+ case _:
249
+ raise RuntimeError(f"Unexpected PDF backend type {pdf_backend}")
220
250
 
221
251
  format_options: Dict[InputFormat, FormatOption] = {
222
252
  InputFormat.PDF: PdfFormatOption(
223
253
  pipeline_options=pipeline_options,
224
- backend=DoclingParseDocumentBackend, # pdf_backend
254
+ backend=backend, # pdf_backend
225
255
  )
226
256
  }
227
257
  doc_converter = DocumentConverter(
@@ -1,4 +1,4 @@
1
- from enum import Enum, auto
1
+ from enum import Enum
2
2
  from pathlib import Path
3
3
  from typing import List, Literal, Optional, Union
4
4
 
@@ -6,8 +6,8 @@ from pydantic import BaseModel, ConfigDict, Field
6
6
 
7
7
 
8
8
  class TableFormerMode(str, Enum):
9
- FAST = auto()
10
- ACCURATE = auto()
9
+ FAST = "fast"
10
+ ACCURATE = "accurate"
11
11
 
12
12
 
13
13
  class TableStructureOptions(BaseModel):
@@ -1,13 +1,13 @@
1
1
  [tool.poetry]
2
2
  name = "docling"
3
- version = "2.3.1" # DO NOT EDIT, updated automatically
4
- description = "Docling PDF conversion package"
5
- authors = ["Christoph Auer <cau@zurich.ibm.com>", "Michele Dolfi <dol@zurich.ibm.com>", "Maxim Lysak <mly@zurich.ibm.com>", "Nikos Livathinos <nli@zurich.ibm.com>", "Ahmed Nassar <ahn@zurich.ibm.com>", "Peter Staar <taa@zurich.ibm.com>"]
3
+ version = "2.4.0" # DO NOT EDIT, updated automatically
4
+ description = "SDK and CLI for parsing PDF, DOCX, HTML, and more, to a unified document representation for powering downstream workflows such as gen AI applications."
5
+ authors = ["Christoph Auer <cau@zurich.ibm.com>", "Michele Dolfi <dol@zurich.ibm.com>", "Maxim Lysak <mly@zurich.ibm.com>", "Nikos Livathinos <nli@zurich.ibm.com>", "Ahmed Nassar <ahn@zurich.ibm.com>", "Panos Vagenas <pva@zurich.ibm.com>", "Peter Staar <taa@zurich.ibm.com>"]
6
6
  license = "MIT"
7
7
  readme = "README.md"
8
8
  repository = "https://github.com/DS4SD/docling"
9
9
  homepage = "https://github.com/DS4SD/docling"
10
- keywords= ["docling", "convert", "document", "pdf", "layout model", "segmentation", "table structure", "table former"]
10
+ keywords= ["docling", "convert", "document", "pdf", "docx", "html", "markdown", "layout model", "segmentation", "table structure", "table former"]
11
11
  classifiers = [
12
12
  "License :: OSI Approved :: MIT License",
13
13
  "Operating System :: MacOS :: MacOS X",
@@ -73,12 +73,6 @@ mkdocs-jupyter = "^0.25.0"
73
73
  [tool.poetry.group.examples.dependencies]
74
74
  datasets = "^2.21.0"
75
75
  python-dotenv = "^1.0.1"
76
- # llama-index-readers-docling = { version = "^0.1.0", markers = 'python_version < "3.13"' }
77
- # llama-index-node-parser-docling = { version = "^0.1.0", markers = 'python_version < "3.13"' }
78
- # llama-index-readers-file = { version = "^0.2.2", markers = 'python_version < "3.13"' }
79
- # llama-index-embeddings-huggingface = { version = "^0.3.1", markers = 'python_version < "3.13"' }
80
- # llama-index-llms-huggingface-api = { version = "^0.2.0", markers = 'python_version < "3.13"' }
81
- # llama-index-vector-stores-milvus ={ version = "^0.2.1", markers = 'python_version < "3.13"' }
82
76
  langchain-huggingface = "^0.0.3"
83
77
  langchain-milvus = "^0.1.4"
84
78
  langchain-text-splitters = "^0.2.4"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes