Skip to content

Commit 463d230

Browse files
authored
feat: 在 pyproject.toml 中使用 dependency-groups (#169)
1 parent e5652fb commit 463d230

File tree

8 files changed

+283
-236
lines changed

8 files changed

+283
-236
lines changed

.github/actions/setup-python/action.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,3 @@ runs:
1919
uses: actions/setup-python@v5
2020
with:
2121
python-version: ${{ inputs.python-version }}
22-
23-
- name: Install the project
24-
run: uv sync --all-extras --dev
25-
shell: bash

.github/workflows/docs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ jobs:
2121
- name: Setup Python
2222
uses: ./.github/actions/setup-python
2323

24+
- name: Install the project
25+
run: uv sync --all-extras --all-packages --group dev --group docs
26+
shell: bash
27+
2428
- name: Build API Doc
2529
run: uv run sophia-doc alicebot -o docs/dev-api --anchor-extend --ignore-data --overwrite --exclude-module-name --init-file-name index.md
2630
shell: bash

.github/workflows/lint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- uses: actions/checkout@v4
1919
- name: Setup Python
2020
uses: ./.github/actions/setup-python
21+
- run: uv sync --all-extras --all-packages --group dev --group lint
2122
- run: |
2223
uv run ruff check --output-format=github .
2324
uv run ruff format --check .
@@ -28,6 +29,7 @@ jobs:
2829
- uses: actions/checkout@v4
2930
- name: Setup Python
3031
uses: ./.github/actions/setup-python
32+
- run: uv sync --all-extras --all-packages --group dev --group lint
3133
- run: uv run pylint alicebot packages/*
3234

3335
pyright:
@@ -38,6 +40,7 @@ jobs:
3840
uses: ./.github/actions/setup-python
3941
- name: Setup Node
4042
uses: ./.github/actions/setup-node
43+
- run: uv sync --all-extras --all-packages --all-groups
4144
- run: |
4245
source .venv/bin/activate
4346
pnpm run pyright
@@ -48,4 +51,5 @@ jobs:
4851
- uses: actions/checkout@v4
4952
- name: Setup Python
5053
uses: ./.github/actions/setup-python
54+
- run: uv sync --all-extras --all-packages --all-groups
5155
- run: uv run mypy .

.github/workflows/release.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ jobs:
1616
- name: Setup Python
1717
uses: ./.github/actions/setup-python
1818

19+
- name: Install the project
20+
run: uv sync --all-extras --all-packages --group dev --group docs
21+
shell: bash
22+
1923
- name: Remove API Doc
2024
run: rm -rf docs/api
2125
- name: Build API Doc
@@ -44,6 +48,10 @@ jobs:
4448
- name: Setup Python
4549
uses: ./.github/actions/setup-python
4650

51+
- name: Install the project
52+
run: uv sync --all-extras --all-packages --group dev
53+
shell: bash
54+
4755
- run: uv build -o dist
4856
shell: bash
4957

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ jobs:
3434
with:
3535
python-version: ${{ matrix.python-version }}
3636

37+
- name: Install the project
38+
run: uv sync --all-extras --all-packages --group dev --group test
39+
shell: bash
40+
3741
- name: Run pytest
3842
run: uv run pytest -n auto --cov-report xml
3943

.taplo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[formatting]
2+
array_auto_collapse = false

pyproject.toml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,24 @@ Documentation = "https://docs.alicebot.dev/"
5151
Repository = "https://github.com/AliceBotProject/alicebot"
5252
Changelog = "https://docs.alicebot.dev/changelog.html"
5353

54-
[tool.uv]
55-
dev-dependencies = [
56-
# dev
54+
[dependency-groups]
55+
dev = [
5756
"setuptools>=74",
5857
"trio>=0.26",
5958
"exceptiongroup>=1",
6059
"tomli>=2",
61-
# lint
60+
]
61+
lint = [
6262
"ruff>=0.6",
6363
"mypy>=1",
6464
"pylint>=3",
6565
"pylint-pydantic>=0.3",
66-
# docs
66+
]
67+
docs = [
6768
"sophia-doc>=0.1",
6869
"tomlkit>=0.13",
69-
# test
70+
]
71+
test = [
7072
"pytest>=8",
7173
"pytest-mock>=3",
7274
"pytest-xdist>=3",
@@ -84,10 +86,6 @@ alicebot-adapter-apscheduler = { workspace = true }
8486
[tool.uv.workspace]
8587
members = ["packages/*"]
8688

87-
[tool.ruff]
88-
line-length = 88
89-
target-version = "py39"
90-
9189
[tool.ruff.lint]
9290
select = ["ALL"]
9391
ignore = [

uv.lock

Lines changed: 253 additions & 222 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)