skillfed

arabic-reshaper

Reconstruct Arabic sentences to be used in applications that do not support Arabic

arabic-reshaper v3.0.1 5.5M downloads/30d#2,089 on PyPI443
Permissive license MIT Active released

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-reshaper

uv

uv add arabic-reshaper

poetry

poetry add arabic-reshaper

Installing 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

Natural Language :: ArabicOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Libraries :: Python Modules

Tags

arabic text reshapingarabic character shapingarabic script renderingarabic ligature supportright-to-left text processingarabic unicode normalizationarabic harakat handling
arabic-scripttext-renderinginternationalization

More Python Modules packages