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. Pen 0 draws nothing unless the profile sets pen_zero_draws=True, for streams written for a cutter, a single-pen plotter or a raster device. 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. The device-control escapes of serial plotters (ESC .(, ESC .), handshake setup) are recognized and have no effect.
  • Unsupported commands raise in strict mode. With strict=False, interpretation stops at the first uncertain command and returns the valid prefix as partial. Two cases are passed over with a diagnostic instead: an unknown command with numeric parameters, and SD/AD font attributes outside the text profile.
  • 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.1

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.1
File Size Uploaded Provenance Actions
ezhpgl-0.1.1.tar.gz 126.9 kB With provenance Details for ezhpgl-0.1.1.tar.gz

Built distributions (wheels)

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

Total release size: 2.6 MB

Release files / ezhpgl-0.1.1.tar.gz

Download URL ezhpgl-0.1.1.tar.gz
Size 126.9 kB
Tags Source
SHA-256 checksum
How to use checksums
daf4d1cb02f7244a2ba5fe3cfe324fede785ca7f383fe462ab66a30353104815
BLAKE2b-256 checksum
How to use checksums
ea996b084ad9963f8260849e7a316771d97ebd48ecaf36a5c572e41d77f6289e
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 28, 2026.

Transparency log

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

Download URL ezhpgl-0.1.1-cp310-abi3-win_amd64.whl
Size 384.7 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
9e0eaeb0c65515d80c117f3319eb43ecae8499143a49e66f045ed274070523e8
BLAKE2b-256 checksum
How to use checksums
09f83189a6cdd6f378276170198b25ca883353c894bfd588c28ff8a868fde404
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 28, 2026.

Transparency log

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

Download URL ezhpgl-0.1.1-cp310-abi3-manylinux_2_28_x86_64.whl
Size 548.6 kB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
282c9e787f422f3e74765dae1a74a337cbb4e3c0997d4bafb782fa73b2f0e7a3
BLAKE2b-256 checksum
How to use checksums
2523a57e3fbf4be35b7d8c3a52741f910b6533112eb00d65dca3b6b79ef6e2c4
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 28, 2026.

Transparency log

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

Download URL ezhpgl-0.1.1-cp310-abi3-manylinux_2_28_aarch64.whl
Size 541.7 kB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
262191b9b780bbf48e51c21aba5a316cf9dcff639800e9c56c2207d21e166d70
BLAKE2b-256 checksum
How to use checksums
8c8853e4a9b8c306895ee06f23c39765e4f502a7af81a64fdbbdd32b48a0d086
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 28, 2026.

Transparency log

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

Download URL ezhpgl-0.1.1-cp310-abi3-macosx_11_0_arm64.whl
Size 490.4 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b0a56116483bdda1b47ffb01c919ddd6030118bebbcd8158bbd1a07af349a3c8
BLAKE2b-256 checksum
How to use checksums
34b9d5550cc57a41561749d70e41429c23ff31e78c662a13b1a405706481acb3
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 28, 2026.

Transparency log

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

Download URL ezhpgl-0.1.1-cp310-abi3-macosx_10_12_x86_64.whl
Size 485.2 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
d9849ffd2b4b73a28a5552e71724f6cea459b37c8f51b80846b36b2648e52dcb
BLAKE2b-256 checksum
How to use checksums
5665708b9d4637a3999fb74a3c2771b84cd7297017d9aafd5d64b51055c04b03
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 28, 2026.

Transparency log

Security for ezhpgl 0.1.1

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.1.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 28, 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