Glypho for Python
Fast multilingual OCR for Python with a bundled native runtime.
Local-first, Python 3.10+, and powered by the same Rust + ONNX Runtime engine as Glypho for Rust and Node.js.
Glypho's Python package calls the bundled native Rust library directly through a stable C ABI. It does not start a new OCR subprocess for every image, so ONNX Runtime sessions and loaded models can stay warm inside the Python process.
No OCR cloud account, API key, Rust toolchain or separately installed libglypho is required when a prebuilt wheel is available for your platform.
📦 Install
pip install glypho-ocr
The package name is glypho-ocr; import it as glypho:
from glypho import Glypho
Prebuilt wheels for 0.2.0 are published for:
| OS | Architectures |
|---|---|
| Linux | x64, ARM64 |
| macOS | Apple Silicon (ARM64) |
| Windows | x64, ARM64 |
Intel macOS is not included in the 0.2.0 prebuilt-wheel matrix. On targets without a matching wheel, pip may fall back to the source distribution, which requires Rust/Cargo and is not covered by the prebuilt release matrix.
🚀 Quick start
from glypho import Glypho
ocr = Glypho(
quality="balanced",
device="auto",
)
document = ocr.recognize("screenshot.png")
print(document.text)
Leaving languages empty enables automatic native routing. If you already know what to expect, pass language hints:
ocr = Glypho(
languages=("en", "ja"),
quality="accurate",
)
document = ocr.recognize("mixed.png")
Common BCP-47-style values such as cs-CZ, de-DE, ko-KR, zh-Hans, jpn and rus are normalized automatically.
Encoded bytes, Pillow images and NumPy arrays can be recognized in memory through the same persistent native runtime:
document = ocr.recognize(image_bytes, file_name="capture.png")
document = ocr.recognize(pillow_image, file_name="capture.png")
document = ocr.recognize(rgb_array, file_name="frame.png")
Pillow remains optional and is only needed for Pillow/NumPy inputs.
⚙️ Options
ocr = Glypho(
quality="balanced", # fast | balanced | accurate | maximum
device="auto", # auto | cpu | cuda | coreml | openvino
languages=(), # () = automatic routing
threads=None,
offline=False,
models=None,
)
Per-request options can override the defaults:
document = ocr.recognize(
"image.png",
languages=["en", "ru"],
segmentation="sparse_text",
min_confidence=0.8,
timeout=30.0,
)
Segmentation modes:
auto | single_block | single_line | sparse_text
🎯 Quality profiles
| Profile | Detector | Primary recognizer | Use case |
|---|---|---|---|
fast |
PP-OCRv6 Tiny | PP-OCRv6 Tiny | minimum latency |
balanced |
PP-OCRv6 Small | PP-OCRv6 Small | default OCR |
accurate |
PP-OCRv6 Small | PP-OCRv6 Small | smaller / harder text |
maximum |
PP-OCRv6 Medium | PP-OCRv6 Medium | accuracy-first workloads |
Glypho exposes 55 canonical language identifiers across Latin, Eastern Slavic, Chinese, Japanese and Korean routes.
🔥 Warm sessions
Independent detector and recognizer sessions initialize concurrently and remain resident for later calls.
For repeated OCR, create one Glypho instance and warm it before processing requests:
from glypho import Glypho
ocr = Glypho(languages=("en", "cs"))
ocr.warmup()
first = ocr.recognize("first.png")
second = ocr.recognize("second.png")
print(first.text)
print(second.text)
You can also warm the complete decode → detect → recognize path with a representative image:
ocr.warmup(sample="sample.png", languages=["en"])
info() reports the configured and resolved runtime/device information:
print(ocr.info())
📐 Structured results
recognize() returns an immutable Document, not just a string:
document = ocr.recognize("image.png")
print(document.text)
for line in document.lines:
print(line.text)
print(line.confidence)
print(line.language, line.script)
print([(point.x, point.y) for point in line.quad.points])
Useful fields include:
document.text— ordered plain text;document.lines— detected text lines;line.quad.points— source-image quadrilateral coordinates;line.confidence— recognition confidence;line.language/line.script— routed metadata when known;line.alternatives— rejected candidate when available;document.to_dict()— complete JSON-compatible result.
⚡ Hardware acceleration
Available device targets are:
auto | cpu | cuda | coreml | openvino
Provider availability depends on the wheel, platform and host runtime. device="auto" probes available accelerators and falls back to CPU when necessary; info() exposes the resolved device and fallback information.
The 0.2.0 release builds are CUDA-aware on Linux/Windows x64 and CoreML-aware on macOS Apple Silicon. CPU remains the fallback path.
🧩 CLI
The Python wheel also installs the native glypho executable:
glypho screenshot.png \
--language en,ja \
--quality balanced \
--device auto
Runtime information:
glypho info --pretty
JSON output:
glypho screenshot.png --format json --output result.json
💾 Models and offline mode
Missing model files are downloaded from pinned revisions, verified with SHA-256 and cached under:
~/.glypho-ocr/models
Use another location with GLYPHO_HOME, GLYPHO_MODELS or the models argument.
To prohibit model downloads completely:
ocr = Glypho(offline=True)
🔒 Local-first
OCR inference runs locally. Glypho does not upload input images to an OCR API.
The only network access normally needed is the first model download. Once the required models are cached, recognition can run offline.
Python guide: docs/PYTHON.md
Full project: github.com/rinqaku/Glypho
Web preview: glypho.kaneki.cz
Rust package: crates.io/crates/glypho-ocr
Node.js package: npmjs.com/package/glypho-ocr
License: Apache-2.0
Metadata
Release files for glypho-ocr 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| glypho_ocr-0.2.0.tar.gz | 92.2 kB | Without provenance | Details for glypho_ocr-0.2.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| glypho_ocr-0.2.0-py3-none-win_arm64.whl | Python 3 | none | Windows ARM64 | Details for glypho_ocr-0.2.0-py3-none-win_arm64.whl |
| glypho_ocr-0.2.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for glypho_ocr-0.2.0-py3-none-win_amd64.whl |
| glypho_ocr-0.2.0-py3-none-manylinux_2_39_x86_64.whl | Python 3 | none | Linux glibc 2.39+ x86-64 | Details for glypho_ocr-0.2.0-py3-none-manylinux_2_39_x86_64.whl |
| glypho_ocr-0.2.0-py3-none-manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64 | Details for glypho_ocr-0.2.0-py3-none-manylinux_2_28_x86_64.whl |
| glypho_ocr-0.2.0-py3-none-manylinux_2_28_aarch64.whl | Python 3 | none | Linux glibc 2.28+ ARM64 | Details for glypho_ocr-0.2.0-py3-none-manylinux_2_28_aarch64.whl |
| glypho_ocr-0.2.0-py3-none-macosx_14_0_universal2.whl | Python 3 | none | macOS 14.0+ universal2 (ARM64, x86-64) | Details for glypho_ocr-0.2.0-py3-none-macosx_14_0_universal2.whl |
Total release size: 199.4 MB
Release files / glypho_ocr-0.2.0.tar.gz
| Download URL | glypho_ocr-0.2.0.tar.gz |
|---|---|
| Size | 92.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d918432631c62d371cee01f813457004939e57e760a86cc8dcb737e232e307cb
|
|
BLAKE2b-256 checksum How to use checksums |
1350d442267f1ac4a524dda9ae2e16f74c2f1c25517bde5fe4f5a5249c0d6734
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / glypho_ocr-0.2.0-py3-none-win_arm64.whl
| Download URL | glypho_ocr-0.2.0-py3-none-win_arm64.whl |
|---|---|
| Size | 19.2 MB |
| Tags | Python 3 Windows ARM64 |
|
SHA-256 checksum How to use checksums |
73d6f70958a8c7c4a9c48cbfb280dcedca8c38f621a44b9bb647c6b105e57b65
|
|
BLAKE2b-256 checksum How to use checksums |
49101791cdeb9e8bfaa13e552776e4d2a4d8391c789ac1fab21a9bfaf889b866
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / glypho_ocr-0.2.0-py3-none-win_amd64.whl
| Download URL | glypho_ocr-0.2.0-py3-none-win_amd64.whl |
|---|---|
| Size | 55.2 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a51a1157360fc6257301ba7ef8b581dd4e5fb35cb49f26a2ec7154465d6e69c5
|
|
BLAKE2b-256 checksum How to use checksums |
d7cb6c5c475907b45559b10492b30aa9aadbaac73d737424eecdd0ec9ec799ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / glypho_ocr-0.2.0-py3-none-manylinux_2_39_x86_64.whl
| Download URL | glypho_ocr-0.2.0-py3-none-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 59.9 MB |
| Tags | Linux glibc 2.39+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
b089257f5cedeea5cc19091acef99845c16bdecdd61bec79b2f6f79881c3b70d
|
|
BLAKE2b-256 checksum How to use checksums |
8aa7e9ed59697ba1d9d5c6ffe944c4b9e95633a6a3faae7d7610c58e94001058
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / glypho_ocr-0.2.0-py3-none-manylinux_2_28_x86_64.whl
| Download URL | glypho_ocr-0.2.0-py3-none-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 22.6 MB |
| Tags | Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
7a5916b1fe2ccabd60e4ae1d0e2b19aaa75b695aa4cce7d23a624e049cb26504
|
|
BLAKE2b-256 checksum How to use checksums |
d4ed6c35e2b37efae25b8da05d6471ef170acbd307439ed1bdd40e9dfc125558
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / glypho_ocr-0.2.0-py3-none-manylinux_2_28_aarch64.whl
| Download URL | glypho_ocr-0.2.0-py3-none-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 23.8 MB |
| Tags | Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
4194fe58e60aead9f902fc22093341da7c621cd72aeff9bf3d571e4cd404ee74
|
|
BLAKE2b-256 checksum How to use checksums |
83e513e61f9f450fde6ed6e7befe65169ee5520823dc04788fd548a58e8769ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / glypho_ocr-0.2.0-py3-none-macosx_14_0_universal2.whl
| Download URL | glypho_ocr-0.2.0-py3-none-macosx_14_0_universal2.whl |
|---|---|
| Size | 18.6 MB |
| Tags | Python 3 macOS 14.0+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
be3e710dd31811fdfb8d26ebd642d1468397ec5414e7795d854c41c0b093c0bd
|
|
BLAKE2b-256 checksum How to use checksums |
3aba28ae9e327c7841d370ff47ade83dca9a7569c895f986aa335a683d522691
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for glypho-ocr 0.2.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.