arabic-reshaper
Reconstruct Arabic sentences to be used in applications that do not support Arabic
What it is and what it does
Arabic Reshaper solves a core rendering problem: Arabic script characters change shape based on their position in a word (initial, medial, final, or isolated), but many applications and libraries don't handle this automatically. This library takes Arabic text and replaces each character with its correct contextual form, making it displayable in systems without native Arabic support.
The package works alongside the Unicode bidirectional algorithm (typically via python-bidi) to handle both character shaping and text direction. It offers fine-grained configuration for ligature support, diacritical mark handling, and font-specific behavior, making it suitable for diverse use cases from simple text processing to image rendering with PIL.
Use it for:
- Render Arabic text on images using PIL when the font doesn't handle shaping automatically.
- Prepare Arabic text for display in web frameworks or libraries that lack right-to-left and shaping support.
- Process Arabic user input for storage or display in legacy systems without Arabic rendering capability.
- Generate correctly shaped Arabic text for PDF generation or document export.
- Support Farsi or Urdu text in applications originally designed for left-to-right scripts.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Reshapes Arabic text characters into their correct contextual forms for display in applications that don't natively support Arabic script rendering.
Yes. The package solves a real, narrow problem with no runtime dependencies, active maintenance, and permissive licensing. Install it if you need to display Arabic, Farsi, or Urdu text in an application or library that doesn't natively support Arabic script shaping. Skip it if your rendering stack already handles Arabic natively.
Install
arabic-reshaper on PyPI
pip
pip install arabic-reshaperuv
uv add arabic-reshaperpoetry
poetry add arabic-reshaperInstalling arabic-reshaper
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained with recent releases; last commit 2026-04-28 and repository not archived.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal attribution requirements.
Quickstart
pip install arabic-reshaper
import arabic_reshaper
text_to_be_reshaped = 'اللغة العربية رائعة'
reshaped_text = arabic_reshaper.reshape(text_to_be_reshaped)
Requires Python 3.10 or later. Optional: fonttools library needed only if using config_for_true_type_font feature.
Verify before relying
- Whether harakat (diacritical marks) handling is correct in all edge cases when combined with bidi reversal.
- Performance characteristics with very large text volumes or real-time rendering scenarios.
- Compatibility with all Arabic script variants (Farsi, Urdu) claimed in documentation.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 108 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,495,226/month — #2,089 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: arabic_reshaper-3.0.1-py3-none-any.whl
Keywords: arabic, reshaper, reshaping, shaping
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
PyArabicPyArabic provides functions to manipulate…
copyleft · top 15,000 on PyPI
python-bidiConverts bidirectional text (mixed…
copyleft · top 5,000 on PyPI
anyasciiConverts Unicode text to ASCII-only equivalents…
permissive · top 5,000 on PyPI
uharfbuzzCython bindings for HarfBuzz that shape text…
permissive · top 5,000 on PyPI
UnidecodeConverts Unicode text to ASCII-safe…
copyleft · top 1,000 on PyPI
cn2anConverts between Chinese numerals and Arabic…
permissive · top 15,000 on PyPI
artConverts text and generates one-line ASCII art…
permissive · top 5,000 on PyPI
epitranEpitran converts written text in various…
permissive · top 15,000 on PyPI
romanConverts between Arabic integers and Roman…
unclear · top 5,000 on PyPI
graphemeProvides string manipulation functions that…
permissive · top 5,000 on PyPI