{"id":46832,"library":"xpinyin","title":"xpinyin","description":"A Python library to convert Chinese hanzi (汉字) to pinyin (拼音). Version 0.7.7 is the latest; the library is in maintenance mode with infrequent releases.","status":"maintenance","version":"0.7.7","language":"python","source_language":"en","source_url":"https://github.com/lxneng/xpinyin","tags":["chinese","hanzi","pinyin","transliteration"],"install":[{"cmd":"pip install xpinyin","lang":"bash","label":"Install via pip"}],"dependencies":[],"imports":[{"note":"The main class is Pinyin, not the module name.","wrong":"import xpinyin","symbol":"Pinyin","correct":"from xpinyin import Pinyin"}],"quickstart":{"code":"from xpinyin import Pinyin\np = Pinyin()\n# Get pinyin with tone marks (default)\nprint(p.get_pinyin('上海'))  # shàng-hǎi\n# Get pinyin without tones\nprint(p.get_pinyin('上海', tone_marks=None))  # shang-hai","lang":"python","description":"Basic usage: create a Pinyin instance and call get_pinyin(). The default separator is '-'."},"warnings":[{"fix":"Replace `show_tone_marks=bool` with `tone_marks='marks'` or `tone_marks=None`.","message":"The `show_tone_marks` parameter in `get_pinyin` is deprecated. Use `tone_marks` instead.","severity":"deprecated","affected_versions":">=0.5.0"},{"fix":"Use `splitter=''` parameter if you want no separator, or `splitter=' '` for spaces.","message":"`get_pinyin` returns pinyin with a hyphen separator by default. Many users expect spaces.","severity":"gotcha","affected_versions":"all"},{"fix":"Convert traditional characters to simplified before calling xpinyin, or use a different library like pypinyin.","message":"The library does not support traditional Chinese characters (only Simplified Chinese).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.7.7':14 'chines':7,27 'convert':6 'hanzi':8,28 'infrequ':25 'latest':17 'librari':4,19 'mainten':22 'mode':23 'pinyin':11,29 'python':3 'releas':26 'transliter':30 'version':13 'xpinyin':1 '拼音':12 '汉字':9","created_at":"2026-06-07T13:01:50.765051+00:00","updated_at":"2026-06-07T13:01:50.765051+00:00","problems":[{"fix":"Run `pip install xpinyin` and use `from xpinyin import Pinyin`.","cause":"The library is not installed or the import path is wrong.","error":"ImportError: No module named xpinyin"},{"fix":"Use `from xpinyin import Pinyin`.","cause":"Importing the module instead of the class.","error":"AttributeError: module 'xpinyin' has no attribute 'Pinyin'"},{"fix":"Use `tone_marks` instead (e.g., `tone_marks='marks'` or `tone_marks=None`).","cause":"The deprecated parameter was removed in newer versions.","error":"TypeError: get_pinyin() got an unexpected keyword argument 'show_tone_marks'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/lxneng/xpinyin","github":"https://github.com/lxneng/xpinyin","docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["search"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}