Skip to content

Commit e68dcd9

Browse files
committedNov 16, 2024
📦 feat: 添加开发依赖 ruff 并更新相关配置
1 parent dfdee1d commit e68dcd9

File tree

12 files changed

+105
-59
lines changed

12 files changed

+105
-59
lines changed
 

‎.flake8

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ show-source = true
44
statistics = true
55
max-line-length = 127
66
max-complexity = 10
7-
exclude = .git,__pycache__,docs/source/conf.py,old,build,dist
7+
exclude = .git,__pycache__,docs/source/conf.py,old,build,dist
File renamed without changes.

‎.github/workflows/python-publish.yml

+30-30
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
name: Publish package to PyPI
2-
3-
on:
4-
push:
5-
tags:
2+
3+
on:
4+
push:
5+
tags:
66
- 'v*' # 匹配"v1.0.0"、"v1.0.0-alpha"等发布标签
7-
8-
permissions:
9-
contents: write # 如果您的包发布到 GitHub Packages,则需要此权限
10-
packages: write # 如果您的包发布到 GitHub Packages,则需要此权限
11-
12-
jobs:
13-
deploy:
14-
runs-on: ubuntu-latest
15-
16-
steps:
17-
- uses: actions/checkout@v4
18-
- name: Set up Python
19-
uses: actions/setup-python@v3
20-
with:
21-
python-version: '3.x'
22-
- name: Install dependencies
23-
run: |
24-
python -m pip install --upgrade pip
25-
pip install build
26-
- name: Build package
27-
run: python -m build
28-
- name: Publish package
29-
uses: pypa/gh-action-pypi-publish@release/v1 # 使用一个稳定的版本标签,而不是具体的提交哈希
30-
with:
31-
user: __token__
32-
password: ${{ secrets.PYPI_API_TOKEN }}
7+
8+
permissions:
9+
contents: write # 如果您的包发布到 GitHub Packages,则需要此权限
10+
packages: write # 如果您的包发布到 GitHub Packages,则需要此权限
11+
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up Python
19+
uses: actions/setup-python@v3
20+
with:
21+
python-version: '3.x'
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install build
26+
- name: Build package
27+
run: python -m build
28+
- name: Publish package
29+
uses: pypa/gh-action-pypi-publish@release/v1 # 使用一个稳定的版本标签,而不是具体的提交哈希
30+
with:
31+
user: __token__
32+
password: ${{ secrets.PYPI_API_TOKEN }}

‎.github/workflows/ruff-check.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Ruff Check
2+
3+
on:
4+
push:
5+
branches: [ "*" ]
6+
pull_request:
7+
paths:
8+
- "nonebot_plugin_fishspeech_tts/**"
9+
10+
11+
jobs:
12+
ruff:
13+
name: Ruff Lint
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Run Ruff Lint
19+
uses: chartboost/ruff-action@v1

‎.pre-commit-config.yaml

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
repos:
2-
- repo: https://github.com/hadialqattan/pycln
3-
rev: v2.4.0
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0 # 选择最新的稳定版本
44
hooks:
5-
- id: pycln
6-
args: [--config, pyproject.toml]
5+
- id: trailing-whitespace # 去除多余的空格
6+
- id: end-of-file-fixer # 确保文件以空行结束
7+
- id: check-yaml # 检查 YAML 文件格式
8+
- id: check-added-large-files # 检查提交中是否包含过大的文件
79

8-
- repo: https://github.com/psf/black
9-
rev: 24.10.0
10+
- repo: https://github.com/astral-sh/ruff-pre-commit
11+
rev: v0.7.4
1012
hooks:
11-
- id: black
12-
stages: [pre-commit]
13-
13+
# Run the linter.
14+
- id: ruff
15+
args: [ --fix ]
16+
# Run the formatter.
17+
- id: ruff-format

‎README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ git clone https://github.com/Cvandia/nonebot-plugin-fishspeech-tts
5555
- 在窗口运行处
5656
将文件夹`nonebot-plugin-fishspeech-tts`复制到bot根目录下的`src/plugins`(或创建bot时的其他名称`xxx/plugins`)
5757

58-
58+
5959
</details>
60-
60+
6161
<details>
6262
<summary>注意</summary>
63-
63+
6464
推荐镜像站下载
65-
65+
6666
清华源```https://pypi.tuna.tsinghua.edu.cn/simple```
67-
67+
6868
阿里源```https://mirrors.aliyun.com/pypi/simple/```
6969

7070
</details>

‎docs/README_EN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Simply prepare the voice of the character you wish to clone, label the voice fil
2525

2626
> [!note]
2727
> This plugin is for **learning** and **research** purposes only. Users must assume all risks associated with using the plugin. The author is not responsible for any losses or issues arising from the use of the plugin. Please use the plugin responsibly and **comply with relevant laws and regulations.**
28-
Using **this plugin indicates that you have read and agree to the above disclaimer**. If you do not agree or cannot comply with the above statement, please do not use this plugin.
28+
Using **this plugin indicates that you have read and agree to the above disclaimer**. If you do not agree or cannot comply with the above statement, please do not use this plugin.
2929

3030
## 💿 Installation
3131

@@ -142,4 +142,4 @@ git clone https://github.com/fishaudio/fish-speech
142142
**Add Additional Parameters in `API_FLAGS.txt`:**
143143
1. `--compile` -> Whether to start the compiled model (faster TTS generation but slower startup).
144144
2. `--workers <number>` -> Start `<number>` of concurrent processes (must set, as default one can easily block).
145-
3. More details can be found in the [official documentation](https://speech.fish.audio/zh).
145+
3. More details can be found in the [official documentation](https://speech.fish.audio/zh).

‎nonebot_plugin_fishspeech_tts/__init__.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1+
import contextlib
2+
from .config import Config
13
from nonebot import require
24

35
require("nonebot_plugin_alconna")
46

5-
from .config import Config
6-
from . import matcher
7-
8-
import contextlib
9-
107

11-
usage: str = (
12-
"""
8+
usage: str = """
139
指令:
1410
发送:[角色名]说[文本]即可发送TTS语音。
1511
发送:[语音列表]以查看支持的发音人。
1612
发送:[语音余额]以查看在线api余额。
1713
""".strip()
18-
)
1914

2015
with contextlib.suppress(Exception):
2116
from nonebot.plugin import PluginMetadata, inherit_supported_adapters

‎nonebot_plugin_fishspeech_tts/config.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99

1010
class Config(BaseModel):
11-
1211
# 基础配置
1312
tts_is_online: bool = True
1413
tts_chunk_length: Literal["normal", "short", "long"] = "normal"

‎pdm.lock

+29-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pyproject.toml

+2
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ requires-python = "<4.0,>=3.10"
2525
readme = "README.md"
2626
license = {text = "MIT"}
2727

28+
[dependency-groups]
29+
dev = ["ruff>=0.7.4"]

‎res/logo/NoneBotPlugin.svg

+1-1
Loading

0 commit comments

Comments
 (0)
Failed to load comments.