pinyin
Translate chinese chars to pinyin based on Mandarin.dat
What it is and what it does
Pinyin is a library for converting Chinese characters to their romanized Mandarin pronunciation (pinyin). It reads from a Mandarin.dat data file and supports multiple output formats: diacritical marks (nǐ hǎo), numerical tone notation (ni3hao3), or stripped ASCII (ni hao). It also includes an experimental Chinese-to-English translation module using CC-CEDICT data, though this is noted as a prototype and only functions on Python 3.
The package has no runtime dependencies and is lightweight, but it is no longer maintained. The last release was in 2016, and the classifiers indicate support only for Python 2.6–3.5, making it incompatible with modern Python environments without testing or forking.
Use it for:
- Convert Chinese text to pinyin for phonetic display or learning applications
- Extract initial consonants from Chinese characters for indexing or sorting
- Generate numerical tone notation for linguistic analysis or text-to-speech systems
- Look up English translations of Chinese words or phrases using the cedict module
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts Chinese characters to pinyin (romanized Mandarin pronunciation) in multiple formats, and provides prototype Chinese-to-English translation via CC-CEDICT data.
No, unless you are maintaining legacy Python 2 code. The package is abandoned with no updates since 2016 and targets obsolete Python versions. For modern projects, seek an actively maintained alternative. If you must use it, test thoroughly on your target Python version first.
Install
pinyin on PyPI
pip
pip install pinyinuv
uv add pinyinpoetry
poetry add pinyinInstalling pinyin
Before you install
High install friction: the package is abandoned (last release 2016-11-24, over 3550 days ago) and targets obsolete Python versions (2.6, 2.7, 3.2–3.5). No active maintenance or security updates.
License in practice
Permissive BSD license allows commercial and private use. The translation data file is CC-BY-SA 3.0, which requires attribution if you redistribute the data.
Quickstart
pip install pinyin
import pinyin
print(pinyin.get('你好'))
print(pinyin.get('你好', format='strip', delimiter=' '))
Package targets Python 2.6–3.5; compatibility with Python 3.6+ is unverified. Abandoned since 2016 with no active maintenance.
Verify before relying
- Whether the package actually works on modern Python versions despite classifiers targeting only 2.6–3.5
- Current state of the Mandarin.dat data file and whether it is complete or outdated
- Whether the cedict translation module functions correctly on Python 3 as noted in the description
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 3,550 days since the last release |
| First released | |
| Downloads | 79,145/month — #14,377 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pinyin-0.4.0.tar.gz
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
xpinyinConverts Chinese characters (hanzi) to their…
permissive · top 15,000 on PyPI
pypinyin-dictProvides alternative pinyin (romanized Chinese)…
permissive · top 15,000 on PyPI
pypinyinConverts Chinese characters to pinyin…
permissive · top 5,000 on PyPI
hangul-romanizeConverts Korean Hangul text to romanized (Latin…
unclear · top 15,000 on PyPI
zhonZhon provides character constants and regular…
permissive · top 15,000 on PyPI
pronouncingProvides a simple Python interface to query the…
permissive · top 15,000 on PyPI
hanzidentifierIdentifies whether a string contains Simplified…
permissive · top 15,000 on PyPI
readcharReads single characters and keystrokes from…
permissive · top 5,000 on PyPI
uromanConverts text in any script to Latin alphabet…
permissive · top 15,000 on PyPI
anyasciiConverts Unicode text to ASCII-only equivalents…
permissive · top 5,000 on PyPI