Skip to main content

A basic document parsing and loading utility.

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

In its simplest form, the docp project is a (doc)ument (p)arsing library.

Written in CPython, the project wraps various lower-level libraries, helping to consolidate binary document structure parsing functionality into a single library. Additional functionality includes document loaders which load a parsed document's embeddings into a Chroma vector database, for RAG-enabled LLM use.

Installation

The easiest way to install docp is using pip after activating your virtual environment::

pip install docp

Additional (older) releases can be found either at PyPI or in GitHub Releases.

A note on the installation of dependencies:

To keep the installation dependencies to a minimum, only core libraries are required for installation. Meaning, the parser-specific and loader libraries are not installed automatically, as part of the pip install command.

If a parser is imported and a library is required but not installed, you'll be notified with an easy-to-read message, listing the required dependenc(y|ies).

The rationale behind this design decision is that not all users will need the document loading capability, so torch, langchain, etc. should not be installed automatically. For example, if your project requires a simple PDF parser, you don't need to (and likely don't want to) 'clutter' your environment with something as heavy as torch, nor make your project dependent on it.

The Toolset

Parsers

As of this release, parsers for the following binary document types are supported:

  • PDF
  • MS PowerPoint (PPTX)
  • (more coming soon)

Loaders

In addition to document parsing, document loading functionality is built-in as well. Specifically, loading documents into a Chroma vector database for RAG-enabled LLM ingestion.

For example, you may wish to load a series of PDF files into a vector database which serves as the backend for a RAG-enabled LLM chatbot. The ChromaLoader class is specifically designed for this. A single call to the class' loader method results in file retrieval, parsing, splitting, embedding and storage.

For further detail and usage examples, please refer to the project's documentation.

Using the Library

The documentation suite contains detailed explanation and example usage for each of the library's importable modules. For detailed documentation, usage examples and links the source code itself, please refer to the Library API page in the documentation.

Quickstart

For convenience, here are a couple examples for how to parse the supported document types.

Extract text from a PDF file:

>>> from docp import PDFParser

>>> pdf = PDFParser(path='/path/to/myfile.pdf')
>>> pdf.extract_text()

# Access the content of page 1.
>>> pg1 = pdf.doc.pages[1].content

Extract text from a PowerPoint presentation:

>>> from docp import PPTXParser

>>> pptx = PPTXParser(path='/path/to/myfile.pptx')
>>> pptx.extract_text()

# Access the text on slide 1.
>>> pg1 = pptx.doc.slides[1].content

Metadata

Release files for docp 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docp 0.2.0
File Size Uploaded Provenance Actions
docp-0.2.0.tar.gz 8.4 MB Without provenance Details for docp-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for docp 0.2.0
File Interpreter ABI Platform Actions
docp-0.2.0-py3-none-any.whl Python 3 none any Details for docp-0.2.0-py3-none-any.whl

Total release size: 8.4 MB

Release files / docp-0.2.0.tar.gz

Download URL docp-0.2.0.tar.gz
Size 8.4 MB
Tags Source
SHA-256 checksum
How to use checksums
6e3255de5a8b45de9e0a5e1ff0cc57c7198fc17acbd692b9c738c1a4aa5ae120
BLAKE2b-256 checksum
How to use checksums
5ce1ac074f5dc568c5fcbd57b86fbabc5dc4919e989bac85d31fabf0d9cf11ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / docp-0.2.0-py3-none-any.whl

Download URL docp-0.2.0-py3-none-any.whl
Size 68.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
833dd9bb4ae5167bce5dae9b90467e9a4558467c80522758efbf9e6762ac7652
BLAKE2b-256 checksum
How to use checksums
ccb0e41a74b290a5cc17fdcb906e5f47c597a862596a81907595e9c71814ff95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Security for docp 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page