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.

  • Automatic PS plot sizing and several device-control commands are unsupported. Supplying a profile does not make an unsupported command executable.
  • 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.0a1

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

Built distributions (wheels)

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

Total release size: 2.0 MB

Release files / ezhpgl-0.1.0a1.tar.gz

Download URL ezhpgl-0.1.0a1.tar.gz
Size 114.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3a0685d761b9ef8fecd819397aab6dbb2dd456a8421b6502217a17c71b5b91eb
BLAKE2b-256 checksum
How to use checksums
3e6286491d4e57fe7d790801330d85f0afe8584faef203e8ab84b6c557c99f43
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.0a1-cp310-abi3-win_amd64.whl

Download URL ezhpgl-0.1.0a1-cp310-abi3-win_amd64.whl
Size 381.1 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
764c961d122fdca29ba63fcc2f512f094eeeaa53e711b13fe2f67a3a592f93a4
BLAKE2b-256 checksum
How to use checksums
1cb2aa01c15fcb3758c121e20430ee41407cefd8ddb7e7fb4497e8f499aeb46d
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.0a1-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL ezhpgl-0.1.0a1-cp310-abi3-manylinux_2_28_x86_64.whl
Size 544.0 kB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
4aacd2dbcc74ed61d5600024bf938ca24474cfdede76606ad99940a270128bad
BLAKE2b-256 checksum
How to use checksums
97f10ece35b50861761ac61ffa673c60cb96864ea399e169f882e06d9a6953be
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.0a1-cp310-abi3-macosx_11_0_arm64.whl

Download URL ezhpgl-0.1.0a1-cp310-abi3-macosx_11_0_arm64.whl
Size 484.6 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
61b8fb9e5222f5c40a59a41e42b5680c72c1c6e45c0d35d8d3c4aa68a507bd01
BLAKE2b-256 checksum
How to use checksums
e3087642cfc20ae78944af790123567ed49df93b35a1357211f430ea99e0560b
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.0a1-cp310-abi3-macosx_10_12_x86_64.whl

Download URL ezhpgl-0.1.0a1-cp310-abi3-macosx_10_12_x86_64.whl
Size 482.2 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
28d2c0217a858c1edc5a7a6c2120fb7ab069901be606887ed3c90812d3900147
BLAKE2b-256 checksum
How to use checksums
9aab065ebf3b7b763982fa3f9ceaf8285e31197e816dfec49f6aed86d5066cc7
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.0a1

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 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for ezhpgl-0.1.0a1.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