Skip to main content

docinfer

A Python package for extracting and inferring metadata from PDF documents using AI-powered analysis.

Features

  • Extract metadata from PDF files
  • AI-powered document analysis using LLMs
  • CLI tool for easy batch processing
  • Flexible configuration and output formatting
  • Structured metadata models using Pydantic

Requirements

  • Python 3.12 or higher
  • Ollama - Required for AI-powered analysis
  • See pyproject.toml for full Python dependency list

Installation

From GitHub Repository

pip install git+https://github.com/tidyeval/docinfer.git

From Local Development

Clone the repository and install in editable mode:

git clone https://github.com/tidyeval/docinfer.git
cd docinfer
pip install -e .

Quick Start

Run directly without installation using uvx:

uvx --from git+https://github.com/tidyeval/docinfer.git docinfer <path-to-pdf>

Note: Once published to PyPI, you'll be able to run uvx docinfer <path-to-pdf> directly.

CLI Usage

If you've installed the package locally, run directly:

docinfer <path-to-pdf>

Options

  • --model MODEL - Specify the Ollama model (default: gemma3:4b)
    • Example: docinfer document.pdf --model gemma2
  • --json - Output as JSON instead of formatted text
  • --no-ai - Skip AI analysis and show embedded metadata only
  • --export FILE - Export results to JSON file
  • --quiet - Suppress progress output

Python API

from docinfer.services.pdf_extractor import PDFExtractor
from docinfer.services.ai_analyzer import AIAnalyzer

# Extract PDF content
extractor = PDFExtractor()
content = extractor.extract("document.pdf")

# Analyze with AI
analyzer = AIAnalyzer()
metadata = analyzer.analyze(content)

Project Structure

docinfer/
├── src/
│   ├── cli.py              # Command-line interface
│   ├── models/             # Pydantic data models
│   ├── services/           # Core services (PDF extraction, AI analysis)
│   └── prompts/            # AI prompt templates
├── tests/                  # Unit and integration tests
├── specs/                  # Project specifications
├── pyproject.toml          # Project configuration
└── README.md               # This file

Development

Setting up Development Environment

  1. Clone the repository:

    git clone https://github.com/tidyeval/docinfer.git
    cd docinfer
    
  2. Create and activate virtual environment:

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    
  3. Install in development mode:

    pip install -e ".[dev]"
    

Running Tests

pytest

Code Quality

The project uses:

  • black for code formatting
  • ruff for linting
  • pytest for testing

Contributing

Contributions are welcome! Please ensure:

  • Code passes linting and formatting checks
  • Tests pass with good coverage
  • Commit messages are descriptive

License

See LICENSE file for details.

Author

Tino Kanngiesser (tinokanngiesser@gmail.com)

Metadata

Release files for docinfer 0.1.1

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

Source distribution (sdist)

Source distribution for docinfer 0.1.1
File Size Uploaded
docinfer-0.1.1.tar.gz 15.5 kB Details

Built distribution (wheel)

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

Total release size: 32.7 kB

Release files / docinfer-0.1.1.tar.gz

Download URL docinfer-0.1.1.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d91ecc4270fcad376eb1a2a1e93075ac48da544ba358982eed281bbb4d523aa5
BLAKE2b-256 checksum
How to use checksums
d7f89b730219b8eccb33e9164d3b20f761cbd3b273bace3e82e9033fa10c6805
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release files / docinfer-0.1.1-py3-none-any.whl

Download URL docinfer-0.1.1-py3-none-any.whl
Size 17.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c78ea535683cde49412e14e725659d832050a7d970db2ef4f0042bcb62de2274
BLAKE2b-256 checksum
How to use checksums
4672cbccc435c599cd739b478902e0113d84ab1242f01fff8db9d740a0fa9cbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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