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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pyghostty-0.1.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.2 MB view details)

Uploaded Python 3manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyghostty-0.1.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (2.0 MB view details)

Uploaded Python 3manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

pyghostty-0.1.0-py3-none-macosx_13_0_x86_64.whl (656.0 kB view details)

Uploaded Python 3macOS 13.0+ x86-64

pyghostty-0.1.0-py3-none-macosx_13_0_arm64.whl (591.2 kB view details)

Uploaded Python 3macOS 13.0+ ARM64

File details

Details for the file pyghostty-0.1.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyghostty-0.1.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9461e0e42d9be8fd0a0afcd0e7c9487d5e900b1e57e64df16adc0ebdbb527194
MD5 ace70c83766af4cc6c33d81c63c49bc5
BLAKE2b-256 50c9d56ce52b8e109c2dfa7882fe0b7b9ebd527c554b7d5e33f9e2648dfa89f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyghostty-0.1.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on AnswerDotAI/pyghostty

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

File details

Details for the file pyghostty-0.1.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pyghostty-0.1.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8a1c628bff9a449707ea71ae6fd47e859ce5d80a5312bef357c383b7e7a7e71c
MD5 91a32fbb08ef25b369b008753d0d18b2
BLAKE2b-256 1fe1c2815400bb74a9846b44f2aa86e83088f42312b7e48c18a576b4d703fd7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyghostty-0.1.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl:

Publisher: release.yml on AnswerDotAI/pyghostty

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

File details

Details for the file pyghostty-0.1.0-py3-none-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for pyghostty-0.1.0-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 2722590d17f4cb5376e1d04d251a824b173223bb45466e94632c61b4e1cef577
MD5 cd14d5d739a9e973bf4df6c6c8819814
BLAKE2b-256 6682b8531f50f44e8fa85cd96acd011067f55c932f4225891d34bb3e5def9b4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyghostty-0.1.0-py3-none-macosx_13_0_x86_64.whl:

Publisher: release.yml on AnswerDotAI/pyghostty

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

File details

Details for the file pyghostty-0.1.0-py3-none-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for pyghostty-0.1.0-py3-none-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 5b9dd0487667be3500e51ffbf5ca87f53e020a9ef36f0dc0cf4ddd277e8822b2
MD5 9de1a9443c8dea81199440b37862d3cf
BLAKE2b-256 5b9e64b07389d5a99d3c735f02629c561729f7df5a6ec4c7a8d1a9b6df6feef4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyghostty-0.1.0-py3-none-macosx_13_0_arm64.whl:

Publisher: release.yml on AnswerDotAI/pyghostty

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