Skip to content

Commit

Permalink
🧑‍💻 从 pdm 迁移到 uv
Browse files Browse the repository at this point in the history
  • Loading branch information
A-kirami committed Oct 23, 2024
1 parent c997baa commit 8474bc5
Show file tree
Hide file tree
Showing 6 changed files with 1,243 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

如果你不想使用代码空间或者开发容器,你可以在本地环境中开发。

KiramiBot 使用 [pdm](https://pdm.fming.dev/) 管理项目依赖。请确保你已经安装了 pdm,然后在项目根目录下运行 `pdm install` 安装依赖。
KiramiBot 使用 [uv](https://docs.astral.sh/uv/) 管理项目依赖。请确保你已经安装了 uv,然后在项目根目录下运行 `uv sync` 安装依赖。

### 提交修改

Expand Down
24 changes: 16 additions & 8 deletions .github/workflows/pyright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,24 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: pdm-project/setup-pdm@v3
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
python-version: '3.12'
cache: true
version: 0.4.25
enable-cache: true

- name: Install dependencies
run: pdm install
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"

- name: Install Project
run: uv sync --frozen

- name: Add pdm to PATH
run: echo "$(pdm venv --path in-project)/bin" >> $GITHUB_PATH
- name: Use Virtualenv
run: echo "$PWD/.venv/bin" >> $GITHUB_PATH

- name: Run Pyright
uses: jakebailey/pyright-action@v1
uses: jakebailey/pyright-action@v2
with:
pylance-version: latest-release
15 changes: 12 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,19 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: pdm-project/setup-pdm@v3
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: 0.4.25
enable-cache: true

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"

- name: Build distributions
run: pdm build
run: uv build --no-sources

- run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

Expand All @@ -35,4 +44,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to PyPI
run: pdm publish --no-build
run: uv publish
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
21 changes: 12 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,26 @@ homepage = "https://kirami.bot"
repository = "https://github.com/A-kirami/KiramiBot"
documentation = "https://kirami.bot/docs"

[tool.pdm.dev-dependencies]
dev = [
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["kirami"]

[tool.uv]
dev-dependencies = [
"ruff>=0.7.0",
"pre-commit>=4.0.1"
"pre-commit>=4.0.1",
"poethepoet>=0.29.0",
]

[tool.pdm.scripts]
[tool.poe.tasks]
lint = "ruff check"
"lint:fix" = "ruff check --fix"
format = "ruff format"
post_install = "pre-commit install"

[tool.pyright]
pythonVersion = "3.12"
pythonPlatform = "All"
typeCheckingMode = "basic"

[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"
Loading

0 comments on commit 8474bc5

Please sign in to comment.