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.2.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.2-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for peafowl_dox-0.3.2.tar.gz
Algorithm Hash digest
SHA256 047e506b79bb6096847d9f48504a3fd214916e1c54d024cf763e7ad122eacfe9
MD5 7604d1485920b163bea8c7e504ccbea5
BLAKE2b-256 9e85ae222bebe8dd50fd8b277a592578d68a3e16f81185280313ce969fc481a8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for peafowl_dox-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0ff2cb280b9f61bdab162e18ce97c10c32e45f180a3ecb441d62e3cf96bb7b0d
MD5 054897deed0508d1ba403554ed1ef42e
BLAKE2b-256 5ae30e345ca7fae60ee5615e9649327cc088f0b51908ac9a50598959d6f80eb5

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