$npx skillfedfor your agent

ansiwrap

textwrap, but savvy to ANSI colors and styles

Worth itPyPI Python ModulesReleased Jan 20191.2M downloads / moApache License 2.0Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — ansiwrap-0.8.4-py2.py3-none-any.whl
v0.8.4 · released 2019-01-23

Yes. The package solves a real problem (textwrap + ANSI codes) with no dependencies, permissive licensing, and active maintenance. It's small, focused, and widely downloaded. Install it if you're building terminal UIs or CLI tools with colored output that need proper text wrapping.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low friction: pure Python wheel with no runtime dependencies.
  • Maintenance is active with recent commits, though the latest release was in 2019.

License · maintenance · safety

Apache License 2.0 (permissive) — Apache License 2.0 is permissive; you can use this in commercial and proprietary projects with minimal restriction.

last release 2019-01-23 (2760 days) · last repo commit 2026-07-07 · 22 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,218,912 downloads/mo, #4,202 on PyPI

Verify before relying

pip install ansiwrap
from ansiwrap import wrap, fill, shorten, ansilen, strip_color
lines = wrap('colored text', width=20)
filled = fill('colored text', width=20)
shortened = shorten('colored text', 20, placeholder='...')
  • Whether the package handles all ANSI escape sequences or only color/style codes
  • Performance characteristics on very long strings or high-volume wrapping operations
  • Exact Python version support beyond the classifiers listed (2.6, 2.7, 3.3-3.7)
Same gist for agents: .md · .json

What it is and what it does

ansiwrap extends Python's standard textwrap module to handle ANSI escape sequences correctly. When you wrap or fill text containing ANSI color codes, textwrap miscalculates line length because it counts the raw bytes of invisible control codes. ansiwrap strips those codes during measurement, so wrapped lines respect actual display width, not byte length.

The package provides wrap(), fill(), and shorten() functions mirroring textwrap's API, plus utility functions like ansilen() to measure visible text length and strip_color() to remove codes entirely. It has no runtime dependencies and works across Python 2 and 3, making it straightforward to drop into terminal UI code or CLI tools that use colored output.

Use it for

  • Format colored log output to fit terminal width without breaking lines due to invisible codes
  • Wrap help text in CLI tools that use ANSI colors for emphasis without miscounting line length
  • Truncate colored status messages to a fixed display width in terminal dashboards
  • Process multi-line colored text and reflow it to new widths while preserving styling
  • Strip ANSI codes from colored strings when you need plain text for logging or storage

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

The package solves a real problem (textwrap + ANSI codes) with no dependencies, permissive licensing, and active maintenance. It's small, focused, and widely downloaded. Install it if you're building terminal UIs or CLI tools with colored output that need proper text wrapping.

Install

ansiwrap on PyPI

Before you install

Low friction: pure Python wheel with no runtime dependencies. Maintenance is active with recent commits, though the latest release was in 2019.

License in practice

Apache License 2.0 is permissive; you can use this in commercial and proprietary projects with minimal restriction.

Quickstart

pip install ansiwrap
from ansiwrap import wrap, fill, shorten, ansilen, strip_color
lines = wrap('colored text', width=20)
filled = fill('colored text', width=20)
shortened = shorten('colored text', 20, placeholder='...')

Verify before relying

  • Whether the package handles all ANSI escape sequences or only color/style codes
  • Performance characteristics on very long strings or high-volume wrapping operations
  • Exact Python version support beyond the classifiers listed (2.6, 2.7, 3.3-3.7)

Package facts

LicenseApache License 2.0 permissive
Python supportNot specified
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceActively maintained 2,760 days since the last release
Last repo commit
First released
Downloads1,218,912 / month, #4,202 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text ProcessingTopic :: Text Processing :: Filters

Evidence: ansiwrap-0.8.4-py2.py3-none-any.whl

Tags

Capabilities
ANSI color text wrappingtextwrap with color codeswrap colored terminal textANSI aware text formattingterminal text wrappingcolored text line breaking
Topics
terminal-uiansi-colors
PyPI keywords
texttextwrapANSIcolors

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “ANSI color text wrapping”

  • ansiwrapWraps and formats text while correctly handling ANSI color and style…
  • coloramaColorama makes ANSI escape sequences for colored terminal text work…
  • ansiconEnables ANSI color and style codes in Windows console output by…

Give your agent the search over MCP, or paste the wish link into any chat.

More Python Modules packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
PyYAML Worth it
PyPI · Python Modules · released Sep 2025

PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.

MITcompiled wheel · 3.8+
1.2Bdownloads / mo
pydantic Worth it
PyPI · Python Modules · released May 2026

Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.

MITpure Python · 3.9+
1.1Bdownloads / mo
annotated-types Worth it
PyPI · Python Modules · released Jul 2026

Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.

Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…

MITpure Python · 3.10+
871.3Mdownloads / mo
typing-inspection Worth it
PyPI · Python Modules · released Aug 2026

Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.

MITpure Python · 3.10+
783.0Mdownloads / mo

See also ansicolors · textwrap3 · colored · crayons · termcolor · strip-ansi · ansi · colorful · enrich · treetable