No project description provided
Project description
Peafowl Dox
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
- Quick Start
- API Reference - Image Upload Processing - PDF Conversion - Image Resizing - Image Preprocessing - Document Processor Class - OneDrive & SharePoint Integration
- Error Handling
- Dependencies
- Changelog
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_ocrtopreprocess_image - Renamed
ImageProcessortoDocumentProcessor
[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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file peafowl_dox-0.3.3.tar.gz.
File metadata
- Download URL: peafowl_dox-0.3.3.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8635ae5a7d004bc01bf58200b2c51fbc77e0b9c41847334620cbf5a8bb4ab5e0
|
|
| MD5 |
0754c5611896e84cf4004c5c440b8845
|
|
| BLAKE2b-256 |
bf1a3ee244a35d2c7852cdbb9a1112a93fadda75eb04ebb383bc8fa675794a78
|
File details
Details for the file peafowl_dox-0.3.3-py3-none-any.whl.
File metadata
- Download URL: peafowl_dox-0.3.3-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed5f4929f866b0f57a6f1f1d60acd9d97ae8fa5c0d3724be097dc6c4266e3e74
|
|
| MD5 |
adbde0f0f094400d778b854e97da8cfb
|
|
| BLAKE2b-256 |
6ae2621bb5bdc1c7d48709e2614a8c81b53a709db4cf23e8d54b1e576106da89
|