Metadata-Version: 2.4
Name: openresume-parser
Version: 0.1.7
Summary: Extract structured ATS-friendly JSON from resume PDF and DOCX files
License-Expression: AGPL-3.0-or-later
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pypdf>=4.0
Requires-Dist: requests>=2.31
Requires-Dist: openai>=1.0
Provides-Extra: test
Requires-Dist: pytest>=8.0; extra == "test"
Dynamic: license-file

# OpenResume Parser for Python

`openresume-parser` extracts structured, ATS-friendly resume data from PDF and DOCX
files. Parsing runs locally by default. OCR and AI enhancement are opt-in.

See **[USAGE.md](USAGE.md)** for the full usage guide including the complete
output schema, diagnostics reference, and all configuration options.

## Install

```bash
pip install openresume-parser
```

Requires Python 3.9 or newer.

## Quick Start

```python
from openresume import parse_resume

result = parse_resume("resume.pdf")
if result["ok"]:
    resume = result["resume"]
    print(resume["full_name"])                               # "Amit Verma"
    print(resume["email"])                                   # "amit@example.com"
    print(resume["location"]["city"])                        # "Mumbai"
    print(resume["experience"]["work_history"][0]["title"])  # "Software Engineer"
    print(resume["education"]["degree_course"])              # "B.Tech"
    print(resume["skills"])                                  # ["Python", "Django", ...]
else:
    print(result["error"]["code"], result["error"]["message"])
```

## DOCX resumes

Use the same `parse_resume` function for both formats. It selects the parser
from the `.pdf` or `.docx` extension, ignoring case and URL query parameters.
Unsupported or missing extensions return `UNSUPPORTED_FILE_TYPE`.

```python
from openresume import parse_resume

result = parse_resume("resume.docx")
# Also accepts HTTP(S) and file URLs, and the same ai= options as PDF parsing.
```

DOCX parsing includes paragraphs, tables, hyperlinks, headers, and footers
and returns the same resume schema. It requires no additional dependencies.
`pageCount` and `detectedColumns` are `None` because DOCX layout depends on
rendering. Image-only DOCX files and legacy `.doc` files are unsupported;
OCR options apply only to PDFs.

## OCR (scanned PDFs)

```python
from openresume import OcrSpaceOptions, parse_resume

result = parse_resume(
    "scanned-resume.pdf",
    ocr=OcrSpaceOptions(api_key="your-ocr-space-key"),
)
```

## AI Enhancement

```python
from openresume import OpenAIOptions, parse_resume

result = parse_resume(
    "resume.pdf",
    ai=OpenAIOptions(
        api_key="sk-...",
        model="gpt-4o-mini",
    ),
)
```

AI populates fields the manual parser cannot infer from raw text:
`current_designation`, `experience.years/months`, `skill_categories`,
`preferred_roles`, `preferred_cities`, `education.specialization`,
`job_types`, `work_modes`, and `open_to_relocation`.

## Development

```bash
pip install -e ".[test]"
pytest
```

Do not commit API keys or PyPI credentials.
