Skip to content

Commit 16f4a3f

Browse files
authored
🧑‍💻 Dev: 迁移使用 uv 管理项目依赖 (#50)
1 parent d726c40 commit 16f4a3f

7 files changed

Lines changed: 1665 additions & 1415 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "Default Linux Universal",
3-
"image": "mcr.microsoft.com/devcontainers/universal:2-linux",
2+
"name": "Ubuntu",
3+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
44
"features": {
5-
"ghcr.io/devcontainers-contrib/features/poetry:2": {}
5+
"ghcr.io/jsburckhardt/devcontainer-features/uv:1": {}
66
},
7-
"postCreateCommand": "poetry config virtualenvs.in-project true && poetry install && poetry run pre-commit install",
7+
"postCreateCommand": "uv sync && uv run pre-commit install",
88
"customizations": {
99
"vscode": {
1010
"settings": {

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,9 @@ inputs:
1010
runs:
1111
using: "composite"
1212
steps:
13-
- name: Install poetry
14-
run: pipx install poetry
15-
shell: bash
16-
17-
- uses: actions/setup-python@v6
13+
- uses: astral-sh/setup-uv@v6
1814
with:
1915
python-version: ${{ inputs.python-version }}
20-
cache: "poetry"
2116

22-
- run: poetry install
17+
- run: uv sync
2318
shell: bash

.github/workflows/codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232

3333
- name: Run Pytest
3434
run: |
35-
poetry run pytest -n auto --cov-append --cov-report xml
35+
uv run pytest -n auto --cov-append --cov-report xml
3636
3737
- name: Upload coverage report
3838
uses: codecov/codecov-action@v5

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Get Version
2121
id: version
2222
run: |
23-
echo "VERSION=$(poetry version -s)" >> $GITHUB_OUTPUT
23+
echo "VERSION=$(uv version --short)" >> $GITHUB_OUTPUT
2424
echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
2525
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
2626
@@ -29,7 +29,7 @@ jobs:
2929
run: exit 1
3030

3131
- name: Build
32-
run: poetry build
32+
run: uv build
3333

3434
- name: Publish a Python distribution to PyPI
3535
uses: pypa/gh-action-pypi-publish@release/v1

poetry.lock

Lines changed: 0 additions & 1376 deletions
This file was deleted.

pyproject.toml

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,45 @@
1-
[tool.poetry]
1+
[project]
22
name = "nonebot-plugin-localstore"
33
version = "0.7.4"
44
description = "Local Storage Support for NoneBot2"
5-
authors = ["yanyongyu <yyy@nonebot.dev>"]
6-
license = "MIT"
5+
authors = [{ name = "yanyongyu", email = "yyy@nonebot.dev" }]
6+
requires-python = ">=3.9,<4"
77
readme = "README.md"
8-
homepage = "https://github.com/nonebot/plugin-localstore"
9-
repository = "https://github.com/nonebot/plugin-localstore"
10-
documentation = "https://github.com/nonebot/plugin-localstore#readme"
8+
license = "MIT"
119
keywords = ["nonebot2", "qq", "plugin"]
10+
dependencies = [
11+
"nonebot2>=2.3.0,<3",
12+
"nonestorage>=0.1.0,<0.2",
13+
"typing-extensions>=4.0.0,<5",
14+
"pydantic>=1.10.0,<3.0.0,!=2.5.0,!=2.5.1",
15+
]
1216

13-
[tool.poetry.dependencies]
14-
python = "^3.9"
15-
nonebot2 = "^2.3.0"
16-
nonestorage = "^0.1.0"
17-
typing-extensions = "^4.0.0"
18-
pydantic = ">=1.10.0,<3.0.0,!=2.5.0,!=2.5.1"
19-
20-
[tool.poetry.group.dev.dependencies]
21-
ruff = "^0.9.0"
22-
nonebug = "^0.4.3"
23-
nonemoji = "^0.1.2"
24-
pre-commit = "^4.0.0"
25-
pytest-cov = "^6.0.0"
26-
pytest-xdist = "^3.6.1"
17+
[project.urls]
18+
Homepage = "https://github.com/nonebot/plugin-localstore"
19+
Repository = "https://github.com/nonebot/plugin-localstore"
20+
Documentation = "https://github.com/nonebot/plugin-localstore#readme"
2721

28-
[tool.poetry.plugins.nb_scripts]
22+
[project.entry-points.nb_scripts]
2923
localstore = "nonebot_plugin_localstore.script:main"
3024

25+
[dependency-groups]
26+
dev = [
27+
"ruff>=0.9.0,<0.10",
28+
"nonebug>=0.4.3,<0.5",
29+
"nonemoji>=0.1.2,<0.2",
30+
"pre-commit>=4.0.0,<5",
31+
"pytest-cov>=6.0.0,<7",
32+
"pytest-xdist>=3.6.1,<4",
33+
]
34+
35+
[build-system]
36+
requires = ["uv_build>=0.9.23,<0.10.0"]
37+
build-backend = "uv_build"
38+
39+
[tool.uv.build-backend]
40+
module-name = "nonebot_plugin_localstore"
41+
module-root = ""
42+
3143
[tool.pytest.ini_options]
3244
addopts = "--cov=./nonebot_plugin_localstore --cov-report=term-missing"
3345

@@ -78,7 +90,3 @@ pythonPlatform = "All"
7890
typeCheckingMode = "standard"
7991
reportShadowedImports = false
8092
disableBytesTypePromotions = true
81-
82-
[build-system]
83-
requires = ["poetry-core>=1.0.0"]
84-
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)