Skip to main content

AnsiParser

A convenient library for converting ANSI escape sequences into text or HTML.

PyPI - Stable Version PyPI - Python Version GitHub Actions Workflow Status GitHub License

📖 Description

Parse ANSI escape sequences into screen outputs. This library implements a parser that processes escape sequences like a terminal, allowing you to convert them into formatted text or HTML.

✨ Supported Features

  • CSI (Control Sequence Introducer) sequences
    • SGR (Select Graphic Rendition)
    • CUP (Cursor Position)
    • ED (Erase in Display)
    • EL (Erase in Line)
  • Convert
    • formatted text
    • HTML

📦 Installation

AnsiParser is available on PyPI:

python -m pip install ansiparser

Or you can use Poetry:

poetry add ansiparser

🎨 Usage

import ansiparser

ansip_screen = ansiparser.new_screen()
ansip_screen.put("\x1b[1;6H-World!\x1b[1;1HHello")

ansip_screen.parse()
converted = ansip_screen.to_formatted_string()

print(converted) # ['Hello-World!']

🔗 Links

📜 License

GitHub License

Metadata

Release files for ansiparser 1.3.2

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

Source distribution (sdist)

Source distribution for ansiparser 1.3.2
File Size Uploaded Provenance Actions
ansiparser-1.3.2.tar.gz 13.9 kB Without provenance Details for ansiparser-1.3.2.tar.gz

Built distribution (wheel)

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

Total release size: 30.6 kB

Release files / ansiparser-1.3.2.tar.gz

Download URL ansiparser-1.3.2.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
516b9ce443b9a385cdd243bec5cf6405a40c2b5321ccdb7b43525fc93359624a
BLAKE2b-256 checksum
How to use checksums
3fe7678d787ad47ac49f316e912d418bed0d6d4b030149bdb625b9ac646d0b21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / ansiparser-1.3.2-py3-none-any.whl

Download URL ansiparser-1.3.2-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4581dac3cde29d94c30f7de657d88a26ae860f20fce3ef11578fab7f6ece321
BLAKE2b-256 checksum
How to use checksums
e4c1a9ed1a41d61439253c447f7d7b147b8cc688cbb6ee3b14c027d4df135e00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Security for ansiparser 1.3.2

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.

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