Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧑‍💻 从 pdm 迁移到 uv #77

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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` 安装依赖。
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (documentation): 考虑添加安装 uv 的说明

提供一个安装 uv 的链接或命令可能会有所帮助,类似于之前版本提到的 pdm。这将使新贡献者更容易入门。

Original comment in English

suggestion (documentation): Consider adding instructions for installing uv

It might be helpful to provide a link or command for installing uv, similar to how the previous version mentioned pdm. This would make it easier for new contributors to get started.

Suggested change
KiramiBot 使用 [uv](https://docs.astral.sh/uv/) 管理项目依赖。请确保你已经安装了 uv,然后在项目根目录下运行 `uv sync` 安装依赖。
KiramiBot 使用 [uv](https://docs.astral.sh/uv/) 管理项目依赖。请按照 [uv 安装指南](https://github.com/astral-sh/uv#installation) 安装 uv。安装完成后,在项目根目录下运行 `uv sync` 安装依赖。
如果你使用 pip,可以通过以下命令安装 uv:

pip install uv


### 提交修改

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
Loading