skillfed

strip-ansi

Strip ANSI escape sequences from a string

strip-ansi v0.1.1 176.5K downloads/30d#10,241 on PyPI10
License unclear DORMANT released

What it is and what it does

strip-ansi is a minimal utility that removes ANSI escape sequences—the control codes terminals use for colors, bold, underline, and other text formatting—from strings. It takes a string containing these codes and returns the plain text content. The package has no runtime dependencies and installs quickly.

It is typically used when you need to log, store, or process terminal output that includes color codes but you want only the readable text. Common scenarios include cleaning up colored CLI output for storage in files, parsing terminal logs, or preparing text for analysis where formatting codes would interfere.

Use it for:

  • Strip color codes from CLI tool output before writing to a log file or database.
  • Clean up terminal output captured from colored command-line utilities for text processing.
  • Prepare colored terminal text for analysis or comparison where ANSI codes would cause false mismatches.
  • Remove formatting codes from captured pytest or test runner output for plain-text reporting.
  • Sanitize colored output from third-party CLI tools before displaying in a non-terminal context.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Removes ANSI escape sequences (color codes, formatting directives) from strings, leaving plain text.

Yes, if you need to strip ANSI codes from strings and accept dormant maintenance. The package is simple, dependency-free, and has no known vulnerabilities. However, verify the license before use, and be aware that no updates have been released since June 2020—if future Python versions introduce breaking changes to string handling or ANSI standards, this package may not adapt.

Install

strip-ansi on PyPI

pip

pip install strip-ansi

uv

uv add strip-ansi

poetry

poetry add strip-ansi

Installing strip-ansi

Before you install

Low install friction; no runtime dependencies. Maintenance is dormant—last release June 2020, no updates since, though the repository remains active with a recent commit in December 2024.

License in practice

License status is unclear; the package metadata contains no SPDX identifier or raw license text. Verify the actual license before using in proprietary or copyleft-sensitive contexts.

Quickstart

pip install strip_ansi

from strip_ansi import strip_ansi
result = strip_ansi("\033[38mLorem ipsum\033[0m")
print(result)  # Output: Lorem ipsum

Requires Python 3.6 or later; author notes uncertainty about compatibility with Python 2 or versions below 3.6.

Verify before relying

  • Whether the package is actively maintained or if dormancy signals abandonment risk for future Python versions.
  • Actual license terms—metadata does not declare one, so check the repository directly.
  • Whether ANSI stripping handles all modern terminal escape sequences or only a subset.

Package facts

License not declared (unclear)
Python support supports the current Python release (>=3.6,<4.0)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance dormant — 2,246 days since the last release
Last repo commit
First released
Downloads 176,460/month — #10,241 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: strip_ansi-0.1.1-py3-none-any.whl

Programming Language :: Python :: 3Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8

Tags

strip ansi escape codesremove terminal color codesclean ansi sequencesansi string sanitizerterminal output cleanupansi escape removalplain text from colored output
ansi-escape-codesterminal-outputtext-cleaning

More Text Processing packages