Skip to main content

No project description provided

Project description

Peafowl Dox

Peafowl Dox Logo

A utility library for image and document processing. Essential tools for handling multipart uploads, PDF conversion, and preparing documents for OCR and ML pipelines.

Table of Contents


Installation

pip install peafowl-dox

Note: Package name uses hyphens for pip, but imports use underscores:

import peafowl_dox  # underscore in import!

Quick Start

from fastapi import UploadFile
from peafowl_dox import multipart_to_array

@app.post("/upload/")
async def upload_image(file: UploadFile):
                image_array = multipart_to_array(file.file)
                print(f"Image shape: {image_array.shape}")
                return {"message": "Image processed successfully"}

API Reference

Image Upload Processing

Convert multipart file uploads to numpy arrays.

from peafowl_dox import multipart_to_array

array = multipart_to_array(file.file)

Returns: np.ndarray with shape (height, width, channels)


PDF Conversion

Convert PDF pages to image arrays.

from peafowl_dox import pdf_to_images

images = pdf_to_images("document.pdf", dpi=150)

Image Resizing

Resize images with aspect ratio preservation.

from peafowl_dox import resize_image
resized = resize_image(image, 1024)

Image Preprocessing

from peafowl_dox import preprocess_image
ocr_ready = preprocess_image(image)

Document Processor Class

from peafowl_dox import DocumentProcessor
processor = DocumentProcessor()
image = processor.process_image("image.jpg")

OneDrive & SharePoint Integration

Manage files in Microsoft OneDrive and SharePoint using Microsoft Graph API.

from peafowl_dox import OneDriveClient

client = OneDriveClient(
                client_id="AZURE_CLIENT_ID",
                client_secret="AZURE_CLIENT_SECRET",
                tenant_id="AZURE_TENANT_ID",
                target_resource_id="SHAREPOINT_SITE_ID_OR_USER_EMAIL",
                is_sharepoint=True
)

Supported features:

  • Upload files (auto-create folders)
  • Download files or folders (recursive)
  • List contents
  • Delete files
  • Safe or recursive folder deletion

Error Handling

from peafowl_dox import (
                PeafowlDoxError,
                ImageProcessingError,
                PDFConversionError,
                OneDriveIntegrationError
)

Dependencies

  • Python >= 3.8
  • numpy >= 2.2.6
  • Pillow >= 11.1.0
  • opencv-python >= 4.8.0
  • PyMuPDF >= 1.23.0
  • O365 >= 2.0.35

Changelog

[0.3.0] - 2025-12-17

  • Added OneDriveClient for Microsoft Graph API integration
  • Added OneDriveIntegrationError to exception handling

[0.2.0] - 2025-11-06

  • Renamed prepare_for_ocr to preprocess_image
  • Renamed ImageProcessor to DocumentProcessor

[0.1.0] - 2025-11-06

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

peafowl_dox-0.3.1.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

peafowl_dox-0.3.1-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file peafowl_dox-0.3.1.tar.gz.

File metadata

  • Download URL: peafowl_dox-0.3.1.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for peafowl_dox-0.3.1.tar.gz
Algorithm Hash digest
SHA256 2ca314199bc91cb1636f5ad51b81cc18daac6da70bf3840b35d3a13c52499f48
MD5 779a0588c927548008636a1a6b3dcb1b
BLAKE2b-256 f80f39aabd8c980e70d3eae5a399e0799518078901b86f21d6f9fa1de076c451

See more details on using hashes here.

File details

Details for the file peafowl_dox-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: peafowl_dox-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for peafowl_dox-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3727d90a83cb3e3d18984b0dae6eedcb6285208ce0ff43769ea9da53d942e891
MD5 9a0092da3a21b9992144a7974c4f996c
BLAKE2b-256 10decaa884c5b06d571509efa23e3dd45c6f3765a5d86324fa2dbf7fd9f70f55

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page