Skip to content

feat: add Python bindings via PyO3#2

Open
Jacqkues wants to merge 1 commit intofirecrawl:mainfrom
Jacqkues:feat/python-bindings
Open

feat: add Python bindings via PyO3#2
Jacqkues wants to merge 1 commit intofirecrawl:mainfrom
Jacqkues:feat/python-bindings

Conversation

@Jacqkues
Copy link
Copy Markdown

Summary

  • Add Python bindings using PyO3 + maturin, exposing all core functionality: process_pdf, detect_pdf, extract_text, extract_text_with_positions, and their bytes variants
  • Add type stubs (pdf_inspector.pyi) for IDE autocompletion
  • Add 21 pytest tests covering all API functions, error handling, and all test fixtures
  • Add examples/basic_usage.py demonstrating full API
  • Update README with Python quick start, API reference, and installation instructions

Test plan

  • All 21 Python tests pass (pytest tests/test_python.py)
  • Rust compilation succeeds with python feature (maturin develop --release)
  • Verified on real PDF fixtures (6 different PDFs)
  • Test maturin build --release for wheel distribution
  • Test on Linux CI

🤖 Generated with Claude Code

Expose the pdf-inspector Rust library as a Python package using PyO3 + maturin.
Python users can now `pip install` and use `import pdf_inspector` for PDF
classification, text extraction, and markdown conversion with native Rust speed.

Adds:
- src/python.rs: PyO3 bindings (process_pdf, detect_pdf, extract_text, etc.)
- pyproject.toml: maturin build configuration
- pdf_inspector.pyi: type stubs for IDE support
- tests/test_python.py: 21 pytest tests covering all Python API functions
- examples/basic_usage.py: example script demonstrating all features
- Updated README with Python quick start and API reference

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant