Skip to main content

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.

Metadata

Release files for pyghostty 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for pyghostty 0.1.3
File
pyghostty-0.1.3-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
pyghostty-0.1.3-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.3-py3-none-macosx_13_0_x86_64.whl Python 3 none macOS 13.0+ x86-64 Details
pyghostty-0.1.3-py3-none-macosx_13_0_arm64.whl Python 3 none macOS 13.0+ ARM64 Details

Total release size: 7.3 MB

Release files / pyghostty-0.1.3-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pyghostty-0.1.3-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 3.0 MB
Tags Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
e215282798435d0db2042f4c61ecc9231bf66ea7ec68dbb16a43fe84e9685269
BLAKE2b-256 checksum
How to use checksums
4f3735c55c04226fdd7b49099666bf064ab014f03b8a7e45f73c13d67b1363fa
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 30, 2026.

Transparency log

Release files / pyghostty-0.1.3-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL pyghostty-0.1.3-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 2.8 MB
Tags Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
1bdee612b32083ce3c34a96e0195a1f1f16aeb3090971c9159da7df494bd3822
BLAKE2b-256 checksum
How to use checksums
3024aadec50f4c926f4a577d5784f9002c0f8a8e4d192a3388838d07262a51d3
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 30, 2026.

Transparency log

Release files / pyghostty-0.1.3-py3-none-macosx_13_0_x86_64.whl

Download URL pyghostty-0.1.3-py3-none-macosx_13_0_x86_64.whl
Size 771.2 kB
Tags Python 3 macOS 13.0+ x86-64
SHA-256 checksum
How to use checksums
7511e4c43c6b823c4146e6de57a6c6c6f214ea9f3243b79fc1d111853f7cfdb1
BLAKE2b-256 checksum
How to use checksums
af7c05818eb6b9451db73c52b95e3b2f298f53d3c414351eaa550415380b48ae
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 30, 2026.

Transparency log

Release files / pyghostty-0.1.3-py3-none-macosx_13_0_arm64.whl

Download URL pyghostty-0.1.3-py3-none-macosx_13_0_arm64.whl
Size 745.6 kB
Tags Python 3 macOS 13.0+ ARM64
SHA-256 checksum
How to use checksums
74db4760d46acd5553981d7dcfa809ad334f8a1e37c9583bdb594835ab7e8006
BLAKE2b-256 checksum
How to use checksums
19878bd6ca92e5b74865d1221ac3b1d5daa180689bb5b317a4b515796a5d54cb
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 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.3 This release

4 release files

0.1.1

4 release files

0.1.0

4 release files

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