Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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.0a2

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.0a2
File Size Uploaded Provenance
ezhpgl-0.1.0a2.tar.gz 117.0 kB With provenance Details

Built distributions (wheels)

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

Total release size: 2.5 MB

Release files / ezhpgl-0.1.0a2.tar.gz

Download URL ezhpgl-0.1.0a2.tar.gz
Size 117.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7dffbd88a3eb9722f2f08034b616537fa8445077661a249eda05b6b363ae0f6c
BLAKE2b-256 checksum
How to use checksums
3f6759063ba12a74d4281859010906cc8525888f0d2abea08c81f602fa3c6f8d
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 Oct 19, 2026.

Transparency log

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

Download URL ezhpgl-0.1.0a2-cp310-abi3-win_amd64.whl
Size 381.0 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
ff7b920120a74917603f90bd9bb0f674ae0d47701abe0e1341c9054875e598e4
BLAKE2b-256 checksum
How to use checksums
6938877383bf7f7b032e94f5dbc3ef35ae25a0f2972f754eb4c872341f6b1c2a
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 Oct 19, 2026.

Transparency log

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

Download URL ezhpgl-0.1.0a2-cp310-abi3-manylinux_2_28_x86_64.whl
Size 543.9 kB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
9d929f463fe3154f92f13606c192de94b45becff8992fcc67ee93b9b128fafe2
BLAKE2b-256 checksum
How to use checksums
af9d6f9aad4c39594e4da7e7b5952c49365673f9def2bca61ad8d7bbf19d47b7
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 Oct 19, 2026.

Transparency log

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

Download URL ezhpgl-0.1.0a2-cp310-abi3-manylinux_2_28_aarch64.whl
Size 537.5 kB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
e02a71a1ea971f3f01a98ee7e0f23230f7f457d574358df244a068c8f9da7778
BLAKE2b-256 checksum
How to use checksums
057baf11f58acd28dc8206649bf86122f266d9727b00e92acda41a4612019160
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 Oct 19, 2026.

Transparency log

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

Download URL ezhpgl-0.1.0a2-cp310-abi3-macosx_11_0_arm64.whl
Size 484.4 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8e53d6498cc67912dc2c9646778ad7d59ea35a5e76b03ff01c83b1917c6742bc
BLAKE2b-256 checksum
How to use checksums
d85a2e7994712039431b333987490cd9d79c0eb236ab64ec9faf21313ffdd924
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 Oct 19, 2026.

Transparency log

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

Download URL ezhpgl-0.1.0a2-cp310-abi3-macosx_10_12_x86_64.whl
Size 482.7 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ea86b19e033554d327b4c1abe32bfa086a7611426347eb95a37059dd203dae8c
BLAKE2b-256 checksum
How to use checksums
1a2b421f439957230e1a15d0f0b850a83850da35ae335177af2f39e2921aef6b
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 Oct 19, 2026.

Transparency log

Security for ezhpgl 0.1.0a2

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.0a2.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 Oct 19, 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.

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