Skip to main content

Python binding to Java Archery Framework

Project description

PyArchery

License: GPL v3 Servier Inspired

PyArchery is a Python binding for the Java Archery Framework, enabling powerful semi-structured document processing directly from Python. It leverages JPype to bridge Python and Java, providing seamless access to Archery's intelligent extraction, layout analysis, and tag classification capabilities.

Description

In today's data-driven landscape, navigating the complexities of semi-structured documents poses a significant challenge. PyArchery brings the robust capabilities of the Archery framework to the Python ecosystem.

By leveraging innovative algorithms and machine learning techniques, Archery offers a solution that gives you control over the data extraction process with tweakable and repeatable settings. It automates the extraction process, saving time and minimizing errors, making it ideal for industries dealing with large volumes of documents.

Key features include:

  • Intelligent Extraction: Automatically extract structured data from documents.
  • Layout Analysis: Understand the physical layout of document elements.
  • Tag Classification: Classify document tags using customizable styles (Snake case, Camel case, etc.).
  • Java Integration: Direct access to the underlying Java Archery API for advanced usage.

Getting Started

Prerequisites

  • Java Development Kit (JDK): Version 21 or higher is required.
  • Python: Version 3.11 or higher.

Installation

Install PyArchery using pip:

pip install pyjarchery

Quick Start

Here's a simple example of how to use PyArchery to open a document and extract data from tables:

import pyarchery

# Path to your document
file_path = "path/to/your/document.pdf"

# Load the document with intelligent extraction hints
# This returns a DocumentWrapper
with pyarchery.load(
    file_path,
    hints=[pyarchery.INTELLI_EXTRACT, pyarchery.INTELLI_LAYOUT]
) as doc:
    # Access sheets using the pythonic wrapper property
    for sheet in doc.sheets:
        # Check if sheet has a table
        if sheet.table:
            table = sheet.table
            # Convert to python dictionary
            data = table.to_pydict()
            print(f"Extracted data from table: {data.keys()}")

Documentation

For comprehensive documentation, tutorials, and API references, please visit:

Configuration

You can tune runtime behavior via environment variables:

  • PYARCHERY_MAVEN_URL / PYARCHERY_MAVEN_SNAPSHOT_URL: Override Maven base URLs for downloading Java dependencies.
  • PYARCHERY_JARS_HOME: Directory where downloaded JARs are cached (default is inside the package). Useful to share a cache across virtual environments or reduce wheel size by keeping jars out of the wheel.
  • PYARCHERY_SKIP_JVM_START: Set to 1 to skip JVM startup (for dry runs or environments where Java is managed externally).
  • PYARCHERY_REQUIRE_CHECKSUMS: Set to 1 to enforce checksum verification of downloaded JARs (fails if checksum file is missing or mismatched).
  • PYARCHERY_FETCH_ALL_NATIVE: Set to 1 to download all native classifiers instead of filtering by the current platform.

Wheel slimming

The default build excludes bundled JARs; on first use PyArchery downloads only the platform-matching artifacts. To avoid repeated downloads across projects or CI runs, set PYARCHERY_JARS_HOME to a shared cache directory. If you need a “fat” wheel that includes JARs, consider providing a separate distribution or optional extra that re-enables JAR bundling, while keeping the default wheel lightweight.

Contribute

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Authors

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

pyjarchery-0.1.15.tar.gz (136.7 kB view details)

Uploaded Source

Built Distribution

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

pyjarchery-0.1.15-py3-none-any.whl (138.1 kB view details)

Uploaded Python 3

File details

Details for the file pyjarchery-0.1.15.tar.gz.

File metadata

  • Download URL: pyjarchery-0.1.15.tar.gz
  • Upload date:
  • Size: 136.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.4

File hashes

Hashes for pyjarchery-0.1.15.tar.gz
Algorithm Hash digest
SHA256 0e90c4fe8b5087e733cc5a4c2db2cce3aaedcd5b992d417053ceda53a49ecad3
MD5 980d1a16c81a5f84f81f4c30d21a07c7
BLAKE2b-256 674db061db077d6eda5bfa1930580dee21b0320c5d8b9b30c88706630cb6529a

See more details on using hashes here.

File details

Details for the file pyjarchery-0.1.15-py3-none-any.whl.

File metadata

  • Download URL: pyjarchery-0.1.15-py3-none-any.whl
  • Upload date:
  • Size: 138.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.4

File hashes

Hashes for pyjarchery-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 547d15ff6a5edf5f38262745b142b8c27d1cd5e452d9e8c17fd873255fd17f04
MD5 a28cbb79f63745bf6d7291ca4f871000
BLAKE2b-256 55cb8b919b2d629ed43a2e5253ccd6d9aa1d01d48623d138972a4869cfcc860e

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