Skip to main content

A basic document parsing utility. (Markdown/HTML Conversion)

Project description

A basic document parsing and loading utility - Markdown/HTML Conversion

PyPI - Version PyPI - Implementation PyPI - Python Version PyPI - Status Static Badge Static Badge Static Badge Documentation Status PyPI - License PyPI - Wheel

Overview

The docp-* project suite is designed as a comprehensive (doc)ument (p)arsing library. Built in CPython, it consolidates the capabilities of various lower-level libraries, offering a unified solution for parsing binary document structures.

The suite is extended by several sister projects, each providing unique functionality:

Project Description
docp-core Centralized core objects, functionality and settings.
docp-parsers Parse binary documents (e.g. PDF, PPTX, etc.) into Python objects.
docp-loaders Load a parsed document's embeddings into a Chroma vector database, for RAG-enabled LLM use.
docp-docling Convert a PDF into Markdown or HTML format via wrappers to the docling libraries and models.
docp-dbi Interfaces to document databases such as ChromaDB, and Neo4j (coming soon).

The Toolset (Converters)

As of this release, PDF conversion into the following types is supported:

  • PDF --> Markdown
  • PDF --> HTML

Quickstart

Installation

To install docp-docling, first activate your target virtual environment, then use pip:

pip install docp-docling

For older releases, visit PyPI or the GitHub Releases page.

Model Fetching

If your project must remain offline, you’ll need to download the docling language model locally. The pdfparser.PDFParser class requires this model to be accessible, so it must be pre-fetched and set up before use. This section outlines how to download and configure the model for offline functionality.

  1. Download the model:
docling-tools models download \
    --output-dir /path/to/models/docling-project
  1. Update config.toml in docp-core:

    • Update the docling key in the paths.models table to match the download path specified in the previous step.

Enabling GPU Support

GPU support (CUDA) should be automatically detected by library internals. However, guidance for enabling GPU-support is available.

Example Usage

For convenience, here are a couple examples for how to convert a PDF into the supported formats.

Parse a PDF into Markdown format:

>>> from docp_docling import PDFParser

# Convert
>>> pdf = PDFParser(path='/path/to/file.pdf')
>>> pdf.to_markdown()

# Access the converted content
>>> pdf.content

# Render extracted text as HTML and preview in a browser.
>>> pdf.preview()

Parse a single page from a PDF into Markdown format, including images, and store to a file:

>>> from docp_docling import PDFParser

# Convert
>>> pdf = PDFParser(path='/path/to/file.pdf')
>>> pdf.to_markdown(page_no=1,
                    image_mode='embedded',  # <-- Include images
                    to_file=True)

# Render extracted text as HTML and preview in a browser.
>>> pdf.preview()

Parse a single page from a PDF into HTML format, including images:

>>> from docp_docling import PDFParser

# Convert
>>> pdf = PDFParser(path='/path/to/file.pdf')
>>> pdf.to_html(page_no=1,
                image_mode='embedded')  # <-- Include images

# Render extracted text and preview in a browser.
>>> pdf.preview()

Using the Library

The documentation suite provides detailed explanations and usage examples for each importable module. For in-depth documentation, code examples, and source links, refer to the Library API page.

A search field is available in the left navigation bar to help you quickly locate specific modules or methods.

Troubleshooting

No troubleshooting guidance is available at this time.

For questions not covered here, or to report bugs, issues, or suggestions, please open an issue on GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docp_docling-1.0.0.tar.gz (8.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docp_docling-1.0.0-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file docp_docling-1.0.0.tar.gz.

File metadata

  • Download URL: docp_docling-1.0.0.tar.gz
  • Upload date:
  • Size: 8.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for docp_docling-1.0.0.tar.gz
Algorithm Hash digest
SHA256 dd75ae77fd83188189f1958d1ca07c56d5ffc869990fdac5765fedb481379df8
MD5 cc931dc57a74516983e736b550140bbf
BLAKE2b-256 e5eae26145d33a2ce8d9e094b9fd3daa3f5a974e4d5c76e7d2d83142f37c6c68

See more details on using hashes here.

File details

Details for the file docp_docling-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: docp_docling-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 22.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for docp_docling-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e38d19d3b87544a1e6406780f74cf91430ee32422da817441b236d33944a7ac7
MD5 f2c68c4c89ec0a7a30dd7f00bc8107fb
BLAKE2b-256 34a00be0f2ca978d07adcda88bca0aba41cfc9926002011af3e763f4e0af22db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page