skillfed

textwrap3

textwrap from Python 3.6 backport (plus a few tweaks)

textwrap3 v0.9.2 1.3M downloads/30d#4,071 on PyPI5
Permissive license Python Software Foundation License Abandoned released

What it is and what it does

textwrap3 is a backport of Python 3.6's textwrap module designed to run on older Python versions, from 2.6 forward. It exposes newer APIs like shorten() and the max_lines parameter to codebases stuck on Python 2 or early Python 3 releases. The module is a near-direct copy of the standard library implementation, with one notable tweak: it treats Unicode em-dashes (U+2014) the same as ASCII em-dashes (--) when wrapping text, and it applies the re.UNICODE flag so that accented and non-ASCII characters are recognized as legitimate word characters.

Because the package is a compatibility shim for end-of-life Python versions, it is only relevant if you maintain legacy code that cannot upgrade to modern Python. The package itself is abandoned—no releases since January 2019—and the Python versions it targets are no longer supported by the Python community.

Use it for:

  • Wrap and fill text in Python 2.7 codebases using the same API as Python 3.6's textwrap.
  • Handle Unicode text with accented characters and em-dashes correctly across Python 2 and early Python 3.
  • Use the shorten() function in projects locked to Python 2.6–3.5 where the standard library lacks it.
  • Maintain consistent text-wrapping behavior across a codebase that must support both Python 2 and Python 3.

Worth the install?

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

Backports Python 3.6's textwrap module to earlier Python versions, making APIs like shorten() and max_lines available across Python 2.6 and 3.x with improved Unicode handling.

No. The package is abandoned (last release January 2019) and targets Python versions (2.6–3.7) that are end-of-life and no longer receive security updates. Modern Python projects should use the standard library textwrap directly. Only consider this if you are maintaining legacy code on unsupported Python versions and cannot upgrade—in that case, the low install friction and permissive license make it technically viable, but the lack of maintenance is a significant risk.

Install

textwrap3 on PyPI

pip

pip install textwrap3

uv

uv add textwrap3

poetry

poetry add textwrap3

Installing textwrap3

Before you install

Low install friction with no runtime dependencies. However, the package is abandoned—last commit was 2019-01-23 and no releases in 2760 days. It targets Python versions (2.6, 2.7, 3.3–3.7) that are now end-of-life, making it unsuitable for modern projects.

License in practice

Licensed under the Python Software Foundation License (permissive), which poses no restrictions on use or redistribution in most contexts.

Quickstart

pip install textwrap3

from textwrap3 import wrap

text = 'long text here...'
print(wrap(text, 40))

Verify before relying

  • Whether textwrap3's Unicode and em-dash handling differs meaningfully from modern Python's textwrap in current use.
  • Whether any of the target Python versions (2.6–3.7) remain in active use in the reader's environment.

Package facts

License Python Software Foundation License (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 2,760 days since the last release
Last repo commit
First released
Downloads 1,313,048/month — #4,071 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: textwrap3-0.9.2-py2.py3-none-any.whl

Keywords: text, wrap, fill, textwrap

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Python Software Foundation 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

Tags

text wrapping python 2textwrap backportunicode text wrappingpython 2.7 text formattingwrap text across versionsem-dash text handling
legacy-pythonbackport

More Python Modules packages