skillfed

python-bidi

Python Bidi layout wrapping the Rust crate unicode-bidi

python-bidi v0.6.11 11.3M downloads/30d#1,402 on PyPI126
Copyleft license Active released

What it is and what it does

Python BiDi solves the problem of displaying bidirectional text—text that mixes left-to-right scripts (like English) with right-to-left scripts (like Hebrew or Arabic). It implements the Unicode Bidirectional Algorithm to reorder characters into their correct visual display sequence. The package offers two implementations: a pure Python version (V5 of the algorithm) and a newer Rust-based wrapper around the unicode-bidi crate, which implements a higher version of the algorithm.

You use it by passing a string or bytes to `get_display()`, optionally specifying encoding, base direction, or debug output. It returns the text in display order, ready for rendering. The package also includes a command-line tool (`pybidi`) for processing text files or stdin. It has no runtime dependencies and supports Python 3.9 through 3.14, with precompiled wheels for most platforms.

Use it for:

  • Render mixed Hebrew and English text correctly in web applications or documents.
  • Process Arabic text in data pipelines where visual order is required for display.
  • Build text editors or terminal utilities that handle bidirectional scripts.
  • Convert stored Unicode text to display order before passing to rendering engines.
  • Debug bidirectional text layout issues with the debug flag to inspect Unicode levels.
  • Command-line text processing for files containing right-to-left scripts.

Worth the install?

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

Converts bidirectional text (mixed left-to-right and right-to-left scripts) into display order for rendering, with both Python and Rust implementations available.

Yes. The package is actively maintained, has no known vulnerabilities, zero runtime dependencies, and solves a specific and well-defined problem in text rendering. Install it if you need to display bidirectional text; the LGPL license is standard for text-processing libraries and poses no barrier for most projects. The Rust implementation path offers better algorithm coverage for new code.

Install

python-bidi on PyPI

pip

pip install python-bidi

uv

uv add python-bidi

poetry

poetry add python-bidi

Installing python-bidi

Before you install

Medium install friction due to precompiled wheels for multiple platforms and Python versions (3.9–3.14), but no runtime dependencies. Last release 45 days ago; repository active with 126 stars and recent commits.

License in practice

Licensed under LGPL (copyleft); derivative works and modifications must be distributed under compatible terms. Suitable for open-source projects but requires careful review for proprietary use.

Quickstart

pip install python-bidi

from bidi import get_display
result = get_display('שלום')  # Hebrew text
print(result)  # Displays in correct visual order

Verify before relying

  • Whether the Rust implementation covers all Unicode Bidirectional Algorithm versions or has known gaps beyond what issue #25 documents.
  • Performance characteristics and memory overhead when processing large volumes of mixed-script text.
  • Compatibility with non-UTF-8 encodings in production scenarios.

Package facts

License not declared (copyleft)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 45 days since the last release
Last repo commit
First released
Downloads 11,274,418/month — #1,402 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: python_bidi-0.6.11-cp310-cp310-macosx_10_12_x86_64.whl; python_bidi-0.6.11-cp310-cp310-macosx_11_0_arm64.whl; python_bidi-0.6.11-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; python_bidi-0.6.11-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; python_bidi-0.6.11-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; python_bidi-0.6.11-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl; python_bidi-0.6.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; python_bidi-0.6.11-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl; python_bidi-0.6.11-cp310-cp310-musllinux_1_2_aarch64.whl; python_bidi-0.6.11-cp310-cp310-musllinux_1_2_armv7l.whl; python_bidi-0.6.11-cp310-cp310-musllinux_1_2_i686.whl; python_bidi-0.6.11-cp310-cp310-musllinux_1_2_x86_64.whl; python_bidi-0.6.11-cp310-cp310-win32.whl; python_bidi-0.6.11-cp310-cp310-win_amd64.whl; python_bidi-0.6.11-cp311-cp311-macosx_10_12_x86_64.whl; python_bidi-0.6.11-cp311-cp311-macosx_11_0_arm64.whl; python_bidi-0.6.11-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; python_bidi-0.6.11-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; python_bidi-0.6.11-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; python_bidi-0.6.11-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl

Keywords: bidi, unicode, layout

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)Operating 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.14Programming Language :: Python :: 3.9Topic :: Text Processing

Tags

bidirectional text layoutbidi algorithm implementationright-to-left text renderingunicode text directionmixed script display orderhebrew arabic text layoutbidi display conversion
unicode-textbidi-layouttext-rendering

More Text Processing packages