Skip to main content

Ansistrip

ansistrip banner

Mini-lib to strip ANSI Escape codes from a string.

CI PyPI version Python versions License: MIT DeepWiki

Installation

Install with uv:

uv add ansistrip

Usage

In [1]: import ansistrip

In [2]: text = "\x1b[1m\x1b[38;5;10mtest\x1b[0m"

In [3]: ansistrip.ansi_strip(text)
Out[3]: 'test'

It also handles 8-bit C1 controls, plain ESC sequences such as ESC ( B or ESC c, and control strings such as terminal titles and OSC 8 hyperlinks:

In [4]: ansistrip.ansi_strip("\x1b]0;my title\x07hello")
Out[4]: 'hello'

In [5]: ansistrip.ansi_strip("\x1b]8;;https://example.com\x1b\\link\x1b]8;;\x1b\\")
Out[5]: 'link'

Non-ASCII text is left untouched:

In [6]: ansistrip.ansi_strip("\x1b[31mÉXITO: configuración\x1b[0m")
Out[6]: 'ÉXITO: configuración'

Development

uv sync
uv run pytest

Metadata

Release files for ansistrip 0.3.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 ansistrip 0.3.0
File Size Uploaded Provenance
ansistrip-0.3.0.tar.gz 5.1 kB With provenance Details

Built distribution (wheel)

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

Total release size: 9.1 kB

Release files / ansistrip-0.3.0.tar.gz

Download URL ansistrip-0.3.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9bba892b11cf30ce57cfef1821cd9e9318ee0c6e8182fbca230bc2834ddef71f
BLAKE2b-256 checksum
How to use checksums
683d2075d07cd2a123be64d8ef4bee2205f3b3b0d7083e49499bcdaf53b5aeb9
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 Aug 15, 2026.

Transparency log

Release files / ansistrip-0.3.0-py3-none-any.whl

Download URL ansistrip-0.3.0-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a35214c866eedd68d0d464dbb1f21781f4dfd2183220403835769d505f940dd
BLAKE2b-256 checksum
How to use checksums
f53498de7c7e9d31709bf9f36f942b814674f0e068d4c718c7ad08de03864b2c
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 Aug 15, 2026.

Transparency log

Security for ansistrip 0.3.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ansistrip-0.3.0.tar.gz

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 Aug 15, 2026.

Transparency log

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.

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