Skip to main content

ezhpgl

A Rust-backed HP-GL and HP-GL/2 parser for Python. Read plot files, inspect their geometry and source commands, and export JSON or SVG.

  • Lines, encoded polylines, arcs, ellipses, Bézier curves, polygons and hatch fills.
  • Pen attributes, coordinate transforms, clipping and separate plot pages.
  • Labels with original bytes, placement information and substitute-font previews.
  • A documented subset of PCL/PJL containers, with diagnostics for omitted content.
  • Read-only Python objects, source byte ranges and configurable resource limits.

Installation

Requires CPython 3.10 or newer. This is an alpha release:

python -m pip install --pre ezhpgl

Conventional GIL-enabled CPython is supported. Building from source requires Rust 1.85 or newer and maturin; see development.

Quick start

import ezhpgl

plot = ezhpgl.parse(b"IN;SP1;PA0,0;PD1600,0,1600,800,0,800,0,0;PU;")
print(plot.completeness, plot.stats())
plot.write_svg("drawing.svg")
plot.write_json("drawing.json")

# Or read a file:
# plot = ezhpgl.readfile("drawing.plt")
for page in plot.pages:
    for operation in page.operations:
        print(operation.geometry.kind, operation.style.pen, operation.source.span)

Coordinates are physical millimetres, with Y pointing up. The generic profile uses 40 plotter units per millimetre. Paper size and plot extents are unknown unless supplied explicitly:

profile = ezhpgl.DeviceProfile(plot_size_mm=(200, 100), paper_size_mm=(210, 297))
plot = ezhpgl.readfile("drawing.plt", profile=profile)

plot_size_mm supplies the hard clipping rectangle and default scaling points. paper_size_mm is separate metadata. Nonzero RO and percentage IR need known plot extents. See profile rules.

Command line

ezhpgl inspect drawing.hpgl
ezhpgl commands drawing.hpgl --tolerant
ezhpgl export drawing.plt --format svg --page 1 -o drawing.svg
ezhpgl export drawing.plt --format json -o drawing.json

export interprets geometry and supported containers. inspect and commands inspect standalone command syntax. Exit codes are 0 for complete, 2 for a partial result, and 1 for an error. See CLI options.

Supported scope and limitations

The parser uses an explicit generic plotter profile. It does not emulate every printer or recover the original CAD layers, dimensions or model scale.

  • PS sets the plot extents; the larger value is the X extent (length), as on HP devices, and one argument means square extents in this device-independent profile. Device-control commands are accepted without effect; fill anchors, user line types, tick marks and HP-GL/1 character sets are ignored with the nonfatal IGNORED_COMMAND diagnostic.
  • Text previews use substitute fonts. Native fonts, Japanese/multibyte labels, and downloaded fonts are unsupported.
  • PCL/PJL support is limited. Supported raster blocks are omitted with diagnostics; HP RTL image decoding and full printer emulation are unsupported.
  • Unsupported commands raise in strict mode. With strict=False, interpretation stops at the first uncertain command and returns the valid prefix as partial.
  • Known text approximations and omissions can also produce partial in strict mode while interpretation continues. Inspect diagnostic codes and actions.
  • A .plt extension does not establish the file format. Raw lexical completeness does not imply that all commands can be interpreted or rendered.

See the support matrix for command-level coverage.

Documentation

License

MIT. The parser is independently implemented in Rust with PyO3 bindings.

Metadata

Release files for ezhpgl 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ezhpgl 0.1.0
File Size Uploaded Provenance Actions
ezhpgl-0.1.0.tar.gz 118.5 kB With provenance Details for ezhpgl-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ezhpgl 0.1.0
File Actions
ezhpgl-0.1.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for ezhpgl-0.1.0-cp310-abi3-win_amd64.whl
ezhpgl-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for ezhpgl-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl
ezhpgl-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for ezhpgl-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl
ezhpgl-0.1.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for ezhpgl-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
ezhpgl-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for ezhpgl-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 2.6 MB

Release files / ezhpgl-0.1.0.tar.gz

Download URL ezhpgl-0.1.0.tar.gz
Size 118.5 kB
Tags Source
SHA-256 checksum
How to use checksums
231f9f91ddeba513f1858eb9492c36e1183515df711d25237d9f1817cf26c576
BLAKE2b-256 checksum
How to use checksums
e2cf8fc720b63d9d87371571b4cba4fe8894547b306d52f5e3a583bc7c3094eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / ezhpgl-0.1.0-cp310-abi3-win_amd64.whl

Download URL ezhpgl-0.1.0-cp310-abi3-win_amd64.whl
Size 381.3 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
6d2e553edf9d9073b2fb122e36b08f5ffe8df6aa3a283d0817704d7006ee8aa1
BLAKE2b-256 checksum
How to use checksums
f3178b1ef5045064815576e8bc643d5383751f475f3e3c68452b69b8834f8b97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / ezhpgl-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL ezhpgl-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl
Size 545.0 kB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
8623963a377274b1486da05d9a7622c3a5144c0c34c7cbd40053ec777e1c24dc
BLAKE2b-256 checksum
How to use checksums
4f5f36753200396c6528b705e5f28e2668b1f4e37575ce44ef191329d07440e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / ezhpgl-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL ezhpgl-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl
Size 539.2 kB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
7097132432d03a065c727dbdabe113435351a9307f05131cac353b8293b337b5
BLAKE2b-256 checksum
How to use checksums
93947580f770279ad3998e08214902a0984c1f5c6acfc3307940ab946ab8f2cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / ezhpgl-0.1.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL ezhpgl-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Size 486.0 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
be9a4b4aa73c2a9a51189cf16959fe78bdb0c5adcb8910dece302576eb6859ba
BLAKE2b-256 checksum
How to use checksums
43ce5524c498efec4a5302f37a425eb982b61b6019ef70242ea6e190768c903a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / ezhpgl-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL ezhpgl-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 482.8 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
73450a62084f61f5a5998ec5e5ccec2fbe86f6d691c4affc0ec1da0c1afdf87a
BLAKE2b-256 checksum
How to use checksums
d6446450451b7b4dd02f07909885b283969f551f200a944328f96757b9fba151
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for ezhpgl 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for ezhpgl-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page