Skip to main content

A minimal Python wrapper around the PAGE-XML format for OCR output

Project description

pygexml

A minimal Python wrapper around the PAGE-XML format for OCR output.

pygexml checks, tests and docs API docs online

Installation

pip install pygexml

Requires Python 3.12+.

Usage

from pygexml import Page

page = Page.from_xml_string(xml_string)

for line in page.all_text():
    print(line)

All dataclasses are serializable with to_dict/from_dict and to_json/from_json via dataclasses-json.

Data model

Class Import from
Page pygexml
Page, TextRegion, TextLine, Coords pygexml.page
Point, Box, Polygon pygexml.geometry

Page, TextRegion and TextLine each expose all_text() and all_words() iterators. Lookups by ID are available via lookup_region() and lookup_textline().

Refer to the online API docs for details.

Hypothesis strategies

The pygexml.strategies module provides Hypothesis strategies for all pygexml types, ready to use in property-based tests - including downstream projects:

from hypothesis import given
from pygexml.strategies import st_pages

@given(st_pages())
def test_my_page_processing(page):
    assert process(page) is not None

Refer to the pygexml.strategies API docs for details.

Development

pip install ".[dev,test,docs]"

black pygexml test          # format
mypy pygexml test           # type check
pyright pygexml test        # type check
pytest -v                   # tests
pdoc -o .api_docs pygexml/* # API docs

CI runs on Python 3.12, 3.13 and 3.14. API documentation is published to GitHub Pages on every push to main.

Contributing

Bug reports, feature requests and pull requests are welcome. Feel free to open draft pull requests early to invite discussion and collaboration.

Please note that this project has a Code of Conduct.

Copyright and License

Copyright (c) 2026 Mirko Westermeier (SCDH, University of Münster)

Released under the MIT License.

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

pygexml-0.1.3.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygexml-0.1.3-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file pygexml-0.1.3.tar.gz.

File metadata

  • Download URL: pygexml-0.1.3.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pygexml-0.1.3.tar.gz
Algorithm Hash digest
SHA256 24808ffef4c47487a1114cd695cac04a947c910e4381e86fcbb3193783a0f81a
MD5 17d86c7059dd00ba8896be1a4f9e48be
BLAKE2b-256 b7f1ba42685b7d0637c1f60a8f6a83755ca7cde443470543b9964d4685eadae9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygexml-0.1.3.tar.gz:

Publisher: publish.yml on SCDH/pygexml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygexml-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pygexml-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pygexml-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b5c50886a1f86a6992b923f5858585ace86ac5d4a322b5c1e80c2fd402bad7fe
MD5 2ae9784a08dcbb0c6a768b5c2af5a6cc
BLAKE2b-256 a6a3b9e0cffa4d4bb40c7f5d85ebfe8a82e1e0be08c1ab3f3e41e1b289fd3198

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygexml-0.1.3-py3-none-any.whl:

Publisher: publish.yml on SCDH/pygexml

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