Skip to main content

Python bindings for HWP/HWPX document parser

Project description

hwpxkit

Python bindings for HWP/HWPX document parser.

The package is backed by Rust and ships CPython 3.8+ abi3 wheels. CPU-bound parse and conversion APIs release the Python GIL while Rust code is running.

Installation

pip install hwpxkit

Or install from source:

# Install maturin first
pip install maturin

# Build and install
cd packages/hwpx-python
maturin develop

Build Wheel

cd packages/hwpx-python

# Using uv (recommended). Builds a CPython 3.8+ abi3 wheel.
uv tool run maturin build --release --locked --compatibility pypi --out dist

# Or using maturin directly
maturin build --release --locked --compatibility pypi --out dist

The built wheel will be in the dist/ directory.

Usage

Parse a document

import hwpxkit

# Parse from file path
doc = hwpxkit.parse_file("document.hwpx")

# Or parse from bytes
with open("document.hwpx", "rb") as f:
    doc = hwpxkit.parse(f.read())

Convert to Markdown

# Basic conversion
markdown = doc.to_markdown()
print(markdown)

# With options
markdown = doc.to_markdown(
    use_html=True,           # Use HTML tags for tables, etc.
    include_version=True,    # Include document version
    image_output_dir="./images"  # Save images to directory
)

Convert to HTML

html = doc.to_html()

# Save images to directory instead of base64
html = doc.to_html(image_output_dir="./images")

Get plain text

text = doc.get_text()
print(text)

Convert to JSON

json_str = doc.to_json()
print(json_str)

Parser diagnostics

report = doc.diagnostic_report()
print(report["summary"])
for item in report["items"]:
    print(item["severity"], item["category"], item["message"])

doc.warnings remains available for string compatibility.

Working with untrusted documents

HWP/HWPX input is treated as untrusted. The Rust parser enforces HWPX ZIP, XML, and section resource limits and returns structured diagnostics for unsupported or lossy content. hwpxkit.parse_file() rejects source files larger than 512 MiB before reading them into memory; callers that use hwpxkit.parse(bytes) are responsible for bounding the bytes they pass in. See the repository security model for details.

Document properties

# Get document version
print(doc.version)  # e.g., "5.1.0.1"

# Get number of sections
print(doc.section_count)

Supported Formats

  • HWP 5.0: Binary format (Hangul Word Processor)
  • HWPX: XML-based format (OWPML standard)

License

MIT

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

hwpxkit-0.2.1.tar.gz (13.3 MB view details)

Uploaded Source

Built Distributions

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

hwpxkit-0.2.1-cp38-abi3-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.8+Windows x86-64

hwpxkit-0.2.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

hwpxkit-0.2.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

hwpxkit-0.2.1-cp38-abi3-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

hwpxkit-0.2.1-cp38-abi3-macosx_10_12_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file hwpxkit-0.2.1.tar.gz.

File metadata

  • Download URL: hwpxkit-0.2.1.tar.gz
  • Upload date:
  • Size: 13.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hwpxkit-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e8231e24e56eaab07954fd215147420fca36ab7227ca4fdd7c77d98a9a49c0a2
MD5 299f4460873a40940d3d5693be6c1a2c
BLAKE2b-256 d8c9fef5b90b1036b86e3176c0cbab85f4ab6e37ff9f9592d66a20a741c44bcb

See more details on using hashes here.

Provenance

The following attestation bundles were made for hwpxkit-0.2.1.tar.gz:

Publisher: build-wheels.yml on Han-taz/hwpx-rust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hwpxkit-0.2.1-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: hwpxkit-0.2.1-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hwpxkit-0.2.1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a9a38d86e440950827297925e8772f93a0ff72536027f16b43de6abbfa23ad1c
MD5 aff486653cc485a10828c0ff081a4ab0
BLAKE2b-256 7438a1cd23b26b1397716096fd2fee171c15152c73d3e878ccf6d6f183e5eb17

See more details on using hashes here.

Provenance

The following attestation bundles were made for hwpxkit-0.2.1-cp38-abi3-win_amd64.whl:

Publisher: build-wheels.yml on Han-taz/hwpx-rust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hwpxkit-0.2.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hwpxkit-0.2.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2ec0d80e6ec855b1afc0418ebfc294327f1ca1b4c5267a67511cc30ce1dea00e
MD5 eca3da8bfbcd615498d4264a136e3fc6
BLAKE2b-256 b025e314002536bd02ad759427cfe033055583571f3805c039abad758f1f512d

See more details on using hashes here.

Provenance

The following attestation bundles were made for hwpxkit-0.2.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build-wheels.yml on Han-taz/hwpx-rust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hwpxkit-0.2.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for hwpxkit-0.2.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5b4e369656c5d11051a71be8d95bd558f78e4a1ea68710677e45251468c58a55
MD5 cda4499bb7db959b31a5ebf74801597c
BLAKE2b-256 fb7393172a6115e945c608ece940b6c3dd5c14d32eb67547e2fa207f3248c035

See more details on using hashes here.

Provenance

The following attestation bundles were made for hwpxkit-0.2.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: build-wheels.yml on Han-taz/hwpx-rust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hwpxkit-0.2.1-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hwpxkit-0.2.1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f09536f52ab44ab08513fe1a00baa685e29f3794cf92be1348c7feb42da3b326
MD5 e9186b0ba0c4e3ad95fecb00ab0e9635
BLAKE2b-256 03b31be305a64c4bb5ff1c7e3c0f9a5b23ba5808540bca5be7535eb934009b4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for hwpxkit-0.2.1-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: build-wheels.yml on Han-taz/hwpx-rust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hwpxkit-0.2.1-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for hwpxkit-0.2.1-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 abf07ba2877f3b6b14258a6d2011cacbe996a404aa62294a4b971d0d3341899e
MD5 c2f461a1113c9e4751f4ad6c4a551e9d
BLAKE2b-256 96c30aa4adc51d66179630c10cb42a9c5ffae1fa10c33b7414b56d595cf5b500

See more details on using hashes here.

Provenance

The following attestation bundles were made for hwpxkit-0.2.1-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: build-wheels.yml on Han-taz/hwpx-rust

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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