Skip to content

Commit 705df66

Browse files
authored
chore(deps, style): Update pytest to 9.0.0 and format code (#33)
* chore(test): Update pytest to 9.0.1 and switch nonebug to a Git dependency. * tweak ruff config and format code * tweak * chore: Reorder pre-commit hooks to run `ruff-rev-sync` before `ruff-pre-commit`. * tweak * chore(ci): update release ci
1 parent 1ca3964 commit 705df66

File tree

14 files changed

+129
-135
lines changed

14 files changed

+129
-135
lines changed

.env.test

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
HOST=0.0.0.0
2-
PORT=8888
32
LOG_LEVEL=DEBUG
43

54
LOCALSTORE_USE_CWD=true
65

76
SUPERUSERS='[]'
8-
COMMAND_START='["", "/"]'
7+
COMMAND_START='["", "/"]'

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ body:
2121
2. 然后……
2222
3. 发生……
2323
validations:
24-
required: true
24+
required: false
2525

2626
- type: textarea
2727
id: expected

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ body:
1717
label: 描述所需要的功能
1818
description: 请说明需要的功能或解决方法
1919
validations:
20-
required: true
20+
required: false

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ jobs:
7272
python-version: ${{ matrix.python-version }}
7373
version: "latest"
7474

75-
- name: Install Dependencies with test group
76-
run: uv sync --no-dev --locked
75+
- name: Install Dependencies
76+
run: uv sync --locked
7777

7878
- name: Run Pytest
7979
run: uv run poe test

.github/workflows/release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ jobs:
3636
run: exit 1
3737

3838
- name: Build
39-
run: uv build
40-
41-
- name: Publish a Python distribution to PyPI
42-
uses: pypa/gh-action-pypi-publish@release/v1
39+
run: |
40+
uv build
41+
uv publish
4342
4443
- name: Upload Release Asset
4544
run: gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ celerybeat.pid
123123

124124
# Environments
125125
.env
126+
.env.dev
127+
.env.prod
126128
.venv
127129
env/
128130
venv/
@@ -160,8 +162,6 @@ cython_debug/
160162
# LSP config files
161163
pyrightconfig.json
162164

163-
bot.py
164-
165165
# PyCharm
166166
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
167167
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
@@ -182,4 +182,4 @@ data/
182182
config/
183183

184184
.DS_Store
185-
junit.xml
185+
junit.xml

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ ci:
66
autoupdate_schedule: monthly
77
autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks"
88
repos:
9+
- repo: https://github.com/fllesser/ruff-rev-sync-pre-commit
10+
rev: v1.0.0
11+
hooks:
12+
- id: ruff-rev-sync
13+
914
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: v0.14.6
15+
rev: v0.14.8
1116
hooks:
1217
- id: ruff-check
13-
args: [--fix]
18+
args: [--fix, --exit-non-zero-on-fix]
1419
stages: [pre-commit]
1520
- id: ruff-format
1621
stages: [pre-commit]
1722

18-
- repo: https://github.com/fllesser/ruff-rev-sync-pre-commit
19-
rev: v1.0.0
20-
hooks:
21-
- id: ruff-rev-sync
22-
2323
- repo: https://github.com/astral-sh/uv-pre-commit
2424
rev: 0.9.9
2525
hooks:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<img src="https://raw.githubusercontent.com/fllesser/nonebot-plugin-template/refs/heads/resource/.docs/NoneBotPlugin.svg" width="310" alt="logo"></a>
44

55
## ✨ nonebot-plugin-template ✨
6-
[![python](https://img.shields.io/badge/python-3.10|3.11|3.12|3.13-blue.svg)](https://www.python.org)
6+
[![python](https://img.shields.io/badge/python-3.10|3.11|3.12|3.13|3.14-blue.svg)](https://www.python.org)
77
[![uv](https://img.shields.io/badge/package%20manager-uv-black?style=flat-square&logo=uv)](https://github.com/astral-sh/uv)
88
<br/>
99
[![ruff](https://img.shields.io/badge/code%20style-ruff-black?style=flat-square&logo=ruff)](https://github.com/astral-sh/ruff)

pyproject.toml

Lines changed: 38 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ requires-python = ">=3.10"
77
authors = [{ name = "owner", email = "[email protected]" }]
88
dependencies = [
99
"httpx>=0.27.0,<1.0.0",
10-
"nonebot-plugin-alconna>=0.60.0,<1.0.0", # 跨平台命令解析拓展
11-
"nonebot-plugin-apscheduler>=0.5.0,<1.0.0", # 定时任务
10+
"nonebot-plugin-alconna>=0.60.0,<1.0.0", # 跨平台命令解析拓展
11+
"nonebot-plugin-apscheduler>=0.5.0,<1.0.0", # 定时任务
1212
"nonebot-plugin-localstore>=0.7.4,<1.0.0", # 存储文件
13-
"nonebot-plugin-uninfo>=0.10.0,<1.0.0", # 多平台用户信息获取
13+
"nonebot-plugin-uninfo>=0.10.0,<1.0.0", # 多平台用户信息获取
1414
"nonebot2>=2.4.3,<3.0.0",
1515
]
1616

@@ -24,7 +24,8 @@ dev = [
2424
"bump-my-version>=1.2.4",
2525
"nonebot2[fastapi]>=2.4.2,<3.0.0",
2626
"poethepoet>=0.36.0",
27-
"ruff>=0.14.5,<1.0.0",
27+
"ruff>=0.14.8,<1.0.0",
28+
{ include-group = "test" },
2829
]
2930
test = [
3031
"nonebot-adapter-onebot>=2.4.6,<3.0.0",
@@ -40,10 +41,13 @@ test = [
4041
requires = ["uv_build>=0.9.2,<0.10.0"]
4142
build-backend = "uv_build"
4243

44+
[tool.uv.sources]
45+
nonebug = { git = "https://github.com/nonebot/nonebug" }
46+
4347
[tool.bumpversion]
4448
current_version = "0.1.0"
4549
commit = true
46-
message = "🔖 release: bump vesion from {current_version} to {new_version}"
50+
message = "release: bump vesion from {current_version} to {new_version}"
4751
tag = true
4852

4953
[[tool.bumpversion.files]]
@@ -80,65 +84,56 @@ executionEnvironments = [
8084
typeCheckingMode = "standard"
8185
disableBytesTypePromotions = true
8286

83-
[tool.pytest.ini_options]
87+
[tool.pytest]
8488
addopts = [
85-
"-v", # 详细输出
86-
"-s", # 显示打印信息
87-
"--tb=short", # 简短的错误回溯
88-
"-ra", # 显示所有测试结果摘要
89-
"--strict-markers", # 严格标记模式
90-
"--import-mode=prepend", # 导入模式
89+
"--import-mode=prepend", # 导入模式
90+
"--strict-markers", # 严格标记模式
91+
"--tb=short", # 简短的错误回溯
92+
"-ra", # 显示所有测试结果摘要
93+
"-s", # 显示打印信息
94+
"-v", # 详细输出
9195
]
9296
pythonpath = ["src"]
9397
asyncio_mode = "auto"
9498
asyncio_default_fixture_loop_scope = "session"
9599

96100
[tool.ruff]
97-
line-length = 120
98-
target-version = "py310"
101+
line-length = 88
99102

100103
[tool.ruff.format]
101104
line-ending = "lf"
102105

103106
[tool.ruff.lint]
104107
select = [
105-
"F", # Pyflakes
106-
"W", # pycodestyle warnings
107-
"E", # pycodestyle errors
108-
"I", # isort
109-
"UP", # pyupgrade
110-
"ASYNC", # flake8-async
111-
"C4", # flake8-comprehensions
112-
"T10", # flake8-debugger
113-
"T20", # flake8-print
114-
"PYI", # flake8-pyi
115-
"PT", # flake8-pytest-style
116-
"Q", # flake8-quotes
117-
"TID", # flake8-tidy-imports
118-
"RUF", # Ruff-specific rules
108+
"F", # Pyflakes
109+
"W", # pycodestyle warnings
110+
"E", # pycodestyle errors
111+
"I", # isort
112+
"UP", # pyupgrade
113+
"ASYNC", # flake8-async
114+
"C4", # flake8-comprehensions
115+
"T10", # flake8-debugger
116+
"T20", # flake8-print
117+
"PYI", # flake8-pyi
118+
"PT", # flake8-pytest-style
119+
"Q", # flake8-quotes
120+
"TID", # flake8-tidy-imports
121+
"RUF", # Ruff-specific rules
119122
]
120123
ignore = [
121-
"E402", # module-import-not-at-top-of-file
124+
"E402", # module-import-not-at-top-of-file
122125
"UP037", # quoted-annotation
123-
"RUF001", # ambiguous-unicode-character-string
124-
"RUF002", # ambiguous-unicode-character-docstring
125-
"RUF003", # ambiguous-unicode-character-comment
126-
"W191", # indentation contains tabs
127-
"TID252", # relative import
126+
"RUF001", # ambiguous-unicode-character-string
127+
"RUF002", # ambiguous-unicode-character-docstring
128+
"RUF003", # ambiguous-unicode-character-comment
129+
"W191", # indentation contains tabs
130+
"TID252", # relative-import
128131
]
129132

130133
[tool.ruff.lint.isort]
131-
force-sort-within-sections = true
134+
length-sort = true
132135
known-first-party = ["tests/*"]
133136
extra-standard-library = ["typing_extensions"]
134137

135-
[tool.ruff.lint.flake8-pytest-style]
136-
fixture-parentheses = false
137-
mark-parentheses = false
138-
139138
[tool.ruff.lint.pyupgrade]
140139
keep-runtime-typing = true
141-
142-
[tool.uv]
143-
required-version = ">=0.9.0"
144-
default-groups = ["test", "dev"]

src/nonebot_plugin_template/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
type="application", # library
1515
homepage="https://github.com/owner/nonebot-plugin-template",
1616
config=Config,
17-
supported_adapters=inherit_supported_adapters("nonebot_plugin_alconna", "nonebot_plugin_uninfo"),
17+
supported_adapters=inherit_supported_adapters(
18+
"nonebot_plugin_alconna", "nonebot_plugin_uninfo"
19+
),
1820
# supported_adapters={"~onebot.v11"}, # 仅 onebot
1921
extra={"author": "owner <[email protected]>"},
2022
)
2123

22-
from arclet.alconna import Alconna, Args, Arparma, Option, Subcommand
24+
from arclet.alconna import Args, Option, Alconna, Arparma, Subcommand
2325
from nonebot_plugin_alconna import on_alconna
2426
from nonebot_plugin_alconna.uniseg import UniMessage
2527

0 commit comments

Comments
 (0)