pyghostty
Unofficial (but complete) python bindings for libghostty-vt. libghostty is Ghostty's embeddable terminal emulation core, a headless, high-fidelity VT emulator for Python. These bindings cover terminal state, screen and scrollback snapshots, kitty graphics, and everything else Ghostty's production terminal core handles.
The binding is Python-ABI-independent: pure Python (cffi ABI mode) over a bundled libghostty-vt shared library, so one wheel per platform covers every Python version. No compiler is needed at install time.
Usage
from pyghostty import Terminal
with Terminal(cols=80, rows=24) as t:
t.feed('hello\r\nworld')
t.cursor # (x, y), 0-indexed
t.text() # plain text of the visible screen only
t.contents() # everything: scrollback plus screen, soft-wraps unwrapped
t.resize(120, 24) # reflows the primary screen
The base layer, pyghostty._cdef/_ffi, exposes the complete generated C API as raw ffi/lib (regenerate with gen_cdef.py after moving the pinned ghostty rev).
pyghostty.core.Terminal provides an ergonomic wrapper for commonly used parts.
Building the library
The shared library is built from a ghostty checkout with the Zig toolchain (installed via pip as ziglang):
GHOSTTY_SRC=/path/to/ghostty python build_lib.py
The checkout must be at the revision pinned in pyproject.toml. This runs zig build -Demit-lib-vt=true and copies the resulting shared library into pyghostty/_lib/, where the package loader and wheel builds pick it up.
Development
pip install -e .[dev]
GHOSTTY_SRC=/path/to/ghostty python build_lib.py
pytest -q
Versioning
Version lives in pyghostty/__init__.py as __version__.
Releases
Pushing a v* tag runs .github/workflows/release.yml, which builds and tests one Python-ABI-independent wheel for each supported platform and publishes the wheels to GitHub and PyPI. Releases are wheel-only; source remains available from the corresponding GitHub tag.
Release files for pyghostty 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pyghostty-0.1.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| pyghostty-0.1.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl | Python 3 | none | Linux glibc 2.27+ ARM64, Linux glibc 2.28+ ARM64 | Details |
| pyghostty-0.1.1-py3-none-macosx_13_0_x86_64.whl | Python 3 | none | macOS 13.0+ x86-64 | Details |
| pyghostty-0.1.1-py3-none-macosx_13_0_arm64.whl | Python 3 | none | macOS 13.0+ ARM64 | Details |
Total release size: 5.6 MB
Release files / pyghostty-0.1.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyghostty-0.1.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
30cf24518da22687929ec2910620347d4df2178260987771580f8db17d53cb27
|
|
BLAKE2b-256 checksum How to use checksums |
0d248e46ed45b4737ca4f7dbdb70ac910531d07fe9d8b08bc50e685d6b73e2c5
|
| 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 Sep 9, 2026.
Transparency logRelease files / pyghostty-0.1.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
| Download URL | pyghostty-0.1.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
e7145f43d4c24d7690495855aa93334ae291d7afeea6e36927d243e7788838bb
|
|
BLAKE2b-256 checksum How to use checksums |
ab9282a8672242b12fab17052244d3a44919a0e682c75b877ce758cafec51551
|
| 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 Sep 9, 2026.
Transparency logRelease files / pyghostty-0.1.1-py3-none-macosx_13_0_x86_64.whl
| Download URL | pyghostty-0.1.1-py3-none-macosx_13_0_x86_64.whl |
|---|---|
| Size | 656.0 kB |
| Tags | Python 3 macOS 13.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
a952b2a386ae815ed8cf83dc7c4237b4f4c92e7e84cf9c3cf8d892cbb88f9c5b
|
|
BLAKE2b-256 checksum How to use checksums |
b1720aaf4ade4bdc6deb0f7b251f9237fef92ce8e24d01fd43164c65e4c41fe2
|
| 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 Sep 9, 2026.
Transparency logRelease files / pyghostty-0.1.1-py3-none-macosx_13_0_arm64.whl
| Download URL | pyghostty-0.1.1-py3-none-macosx_13_0_arm64.whl |
|---|---|
| Size | 591.2 kB |
| Tags | Python 3 macOS 13.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e4b44be45315012100b2d6f496db898af6f7165082ac79168a53ecc5415c2e84
|
|
BLAKE2b-256 checksum How to use checksums |
83236e12e3cb60c3c615c1ed9abbe580d95a6c64c504a371d2df1fc4e05edf0d
|
| 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 Sep 9, 2026.
Transparency log