Skip to content

Commit 0c65e10

Browse files
authored
Use uv (#361)
* chore: migrate project management and CI/CD to uv - Add pyproject.toml and uv.lock for uv-based dependency management. - Update Makefile to use 'uv build' for package building. - Update .github/workflows/ci.yml to use astral-sh/setup-uv and uv commands. - Update .circleci/config.yml to install and use uv for testing. - Add uv installation instructions to README.rst and README_en.rst. * fix ci * no longer support pypy2 * use astral-sh/setup-uv@v7
1 parent 2f68f19 commit 0c65e10

File tree

9 files changed

+7028
-12
lines changed

9 files changed

+7028
-12
lines changed

.circleci/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,3 @@ workflows:
163163
- python3.5
164164
- python3.4
165165
- python2.7
166-
- pypy2

.github/workflows/ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,29 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v5
1919

20+
- name: Set up uv
21+
uses: astral-sh/setup-uv@v7
22+
2023
- name: Set up Python ${{ matrix.python-version }}
2124
uses: actions/setup-python@v6
2225
with:
2326
python-version: ${{ matrix.python-version }}
2427

2528
- name: Install dependencies
2629
run: |
27-
python -m pip install -r requirements_dev.txt
30+
uv pip install --system -r requirements_dev.txt
31+
uv pip install --system .
2832
2933
- name: Run tests
3034
run: |
31-
py.test tests/ pypinyin/
35+
python -m pytest tests/ pypinyin/
3236
3337
- name: test cli
3438
if: startsWith(matrix.os,'ubuntu')
3539
run: |
3640
set -xe
37-
python setup.py sdist
38-
python -m pip install dist/*.gz
41+
uv build
42+
uv pip install --system dist/*.tar.gz
3943
python -m pypinyin test
4044
python -m pypinyin.tools.toneconvert to-tone 'zhong4 xin1'
4145

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,13 @@ doctest:
2929
.PHONY: publish
3030
publish: clean
3131
@echo "publish to pypi"
32-
python setup.py sdist
33-
python setup.py bdist_wheel
32+
uv build
3433
twine upload dist/*
3534

3635
.PHONY: publish_test
3736
publish_test: clean
3837
@echo "publish to test pypi"
39-
python setup.py sdist
40-
python setup.py bdist_wheel
38+
uv build
4139
twine upload --repository test dist/*
4240

4341
.PHONY: docs_html

README.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* GitHub: https://github.com/mozillazg/python-pinyin
1313
* License: MIT license
1414
* PyPI: https://pypi.org/project/pypinyin
15-
* Python version: 2.7, pypy, pypy3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13
15+
* Python version: 2.7, pypy3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13
1616

1717
.. contents::
1818

@@ -33,6 +33,12 @@
3333
3434
pip install pypinyin
3535
36+
使用 `uv` 安装:
37+
38+
.. code-block:: bash
39+
40+
uv add pypinyin
41+
3642
3743
使用示例
3844
--------

README_en.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ Install
3333
3434
$ pip install pypinyin
3535
36+
Install with `uv`:
37+
38+
.. code-block:: bash
39+
40+
$ uv add pypinyin
41+
3642
3743
Usage cases
3844
--------

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* GitHub: https://github.com/mozillazg/python-pinyin
1818
* License: MIT license
1919
* PyPI: https://pypi.org/project/pypinyin
20-
* Python version: 2.7, pypy, pypy3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9
20+
* Python version: 2.7, pypy3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13
2121

2222

2323
特性

pyproject.toml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
[build-system]
2+
requires = ["setuptools>=42", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "pypinyin"
7+
description = "汉字拼音转换模块/工具."
8+
readme = "README.rst"
9+
dynamic = ["version"]
10+
requires-python = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, <4"
11+
license = {text = "MIT"}
12+
authors = [{name = "mozillazg, 闲耘", email = "[email protected]"}]
13+
classifiers = [
14+
"Development Status :: 5 - Production/Stable",
15+
"Intended Audience :: Developers",
16+
"License :: OSI Approved :: MIT License",
17+
"Operating System :: OS Independent",
18+
"Programming Language :: Python",
19+
"Programming Language :: Python :: 2",
20+
"Programming Language :: Python :: 2.7",
21+
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3.4",
23+
"Programming Language :: Python :: 3.5",
24+
"Programming Language :: Python :: 3.6",
25+
"Programming Language :: Python :: 3.7",
26+
"Programming Language :: Python :: 3.8",
27+
"Programming Language :: Python :: 3.9",
28+
"Programming Language :: Python :: 3.10",
29+
"Programming Language :: Python :: 3.11",
30+
"Programming Language :: Python :: 3.12",
31+
"Programming Language :: Python :: 3.13",
32+
"Programming Language :: Python :: Implementation :: CPython",
33+
"Programming Language :: Python :: Implementation :: PyPy",
34+
"Topic :: Utilities",
35+
"Topic :: Text Processing"
36+
]
37+
keywords = ["pinyin", "拼音"]
38+
dependencies = [
39+
"argparse; python_version < '2.7'",
40+
"enum34; python_version < '3.4'",
41+
"typing; python_version < '3.5'"
42+
]
43+
44+
[project.urls]
45+
Documentation = "https://pypinyin.readthedocs.io/"
46+
Source = "https://github.com/mozillazg/python-pinyin"
47+
Tracker = "https://github.com/mozillazg/python-pinyin/issues"
48+
49+
[project.scripts]
50+
pypinyin = "pypinyin.__main__:main"
51+
52+
[project.entry-points.pyinstaller40]
53+
hook-dirs = "pypinyin.__pyinstaller:get_hook_dirs"
54+
55+
[dependency-groups]
56+
dev = [
57+
"argparse",
58+
"mypy; python_version >= '3.5'",
59+
"pre-commit",
60+
"pygments>=2.7.4; python_version >= '3.5'",
61+
"pytest",
62+
"pytest-cov",
63+
"pytest-random-order",
64+
"setuptools",
65+
"sphinx>=3.0.4; python_version >= '3.5'",
66+
"tox"
67+
]
68+
release = [
69+
"bumpversion",
70+
"twine",
71+
"wheel>=0.21"
72+
]
73+
74+
[tool.setuptools]
75+
packages = ["pypinyin", "pypinyin.contrib", "pypinyin.seg", "pypinyin.style", "pypinyin.tools", "pypinyin.__pyinstaller"]
76+
include-package-data = true
77+
zip-safe = false
78+
79+
[tool.setuptools.dynamic]
80+
version = {attr = "pypinyin.__version__"}

requirements_dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ pytest-random-order
99
setuptools
1010
Sphinx>=3.0.4
1111
tox
12-
twine
12+
#twine
1313
wheel>=0.21

0 commit comments

Comments
 (0)