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
Documentwithcontentcontaining the combined text andmetadata['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.
Metadata
Release files for swarmauri_parser_fitzpdf 0.8.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| swarmauri_parser_fitzpdf-0.8.3.tar.gz | 7.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swarmauri_parser_fitzpdf-0.8.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.6 kB
Release files / swarmauri_parser_fitzpdf-0.8.3.tar.gz
| Download URL | swarmauri_parser_fitzpdf-0.8.3.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aab1080e8f77c4e606d526b86a38d5a27319e219205a90852489d553d72b3b19
|
|
BLAKE2b-256 checksum How to use checksums |
dc8b1234ea37fa998f20230731a2e6f0e9f8e70abd62acf0f628ecb8024e8f7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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}
|
Release files / swarmauri_parser_fitzpdf-0.8.3-py3-none-any.whl
| Download URL | swarmauri_parser_fitzpdf-0.8.3-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e96e469ae63602b46327ca95d60287e932f246f6393930ddb8e057961d1a5b1c
|
|
BLAKE2b-256 checksum How to use checksums |
b867b21a746dc5192bad6d67ac19c34097b8651d0407c757493e08475a618aba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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}
|