Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
73984b9
新增 to_finals_tone、to_finals_tone2 以及 to_finals_tone3 函数
mozillazg Feb 12, 2022
b16873e
更新文档
mozillazg Feb 12, 2022
d41c18c
将 tone_convert 中的 neutral_tone_with_5 参数重命名为统一的 neutral_tone_with_five
mozillazg Feb 12, 2022
08a2727
fix "py35: InterpreterNotFound: python3.5"
mozillazg Feb 12, 2022
6a74176
update docs
mozillazg Feb 12, 2022
37a3917
add more tests
mozillazg Feb 12, 2022
b37c4f1
Merge remote-tracking branch 'origin/develop'
mozillazg Feb 12, 2022
c426aa6
Bump version: 0.45.0 → 0.46.0
mozillazg Feb 12, 2022
adbe233
fix(tone_convert): don't append tone number to empty input (#279)
Ban3 May 27, 2022
54b3b0a
use windows-2019
mozillazg May 28, 2022
9ceb6a4
remove needless .whitesource
mozillazg May 28, 2022
7f83c89
fix run on pypy3
mozillazg May 28, 2022
83bc347
docs: Fix a few typos (#283)
timgates42 Jul 30, 2022
32222f2
backport _replace_tone2_style_dict_to_default from old version
mozillazg Jul 30, 2022
0a59df9
improve tests
mozillazg Jul 30, 2022
f0594f6
Merge branch 'backport-_replace_tone2_style_dict_to_default' into dev…
mozillazg Jul 30, 2022
860f9dd
使用最新版本的 phrase-pinyin-data 和 pinyin-data 拼音数据
mozillazg Jul 30, 2022
8880f0f
自定义拼音风格的回调函数新增关键字参数 ``han``,用于接收对应的原始汉字
mozillazg Jul 30, 2022
5f4ef79
update changelog
mozillazg Jul 30, 2022
67f5e1f
[skip ci] update changelog
mozillazg Jul 30, 2022
21cc800
Merge remote-tracking branch 'origin/develop'
mozillazg Jul 30, 2022
e1f34db
Bump version: 0.46.0 → 0.47.0
mozillazg Jul 30, 2022
178ce33
重构代码: 从 _phrase_pinyin 中抽出一个 convert_styles 方法方便复用
mozillazg Aug 13, 2022
32e5011
修复无声母和韵母的场景下指定 neutral_tone_with_five=True 会返回 5 作为拼音的问题 #284
mozillazg Aug 15, 2022
594b286
add more tests
mozillazg Aug 21, 2022
77bd383
v0.47.1
mozillazg Aug 21, 2022
81f4669
Merge remote-tracking branch 'origin/develop'
mozillazg Aug 21, 2022
9f89018
Bump version: 0.47.0 → 0.47.1
mozillazg Aug 21, 2022
784031c
删除$,影响复制粘贴。 (#285)
YangtseSu Aug 23, 2022
d21125f
update docs
mozillazg Aug 28, 2022
8690dd4
test python 3.11
mozillazg Nov 13, 2022
35ee079
Merge remote-tracking branch 'origin/python-311'
mozillazg Dec 24, 2022
a8878ec
fix ci error
mozillazg Dec 24, 2022
05eacb3
Fixed #290
mozillazg Jan 14, 2023
df37de4
修复 Style.BOPOMOFO 风格下未处理 ê 的问题。Fixed #291
mozillazg Jan 14, 2023
d66bf49
更新文档
mozillazg Jan 14, 2023
cc79572
更新使用 phrase-pinyin-data v0.14.0 的词语拼音数据
mozillazg Jan 15, 2023
430f7ad
fix tests
mozillazg Jan 15, 2023
ec90041
Merge remote-tracking branch 'origin/develop'
mozillazg Jan 15, 2023
5351f2e
0.48.0
mozillazg Jan 15, 2023
58a3dec
Bump version: 0.47.1 → 0.48.0
mozillazg Jan 15, 2023
870525e
update docs
mozillazg Jan 15, 2023
767eee9
使用 `phrase-pinyin-data`_ v0.15.0 的词语拼音数据
mozillazg May 14, 2023
893f7f4
Merge remote-tracking branch 'origin/develop'
mozillazg May 14, 2023
6a306a6
Bump version: 0.48.0 → 0.49.0
mozillazg May 14, 2023
f000cd5
Bump actions/checkout from 3 to 4 (#305)
dependabot[bot] Sep 9, 2023
ba73897
更新使用 phrase-pinyin-data v0.16.0 和 pinyin-data v0.14.0 的数据
mozillazg Dec 11, 2023
de9a03a
test python 3.12
mozillazg Dec 11, 2023
a70b095
Merge remote-tracking branch 'origin/develop'
mozillazg Dec 11, 2023
5fd3403
Bump version: 0.49.0 → 0.50.0
mozillazg Dec 11, 2023
cf7ef4f
Bump actions/setup-python from 4 to 5 (#315)
dependabot[bot] Mar 3, 2024
c2ab6be
cli: support multiple words (#318)
Freed-Wu Mar 3, 2024
8fe2c16
fix tests
mozillazg Mar 3, 2024
2fba056
Add .readthedocs.yaml
mozillazg Mar 9, 2024
0ae789a
增加新的命令行工具: python -m pypinyin.tools.toneconvert
mozillazg Mar 9, 2024
c3993e8
更新使用 phrase-pinyin-data v0.17.0 的词语拼音数据
mozillazg Mar 10, 2024
810089d
update docs
mozillazg Mar 10, 2024
24bd468
Merge remote-tracking branch 'origin/develop'
mozillazg Mar 10, 2024
85469ed
gen_data: ensure run `git submodule update`
mozillazg Mar 10, 2024
6eb2876
cli: fix 'No module named pypinyin.tools.toneconvert'
mozillazg Mar 10, 2024
49a8fa1
ci: fix " A parameter cannot be found that matches parameter name xe."
mozillazg Mar 10, 2024
2d35659
ci: fix "The term pypinyin is not recognized as a name of a cmdlet, f…
mozillazg Mar 10, 2024
0b5bfdd
cli: skip windows
mozillazg Mar 10, 2024
29cacd8
Bump version: 0.50.0 → 0.51.0
mozillazg Mar 10, 2024
96ffa79
改为运行时从 json 文件中读取单字和词语拼音数据,缓解 Python 3.12 环境中存在的性能劣化问题 (#324)
serfend Jul 20, 2024
3f87a63
Merge remote-tracking branch 'origin/develop'
mozillazg Aug 4, 2024
0692d75
0.52.0
mozillazg Aug 4, 2024
4c55949
Bump version: 0.51.0 → 0.52.0
mozillazg Aug 4, 2024
d9c0de0
update changelog
mozillazg Aug 4, 2024
0110225
update Related Projects: add cpp-pinyin (#325)
wolfgitpr Aug 17, 2024
ae570e6
解决#326:使 PyInstaller 在 Windows 下无需手动加 --collect-data pypinyin 就可打包程序 …
xushengj Sep 9, 2024
04a19ba
update Related Projects: add csharp-pinyin (#330)
wolfgitpr Sep 15, 2024
48ec012
prepare for v0.53.0
mozillazg Sep 15, 2024
c64f490
fix lint
mozillazg Sep 15, 2024
476d20c
Merge remote-tracking branch 'origin/develop'
mozillazg Sep 15, 2024
e42dede
Bump version: 0.52.0 → 0.53.0
mozillazg Sep 15, 2024
0509a12
测试 python 3.13 和 pypy 3.10 (#339)
mozillazg Jan 3, 2025
6a9b5cb
Add Gwoyeu Romatzyh (#343)
0xis-cn Mar 16, 2025
e59f64a
优化测试
mozillazg Mar 30, 2025
39a5aa2
更新使用 phrase-pinyin-data v0.18.0 的数据
mozillazg Mar 30, 2025
03c1f19
新增当 errors 参数被设置为 `exception` 时将在未找到拼音时抛出异常
mozillazg Mar 30, 2025
94c4fc6
fix tests
mozillazg Mar 30, 2025
bdfbe3f
Merge remote-tracking branch 'origin/master' into develop
mozillazg Mar 30, 2025
21ad113
fix ci
mozillazg Mar 30, 2025
08f4bd2
update changelog
mozillazg Mar 30, 2025
378ead3
Merge remote-tracking branch 'origin/develop'
mozillazg Mar 30, 2025
c57fda0
Bump version: 0.53.0 → 0.54.0
mozillazg Mar 30, 2025
789d258
update changelog
mozillazg Mar 30, 2025
4fdeee8
add metadata to setup.cfg
mozillazg Mar 30, 2025
b1e3be5
improve tests
mozillazg Mar 30, 2025
591428c
添加中国内地盲文风格 (#348)
oxygen-dioxide Jul 6, 2025
e91dd9d
improve changelog
mozillazg Mar 30, 2025
5766362
add more tests for Style.BRAILLE_MAINLAND and Style.BRAILLE_MAINLAND_…
mozillazg Jul 19, 2025
ab62a2e
优化内置分词,解决词语切分有误导致的拼音有误问题 #347
mozillazg Jul 19, 2025
cbf1b79
支持在 GitHub Codespace 上开发 (#349)
oxygen-dioxide Jul 20, 2025
2b19fe5
更新使用 phrase-pinyin-data v0.19.0 和 pinyin-data v0.15.0 的数据
mozillazg Jul 20, 2025
88a0102
基于 pinyin-data 和 phrase-pinyin-data 生成最新的数据
mozillazg Jul 20, 2025
b067d77
prepare v0.55.0
mozillazg Jul 20, 2025
4976884
Merge remote-tracking branch 'origin/develop'
mozillazg Jul 20, 2025
df10157
Bump version: 0.54.0 → 0.55.0
mozillazg Jul 20, 2025
c15b508
Bump actions/checkout from 4 to 5 (#352)
dependabot[bot] Nov 15, 2025
2f68f19
Bump actions/setup-python from 5 to 6 (#354)
dependabot[bot] Nov 15, 2025
0c65e10
Use uv (#361)
mozillazg Jan 3, 2026
fcd68ff
Fix type annotation for errors parameter to accept list return types …
Copilot Feb 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[bumpversion]
commit = True
tag = True
current_version = 0.45.0
current_version = 0.55.0

[bumpversion:file:pypinyin/__init__.py]
36 changes: 20 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: 2
jobs:
python3.8: &DEFAULT
docker:
- image: circleci/python:3.8
- image: cimg/python:3.8

environment:
TOX_ENV: py38
Expand Down Expand Up @@ -35,11 +35,14 @@ jobs:
. venv/bin/activate

pip install coveralls
pip install tox
pip install 'tox<4.0.0'

if [[ $RUN_CHECK == 1 ]]; then
pip install -U -r requirements_dev.txt
fi
if [[ $(echo $TOX_ENV | grep pypy3) ]]; then
pip install setuptools==60.10.0
fi

if [[ $(python -c "import sys; print(sys.stdin.encoding)" |grep None) ]]; then
export PYTHONIOENCODING=utf-8
Expand Down Expand Up @@ -68,58 +71,65 @@ jobs:
echo hello | pypinyin
pypinyin < setup.cfg

coveralls
# coveralls

- store_artifacts:
path: test-reports
destination: test-reports

python3.11:
<<: *DEFAULT
docker:
- image: cimg/python:3.11
environment:
TOX_ENV: py311

python3.10:
<<: *DEFAULT
docker:
- image: circleci/python:3.10
- image: cimg/python:3.10
environment:
TOX_ENV: py310

python3.9:
<<: *DEFAULT
docker:
- image: circleci/python:3.9
- image: cimg/python:3.9
environment:
TOX_ENV: py39

python3.7:
<<: *DEFAULT
docker:
- image: circleci/python:3.7
- image: cimg/python:3.7
environment:
TOX_ENV: py37

python3.6:
<<: *DEFAULT
docker:
- image: circleci/python:3.6
- image: cimg/python:3.6
environment:
TOX_ENV: py36

python3.5:
<<: *DEFAULT
docker:
- image: circleci/python:3.5
- image: cimg/python:3.5
environment:
TOX_ENV: py35

python3.4:
<<: *DEFAULT
docker:
- image: circleci/python:3.4
- image: python:3.4
environment:
TOX_ENV: py34

python2.7:
<<: *DEFAULT
docker:
- image: circleci/python:2.7
- image: cimg/python:2.7
environment:
TOX_ENV: py27

Expand Down Expand Up @@ -149,13 +159,7 @@ workflows:
version: 2
testing:
jobs:
- python3.10
- python3.9
- python3.8
- python3.7
- python3.6
- python3.5
- python3.4
- python2.7
- pypy2
- pypy3
16 changes: 16 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "python-pinyin",
"image": "mcr.microsoft.com/devcontainers/python:1-3.9-bookworm",
"features": {},
"postCreateCommand": "pip3 install --user -r requirements_dev.txt;pip3 install --user -e .",
"customizations": {
"vscode": {
"extensions": [
"hbenl.vscode-test-explorer",
"ms-python.mypy-type-checker",
"ms-python.python"
]
}
},
"forwardPorts": [8080]
}
9 changes: 6 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "21:00"
open-pull-requests-limit: 10
interval: "weekly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
39 changes: 30 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,40 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
# python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
python-version: [3.9]
tox-env: [py27, py35, py36, py37, py38, py39, py310]
os: [windows-2022, ubuntu-22.04]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.9", "pypy3.10"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v5

- name: Set up uv
uses: astral-sh/setup-uv@v7

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install tox
- name: Test with tox
run: tox -e ${{ matrix.tox-env}}
uv pip install --system -r requirements_dev.txt
uv pip install --system .

- name: Run tests
run: |
python -m pytest tests/ pypinyin/

- name: test cli
if: startsWith(matrix.os,'ubuntu')
run: |
set -xe
uv build
uv pip install --system dist/*.tar.gz
python -m pypinyin test
python -m pypinyin.tools.toneconvert to-tone 'zhong4 xin1'

- name: test import time
if: startsWith(matrix.os,'ubuntu')
run: |
set -xe
time python -c 'from pypinyin import pinyin'
71 changes: 0 additions & 71 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ vocab.large.bin
.mypy_cache/
.pytest_cache/
/pypinyin/phrases_dict_large.py
/docs/CHANGELOG.html
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v3.4.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-merge-conflict
- id: debug-statements
exclude: 'tools/|(pypinyin/(phrases_dict.py|pinyin_dict.py|phonetic_symbol.py))'
exclude: 'tools/|(pypinyin/(legacy/|phonetic_symbol.py))'
- id: double-quote-string-fixer
exclude: 'pypinyin/(phrases_dict.py|pinyin_dict.py|phonetic_symbol.py)'
exclude: 'pypinyin/(legacy/|phonetic_symbol.py)'
- id: end-of-file-fixer
exclude: '.bumpversion.cfg'
exclude: '.bumpversion.cfg|.*.json'
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
- repo: https://github.com/pycqa/flake8
rev: 7.2.0
hooks:
- id: flake8
exclude: 'tools|pypinyin/(phrases_dict.py|pinyin_dict.py|phonetic_symbol.py)|(docs/conf.py)'
exclude: 'tools|pypinyin/(legacy/|phonetic_symbol.py)|(docs/conf.py)'
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: 'v0.812'
# hooks:
Expand Down
35 changes: 35 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
# fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
# python:
# install:
# - requirements: docs/requirements.txt
12 changes: 0 additions & 12 deletions .whitesource

This file was deleted.

Loading