-
-
Notifications
You must be signed in to change notification settings - Fork 717
Expand file tree
/
Copy pathpyproject.toml
More file actions
195 lines (177 loc) · 5.09 KB
/
Copy pathpyproject.toml
File metadata and controls
195 lines (177 loc) · 5.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
[project]
name = "py-xiaozhi"
version = "1.0.0"
description = "小智 AI 客户端 - 跨平台语音助手"
readme = "README.md"
requires-python = ">=3.10"
license = { text = "MIT" }
authors = [{ name = "Junsen", email = "junsen@example.com" }]
keywords = ["ai", "voice-assistant", "xiaozhi"]
dependencies = [
# 音频处理
"numpy>=1.26.0",
"sounddevice>=0.4.4",
"soxr>=0.5.0",
"opuslib>=3.0.1",
# 网络通信
"aiohttp>=3.9.0",
"websockets>=11.0.3",
"paho-mqtt>=2.1.0",
"requests>=2.31.0",
# AI/ML
"openai>=1.0.0",
"sherpa-onnx>=1.12.26",
"sherpa-onnx-core>=1.12.26; sys_platform != 'win32'",
# 图像处理
"opencv-python-headless>=4.9.0",
"pillow>=10.0.0",
# 加密
"cryptography>=42.0.0",
# 工具库
"psutil>=5.9.0",
"pendulum>=3.0.0",
"py-machineid>=0.6.0",
"platformdirs>=4.0.0",
# 音乐/媒体
"mutagen>=1.47.0",
# 中文处理
"pypinyin>=0.51.0",
"lunar_python>=1.3.0",
# 剪贴板
"pyperclip>=1.8.0",
# 快捷键 (跨平台基础)
"pynput>=1.7.6",
# ============================================================
# 平台特定依赖 (根据系统自动安装)
# ============================================================
# macOS 依赖
"applescript>=2021.2.9; sys_platform == 'darwin'",
"pyobjc-framework-Quartz>=10.0; sys_platform == 'darwin'",
"pyobjc-framework-Cocoa>=10.0; sys_platform == 'darwin'",
# Windows 依赖
"comtypes>=1.4.0; sys_platform == 'win32'",
"pycaw>=20230407; sys_platform == 'win32'",
"pywin32>=306; sys_platform == 'win32'",
# Linux 依赖 (GPIO 模式)
"gpiozero>=2.0.1; sys_platform == 'linux'",
"lgpio>=0.2.2.0; sys_platform == 'linux'",
]
[project.optional-dependencies]
# GUI 模式额外依赖
# 使用 `uv sync --extra gui` 或 `pip install '.[gui]'` 启用
gui = [
"PySide6>=6.6.0",
"qasync>=0.27.1",
]
# macOS 特定依赖 (已通过环境标记自动安装,保留用于显式安装)
macos = [
"applescript>=2021.2.9",
"pyobjc-framework-Quartz>=10.0",
"pyobjc-framework-Cocoa>=10.0",
]
# Windows 特定依赖 (已通过环境标记自动安装,保留用于显式安装)
windows = [
"comtypes>=1.4.0",
"pycaw>=20230407",
"pywin32>=306",
]
# Linux 特定依赖 (GPIO 模式)
linux = [
"gpiozero>=2.0.1",
"lgpio>=0.2.2.0",
]
# TUI 全屏终端模式:uv sync --extra tui
tui = [
"textual>=0.80.0",
]
# 注意:树莓派 CSI 不要用 pip extra 装 picamera2。
# picamera2 依赖 python-prctl(仅 Linux),在 macOS 上 uv sync/run 会直接编译失败。
# Pi Bookworm 请用系统包:sudo apt install python3-picamera2
# 代码在 import 到 picamera2 时自动启用 CSI 后端(CAMERA.backend=auto/picamera2)。
[project.scripts]
xiaozhi = "main:main"
[project.urls]
Homepage = "https://github.com/huangjunsen0406/py-xiaozhi"
Repository = "https://github.com/huangjunsen0406/py-xiaozhi"
# ============================================================
# 依赖组 (uv/pip 通用)
# ============================================================
[dependency-groups]
dev = [
"pyinstaller>=6.0.0",
"ruff>=0.4.0",
"pytest>=8.0.0",
"pytest-asyncio>=0.23.0",
]
# ============================================================
# Ruff 配置 (替代 black + isort + flake8)
# ============================================================
[tool.ruff]
target-version = "py310"
line-length = 88
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # Pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
]
ignore = [
"E501", # line too long (handled by formatter)
"B008", # function call in default argument
"C901", # too complex
]
[tool.ruff.lint.isort]
known-first-party = ["src"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
# ============================================================
# pytest 配置
# ============================================================
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"]
# ============================================================
# 保留旧工具配置(向后兼容)
# ============================================================
[tool.black]
line-length = 88
target-version = ['py310']
include = '\.pyi?$'
extend-exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| build
| dist
)/
'''
[tool.isort]
profile = "black"
line_length = 88
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
known_first_party = ["src"]
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
# ============================================================
# 构建系统
# ============================================================
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["src"]