Registry / serialization / jaraco-text

jaraco-text

JSON →
library4.3.0pypypi✓ verified 22d ago

jaraco.text is a Python library offering a collection of various text manipulation utilities, including advanced text wrapping, line joining, block indentation, symbol substitution, and more. It is actively maintained with a regular release cadence, currently at version 4.2.0.

pip install jaraco.text
INSTALL
IMPORT
SIG · JARACO-TEXT
J
jaraco-text
serializationpythonv4.3.0
Install
3.1s avg
Import
166ms
Disk
31MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.172s · 32.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.1s · import 0.160s · 33MB
31MB installed
● package 31MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

wrap
from jaraco.text import wrap
import jaraco.text.wrap
Many core functions are directly importable from the top-level `jaraco.text` package, not nested modules.
join_lines
from jaraco.text.join import join_lines
from jaraco.text import join_lines
`join_lines` is part of the `join` submodule, which is itself a submodule of `jaraco.text`.
ellipsis_middle
from jaraco.text.compress import ellipsis_middle
from jaraco.text import ellipsis_middle
`ellipsis_middle` resides in the `compress` submodule.

This quickstart demonstrates three common utilities from jaraco.text: `wrap` for custom text wrapping, `join_lines` for combining lines while preserving indentation, and `ellipsis_middle` for shortening long strings by placing an ellipsis in the center.

from jaraco.text import wrap from jaraco.text.join import join_lines from jaraco.text.compress import ellipsis_middle # Example 1: Custom text wrapping with indentation long_text = "This is a very long paragraph that demonstrates the custom wrapping functionality provided by jaraco.text. It can handle various widths and indentation levels." wrapped = wrap(long_text, width=40, indent=4) print("--- Wrapped Text ---") print(wrapped) # Example 2: Joining lines, preserving relative indentation lines_to_join = [ " First indented line", " Second deeper line", "Third top-level line" ] joined = join_lines(lines_to_join) print("\n--- Joined Lines ---") print(joined) # Example 3: Shorten string with ellipsis in the middle very_long_string = "The quick brown fox jumps over the lazy dog and then takes a nap under the shade tree." shortened = ellipsis_middle(very_long_string, max_len=30) print("\n--- Ellipsis Middle ---") print(shortened)
Debug
Known issues
breakingVersion 4.0.0 and above dropped support for Python versions older than 3.9. Users on Python 3.8 or earlier must use jaraco.text version 3.x.
fix
Upgrade to Python 3.9+ or pin `jaraco.text<4` in your project dependencies.
affects: >=4.0.0
gotchaThe `wrap` function in `jaraco.text` is distinct from the standard library's `textwrap.wrap`. While similar in concept, it has different parameters (e.g., `indent` instead of `initial_indent`/`subsequent_indent`) and may behave differently.
fix
Be mindful of which `wrap` function you are importing and using. If you intend to use `textwrap.wrap`, explicitly import `from textwrap import wrap`.
affects: All
gotchaMany utilities like `join_lines` or `ellipsis_middle` are nested within submodules (e.g., `jaraco.text.join`, `jaraco.text.compress`) and must be imported from their specific paths, not directly from `jaraco.text`.
fix
Consult the documentation or source code to find the correct import path for the specific utility you need. For example, `from jaraco.text.join import join_lines`.
affects: All
Errors
Common errors & fixes
FileNotFoundError: 'Lorem ipsum.txt' resource not found in 'jaraco.text'
This error typically occurs when using PyInstaller, which fails to correctly bundle the data files (like 'Lorem ipsum.txt') associated with the 'jaraco.text' library into the generated executable.
fix
Upgrade PyInstaller to a version that includes the necessary hook for `jaraco.text` (e.g., PyInstaller 4.0 or newer), or ensure `pyinstaller-hooks-contrib` is installed and updated.
ImportError: cannot import name 'drop_comment' from 'jaraco.text'
This issue often stems from compatibility problems between certain versions of `setuptools` (which may vend a copy of `jaraco.text`) and the installed `jaraco.text` library, leading to `pkg_resources` attempting to import a function that has changed or been removed.
fix
Downgrade `setuptools` to a compatible version (e.g., `setuptools==70.3.0` as a known workaround) or upgrade both `setuptools` and `jaraco.text` to versions where this incompatibility has been resolved.
ModuleNotFoundError: No module named 'jaraco.text'
This error means the Python interpreter cannot find the 'jaraco.text' package, either because it's not installed in the active environment, or there's a problem with package managers or bundlers like `py2app` or `setuptools` not correctly including it.
fix
Install the package using pip (`pip install jaraco.text`), ensure your virtual environment is activated, or verify that your application bundler (e.g., PyInstaller, py2app) is correctly configured to include 'jaraco.text'.
Upgrade
Version history
4.3.0latest on PyPI · released Jul 12, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources
jaraco-text — pip install jaraco-text · libregistry