Skip to main content

Fix Arabic text rendering across code, AI agents, and designs.

Project description

arabic-fix

Fix Arabic text rendering across code, AI agents, and designs.

License: MIT Python 3.9+ Tests

One library, one CLI, one system prompt. Letter-shaping, BiDi reordering, Unicode normalization, and a 3-section prompt template for any LLM. Arabic flows through terminals, AI agents, log files, and PDFs the way it should.

pip install arabic-fix
from arabic_fix import fix
print(fix("User 42 من الرياض at 09:30"))
# → a properly shaped, correctly ordered, NFC-normalized string
# CLI
cat arabic.txt | arabic-fix
arabic-fix --check file.txt          # CI mode: exit non-zero if changes needed
# AI agent: paste one of the 3 sections from agents/system_prompt.md
#   A · Read Arabic    — for agents that parse / summarize / classify
#   B · Write Arabic   — for agents that emit to terminal / log / email
#   C · Design Arabic  — for HTML / CSS / Tailwind / design tokens

Why

  • Letter shapingا ب ت (isolated forms) become اتصال (connected) via Unicode Presentation Forms-B.
  • BiDi orderUser 42 من الرياض ends up with 42 on the visual left and Arabic letters in their connected form, per UAX #9.
  • Tashkeel preserved — diacritics survive; مَرْحَبًا round-trips intact.
  • Logical CSS onlymargin-inline-start, never margin-left.
  • Real Arabic fonts — Tajawal, IBM Plex Sans Arabic, Noto Naskh Arabic in priority order; never Inter or Roboto.

What's in the box

Path What it is
arabic_fix/ Python library: fix(), shape(), reorder(), normalize()
agents/system_prompt.md 3 splice-in-able sections for any LLM
agents/eval_cases.md 15 cases to verify the system prompt works
designs/tokens.json 73 design tokens (W3C DTCG), CSS / Tailwind / Figma exports
examples/sample-arabic-page.html 5 Arabic surfaces using the tokens
docs/roadmap.md v0.2 → v0.6 milestones

Verify

pytest -q                          # 169 tests
mypy arabic_fix                    # strict, clean
python designs/validate_tokens.py  # 73 token schema check

License

MIT — see LICENSE. The brand arabic-fix is locked until v1.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arabic_fix-0.4.1.tar.gz (39.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arabic_fix-0.4.1-py3-none-any.whl (45.4 kB view details)

Uploaded Python 3

File details

Details for the file arabic_fix-0.4.1.tar.gz.

File metadata

  • Download URL: arabic_fix-0.4.1.tar.gz
  • Upload date:
  • Size: 39.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for arabic_fix-0.4.1.tar.gz
Algorithm Hash digest
SHA256 4e49edd89e57165edfe3b64d3ac484c1c66b1259d703297c970740866f29a392
MD5 ba9f96949d58f1dd0c37f4dd8d4308c2
BLAKE2b-256 889a977e6e018bca28e1109d785ea070a8d837c15a1b31edc6fc7297e4b627d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for arabic_fix-0.4.1.tar.gz:

Publisher: publish.yml on MahmoudElHassan/arabic-fix

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arabic_fix-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: arabic_fix-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 45.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for arabic_fix-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 828cce147922efbe6c4000568a508ddc80d0be5f87f510cd0799aebc5086b01c
MD5 f5af28b5022076f65e628af7a00b00b8
BLAKE2b-256 f5955d2eae21296f4a17de12604711865fa4ca97fe9f1d922918a24533b04b8b

See more details on using hashes here.

Provenance

The following attestation bundles were made for arabic_fix-0.4.1-py3-none-any.whl:

Publisher: publish.yml on MahmoudElHassan/arabic-fix

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page