Skip to main content

QAnsiTextViewer

CI Docs

ANSI Text Viewer - QT Widget

Install

Not on PyPI yet — install from GitHub or build locally:

uv add git+https://github.com/tanishq-kumar/QAnsiTextViewer  # from GitHub
# or build locally:
uv build && uv pip install dist/qansitextviewer-*.whl
# or clone + develop:
uv sync --group dev

Requires Python >=3.11, PySide6 >=6.5.0.

Quick start

from PySide6.QtWidgets import QApplication
from ansi_text_viewer import AnsiTextViewer

app = QApplication([])
viewer = AnsiTextViewer()
viewer.appendAnsiText("\x1b[31mred\x1b[0m plain\n")
viewer.highlight_search("red")  # F3 / Shift+F3 navigates, Esc clears
viewer.setTheme("dark")
viewer.show()
app.exec()

Full demo app: just demo (or uv run python demo.py).

API cheatsheet

Task Call
Append / replace appendAnsiText(s), setAnsiText(s) (\r = progress overwrite)
Non-blocking burst appendAnsiTextAsync(s) + asyncAppendProgress / asyncAppendFinished, cancelAsyncAppends()
Search / filter highlight_search(q, use_regex, match_case), next_match(), prev_match(), filter_search(q, ...)
Limits setMaximumBlocks(10000), setMaxLineLength(10000) (0 = off)
Look setTheme("light"|"dark"|"auto"), setMonospaceFont(), setFontSize(), setFontFamily(), useSystemFont(), setWordWrapEnabled(), setCurrentLineHighlightEnabled()
Appearance Theme-following defaults; setDefaultColors(fg, bg), setColorsFollowTheme(bool), setAnsiPaletteColor(), setLogLevelColors(), setBookmarkColor(), setSearchHighlightColor()
Log helpers setTimestampEnabled(), setLogLevelHighlighting(), setSyntaxHighlighting()
Custom highlight add_highlight_rule(rule) with spans(text) (ansi_text_viewer.highlight)
Bookmarks toggleBookmark() (or gutter click), gotoNextBookmark(), bookmarkedLines(), bookmarksChanged signal
Copy / export copySelectedPlainText(), copySelectedWithAnsi(), exportToFile(path) (.txt/.html/.md)
Sessions saveSession("s.json"), loadSession("s.json")
Shortcuts Ctrl+FfindRequested, F3/Shift+F3, Esc (app-wide)

Dev Commands

just test · just demo · just run · just lint · just typecheck · just docs-build — see justfile.

Release files for qansitextviewer 0.1.0

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

Source distribution (sdist)

Source distribution for qansitextviewer 0.1.0
File Size Uploaded
qansitextviewer-0.1.0.tar.gz 2.7 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for qansitextviewer 0.1.0
File Interpreter ABI Platform
qansitextviewer-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size:2.7 MB

Release files / qansitextviewer-0.1.0.tar.gz

Download URL qansitextviewer-0.1.0.tar.gz
Size 2.7 MB
Tags Source
SHA-256 checksum
How to use checksums
556736f137fb33eeb0917e6a8819cfcf89f0d30df95d5c7646b4661edbc51176
BLAKE2b-256 checksum
How to use checksums
9462994a10271b7ea2a7f51b337507d6e80e9cdce166be02325287e6209438e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / qansitextviewer-0.1.0-py3-none-any.whl

Download URL qansitextviewer-0.1.0-py3-none-any.whl
Size 33.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff486cbbc90c40c6aceb288cf8f41e0e1ce83cbc3f67ff1f3cc65be098262d48
BLAKE2b-256 checksum
How to use checksums
26bb86b2d9f1ae49c71f19424dc6755244793ac680e23b9b054d27f5f5da76da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

2 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