{"categories":[{"label":"Python Modules","url":"https://skillfed.io/packages/category/software-development-libraries-python-modules/7"},{"label":"Text Processing","url":"https://skillfed.io/packages/category/text-processing/2"},{"label":"Filters","url":"https://skillfed.io/packages/category/text-processing-filters"}],"enrichment":{"capability":"Wraps and formats text while correctly handling ANSI color and style codes, treating them as invisible to line length calculations the way textwrap cannot.","skillfed_tags":["terminal-ui","ansi-colors"],"use_cases":["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"],"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.\n\nThe 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.","worth_installing":"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."},"id":"ansiwrap","links":{"html":"https://skillfed.io/packages/ansiwrap","md":"https://skillfed.io/packages/ansiwrap.md","pypi":"https://pypi.org/project/ansiwrap/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2019-01-23","license_spdx":null,"license_treatment":"permissive","name":"ansiwrap","python_support":"unspecified","summary":"textwrap, but savvy to ANSI colors and styles"},"popularity":{"monthly_downloads":1218912,"position":4202,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"0.8.4"}
