Skip to main content

Python bindings for HWP/HWPX document parser

Project description

hwpx

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 hwpx

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

# Or parse from bytes
with open("document.hwpx", "rb") as f:
    doc = hwpx.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. hwpx.parse_file() rejects source files larger than 512 MiB before reading them into memory; callers that use hwpx.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.0.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.0-cp38-abi3-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.8+Windows x86-64

hwpxkit-0.2.0-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.0-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.0-cp38-abi3-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

hwpxkit-0.2.0-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.0.tar.gz.

File metadata

  • Download URL: hwpxkit-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 3a7072881a06ca6e218bfd67672e9dc1ae2c2bb8f432dc52e40ed4558be37213
MD5 8a33ad945894ebd1cc4e21d89680f96d
BLAKE2b-256 fddd35f3a063b1ad495911307863fe7f283942ff8a3f5e6f12cfa7d3c5efe0fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for hwpxkit-0.2.0.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.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: hwpxkit-0.2.0-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.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 18a4b1b9ec8d1c16cec203e5671b4b4b7e4f28c2e44fe25d0df34004e10c54e1
MD5 0a8c0e8f31fecf86cd27c2a2212afd6f
BLAKE2b-256 a7dae2c0cd73499eb049d22ef74367c59b823476a2d0abaff059a9b93d6c4848

See more details on using hashes here.

Provenance

The following attestation bundles were made for hwpxkit-0.2.0-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.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hwpxkit-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d568c72eaca57aadb098617953cafc9196bfe3a6606c9eb4e5127811195f5456
MD5 9ec0c9aeeccf2e963d1696a4516aeca9
BLAKE2b-256 e42934cd91ab43ac87e6271951ba8031132d706d74260c315a42209ce5f00a92

See more details on using hashes here.

Provenance

The following attestation bundles were made for hwpxkit-0.2.0-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.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for hwpxkit-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8e143c5585d78b4dbf24ab3a91f3b9bcfc7760278376c68264dbfa1ab7a790e4
MD5 2264bd3046333d007b2aa46920ef2509
BLAKE2b-256 51d55378dabd75c847d8b45c7300c386e0debe6faeba7ef6d8b8ecbae0d720c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for hwpxkit-0.2.0-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.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hwpxkit-0.2.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 26f697b9941e2c8e62c49e902b183f5992624b08e0bd1ec22c91f05660d978bf
MD5 720a5dc95be8fdeeac5880900139994a
BLAKE2b-256 7908a1c91130fdc68395f7fdcf4e6c2948b2acf5d5e716c625ce91973f6e007a

See more details on using hashes here.

Provenance

The following attestation bundles were made for hwpxkit-0.2.0-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.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for hwpxkit-0.2.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 46a9487f44dbe32e8fe0703a6a6d87e7250bf52d2f754aae312efd8f6fc094c8
MD5 c305fd4c958bc2b7f894677109b79cd3
BLAKE2b-256 92e2958b3a3fe2fc829a35f20bc477184c324d435bd592e3b1d76aa8b1e2cdb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for hwpxkit-0.2.0-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