Skip to main content

Fitz PDF Parser for Swarmauri.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_parser_fitzpdf


Swarmauri Parser Fitz PDF

PDF-to-text parser for Swarmauri built on PyMuPDF (pymupdf). Extracts text from every page of a PDF and returns a Document object with the aggregated content and source metadata.

Features

  • Opens PDFs via PyMuPDF and collects text per page.
  • Emits a single Document with content containing the combined text and metadata['source'] holding the file path.
  • Raises a clear error if the input is not a file path string; returns an empty list if PyMuPDF encounters parsing failures.

Prerequisites

  • Python 3.10 or newer.
  • PyMuPDF (pymupdf) along with system dependencies (X11 libraries on Linux, poppler on some distros). Install OS packages listed in PyMuPDF docs before pip installing if needed.
  • Read access to the PDF files you plan to parse.

Installation

# pip
pip install swarmauri_parser_fitzpdf

# poetry
poetry add swarmauri_parser_fitzpdf

# uv (pyproject-based projects)
uv add swarmauri_parser_fitzpdf

Quickstart

from swarmauri_parser_fitzpdf import FitzPdfParser

parser = FitzPdfParser()
documents = parser.parse("reports/quarterly.pdf")

for doc in documents:
    print(doc.metadata["source"])
    print(doc.content[:500])

Handling Errors

from swarmauri_parser_fitzpdf import FitzPdfParser

parser = FitzPdfParser()
try:
    docs = parser.parse("missing.pdf")
    if not docs:
        print("Parsing failed or returned no content.")
except ValueError as exc:
    print(f"Bad input: {exc}")

Tips

  • Pre-process PDFs (deskew, OCR) before parsing if they contain scanned pages without embedded text; PyMuPDF only extracts existing text objects.
  • For multi-document pipelines, pair this parser with Swarmauri token-count measurements or summarizers to chunk large PDFs.
  • Cache parsed output if the same PDF is accessed frequently—parsing large documents repeatedly is expensive.

Want to help?

If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

swarmauri_parser_fitzpdf-0.8.2.dev6.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

swarmauri_parser_fitzpdf-0.8.2.dev6-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_parser_fitzpdf-0.8.2.dev6.tar.gz.

File metadata

  • Download URL: swarmauri_parser_fitzpdf-0.8.2.dev6.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_parser_fitzpdf-0.8.2.dev6.tar.gz
Algorithm Hash digest
SHA256 af607b2c45413bfbd35843ae2423c0da1e43e42cf7ee7f12fba687c2fae55470
MD5 73f50f94383c233a4a1229c26b0595ef
BLAKE2b-256 64a48472a25801176d1aade9fecf89b747ff9fd93388b4830e321e0940628a3f

See more details on using hashes here.

File details

Details for the file swarmauri_parser_fitzpdf-0.8.2.dev6-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_parser_fitzpdf-0.8.2.dev6-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_parser_fitzpdf-0.8.2.dev6-py3-none-any.whl
Algorithm Hash digest
SHA256 514da76f566469bccdd9d3f052abcdda5f4e94ab834b732338f7457553d14467
MD5 a4df21772275f4fc4f49e41a4d84dbe9
BLAKE2b-256 654a81283dbd0dabf3904bf3c2fa7e7007a7f971f8b234c7597e6a691644cd6a

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