text-unidecode
The most basic Python port of Perl's Text::Unidecode for Unicode-to-ASCII transliteration.
Repository Health
Technical Analysis
text-unidecode is a tiny, dependency-free Python library that transliterates arbitrary Unicode text into a plain ASCII approximation. It is a direct port of the venerable Perl Text::Unidecode module and exposes a single unidecode() function that maps each code point to a best-effort ASCII replacement using a precompiled data table.
Because it ships as a permissively dual-licensed (Artistic / GPL) package with no runtime dependencies, it is a popular low-level building block deep in the dependency trees of many Python projects that need to romanize text for slugs, filenames, or search keys.
What You Get
- A single
unidecode()function that transliterates any Unicode string to ASCII - Zero runtime dependencies and a very small install footprint
- A precompiled
data.bincode-point replacement table loaded at import - Permissive dual licensing (Artistic License or GPL/GPLv2+)
- Broad Python support (2.7 and 3.4+)
Common Use Cases
- Generating ASCII-safe URL slugs from Unicode titles
- Producing safe filenames or identifiers from international text
- Normalizing text into ASCII search or sort keys
- Feeding legacy systems or protocols that only accept ASCII
Under The Hood
Architecture - The entire library is src/text_unidecode/__init__.py: at import it reads a bundled data.bin via pkgutil.get_data, decodes it as UTF-8, and splits on NUL bytes into a _replaces list indexed by code point. unidecode() walks each character, looks up _replaces[ord(ch)-1], and joins the results, appending NUL for a zero code point and skipping unmapped ones.
Tech Stack - Pure Python (2.7 and 3.4+) with no third-party runtime dependencies. The only data artifact is the precompiled data.bin table, and a Perl helper (_dump.pl) is included for regenerating that table from the original Text::Unidecode source.
Code Quality - The implementation is a few lines and paired with test_unidecode.py plus a tox.ini for multi-version testing. It is production-stable and intentionally frozen, so it carries little risk despite low recent activity.
API Design - The surface could not be simpler: import unidecode and call it with a string. There are no options or configuration, which makes it trivial to adopt and impossible to misuse.