Skip to main content

Psyduck

Psyduck is a small Python SDK for turning PDFs into agent-ready structured documents.

It is intentionally SDK-only: import it from Python, run Psyduck().process(...), and inspect the returned document, profile, quality report, and exported artifacts.

Install

pip install psyduck

Development install:

pip install -e ".[dev]"

Python API

from psyduck import Psyduck

duck = Psyduck()
result = duck.process("report.pdf", goal="rag", mode="balanced", return_content=True)

if result.quality.needs_review:
    for warning in result.quality.warnings:
        print(warning.code, warning.message)

for block in result.document.blocks:
    print(block.page, block.text)

Output Directory

output/report-<timestamp>-<id>/
  run.json
  profile.json
  document.md
  document.json
  quality.json
  tables/
  assets/
  pages/

SDK Contract

  • Default extraction uses PyMuPDF.
  • process() always writes Markdown, JSON, profile, quality, and run metadata.
  • return_content=False keeps large document content out of the immediate result.
  • load_result(output_dir) reloads a previous SDK run.
  • Custom extractors can be supplied through extractor_registry and requested with process(..., extractors=[...]).
  • tables="force" and ocr="force" report needs_table_adapter / needs_ocr_adapter warnings unless a caller-provided extractor handles that work.

Custom Extractors

from psyduck import Psyduck
from psyduck.extractors.base import ExtractorOutput
from psyduck.extractors.pymupdf import PyMuPDFExtractor


class MyExtractor:
    def extract(self, file_path, pages=None):
        return ExtractorOutput(source="my_extractor")


duck = Psyduck(
    extractor_registry={
        "pymupdf": PyMuPDFExtractor,
        "my_extractor": lambda: MyExtractor(),
    }
)

result = duck.process("report.pdf", extractors=["pymupdf", "my_extractor"])

Agent Policy

  1. Always call process() before answering questions about PDF contents.
  2. Check result.quality before using extracted content.
  3. Use Markdown for summaries and JSON for page-aware answers.
  4. Do not claim complete extraction when needs_review is true.

Metadata

Release files for psyduck 0.1.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 psyduck 0.1.0
File Size Uploaded Provenance
psyduck-0.1.0.tar.gz 32.6 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 46.2 kB

Release files / psyduck-0.1.0.tar.gz

Download URL psyduck-0.1.0.tar.gz
Size 32.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5e1c2785695d1e5aa70f7151994e046fe5afee0e7ec6a392de34f71ae3f0bb06
BLAKE2b-256 checksum
How to use checksums
bd1ea2d110466db7c43aa82f17d235bb1fe59ffd20a741b91e82859c071a04f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / psyduck-0.1.0-py3-none-any.whl

Download URL psyduck-0.1.0-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb4ee174116603a02ff588c6a3655b453773569b939dae760776c1bca06f3913
BLAKE2b-256 checksum
How to use checksums
1216c914a1b375838cbf150a9c9835ad9aafeac1facaed75b4bfb2f88e0f4f8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for psyduck 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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