Skip to content
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
8 changes: 5 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"name": "Default Linux Universal",
"image": "mcr.microsoft.com/devcontainers/universal:2-linux",
"name": "Ubuntu",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers-extra/features/poetry:2": {}
"ghcr.io/jsburckhardt/devcontainer-features/uv:1": {},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/meaningful-ooo/devcontainer-features/fish:2": {}
},
"postCreateCommand": "./scripts/setup-envs.sh",
"customizations": {
Expand Down
7 changes: 1 addition & 6 deletions .github/actions/build-api-doc/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,5 @@ runs:
using: "composite"
steps:
- run: |
poetry run nb-autodoc nonebot \
-s nonebot.plugins \
-u nonebot.internal \
-u nonebot.internal.*
cp -r ./build/nonebot/* ./website/docs/api/
yarn prettier
uv run --no-sync bash ./scripts/build-api-docs.sh
shell: bash
30 changes: 7 additions & 23 deletions .github/actions/setup-python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,20 @@ inputs:
python-version:
description: Python version
required: false
default: "3.10"
env-dir:
description: Environment directory
default: "3.12"
env-group:
description: Environment group
required: false
default: "."
no-root:
description: Do not install package in the environment
required: false
default: "false"
default: "pydantic-v2"

runs:
using: "composite"
steps:
- name: Install poetry
run: pipx install poetry
shell: bash

- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v6
with:
python-version: ${{ inputs.python-version }}
cache: "poetry"
cache-dependency-path: |
./poetry.lock
${{ inputs.env-dir }}/poetry.lock
cache-suffix: ${{ inputs.env-group }}

- run: |
cd ${{ inputs.env-dir }}
if [ "${{ inputs.no-root }}" = "true" ]; then
poetry install --all-extras --no-root
else
poetry install --all-extras
fi
uv sync --all-extras --locked --group ${{ inputs.env-group }}
shell: bash
8 changes: 3 additions & 5 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- ".github/actions/setup-python/**"
- ".github/workflows/codecov.yml"
- "pyproject.toml"
- "poetry.lock"
- "uv.lock"

jobs:
test:
Expand All @@ -40,13 +40,11 @@ jobs:
uses: ./.github/actions/setup-python
with:
python-version: ${{ matrix.python-version }}
env-dir: ./envs/${{ matrix.env }}
no-root: true
env-group: ${{ matrix.env }}

- name: Run Pytest
run: |
cd ./envs/${{ matrix.env }}
poetry run bash "../../scripts/run-tests.sh"
uv run --no-sync bash ./scripts/run-tests.sh

- name: Upload test results
uses: codecov/test-results-action@v1
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/pyright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- ".github/actions/setup-python/**"
- ".github/workflows/pyright.yml"
- "pyproject.toml"
- "poetry.lock"
- "uv.lock"

jobs:
pyright:
Expand All @@ -33,11 +33,10 @@ jobs:
- name: Setup Python environment
uses: ./.github/actions/setup-python
with:
env-dir: ./envs/${{ matrix.env }}
no-root: true
env-group: ${{ matrix.env }}

- run: |
(cd ./envs/${{ matrix.env }} && echo "$(poetry env info --path)/bin" >> $GITHUB_PATH)
echo "$(dirname $(uv python find))" >> $GITHUB_PATH
if [ "${{ matrix.env }}" = "pydantic-v1" ]; then
sed -i 's/PYDANTIC_V2 = true/PYDANTIC_V2 = false/g' ./pyproject.toml
fi
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
- name: Get Version
id: version
run: |
echo "VERSION=$(poetry version -s)" >> $GITHUB_OUTPUT
echo "VERSION=$(uv version --short)" >> $GITHUB_OUTPUT
echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

Expand All @@ -102,10 +102,8 @@ jobs:

- name: Build Package
run: |
poetry build

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uv build
uv publish

- name: Publish package to GitHub
run: |
Expand All @@ -117,13 +115,9 @@ jobs:
run: |
yarn build:plugin --out-dir ../packages/nonebot-plugin-docs/nonebot_plugin_docs/dist
cd packages/nonebot-plugin-docs/
poetry version ${{ steps.version.outputs.VERSION }}
poetry build

- name: Publish Doc Package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: packages/nonebot-plugin-docs/dist/
uv version ${{ steps.version.outputs.VERSION }}
uv build
uv publish

- name: Publish Doc Package to GitHub
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Build API Doc
uses: ./.github/actions/build-api-doc

- run: echo "TAG_NAME=v$(poetry version -s)" >> $GITHUB_ENV
- run: echo "TAG_NAME=v$(uv version --short)" >> $GITHUB_ENV

- name: Archive Changelog
uses: docker://ghcr.io/nonebot/auto-changelog:master
Expand All @@ -39,14 +39,14 @@ jobs:

- name: Archive Files
run: |
yarn archive $(poetry version -s)
yarn archive $(uv version --short)
yarn prettier

- name: Push Tag
run: |
git config user.name noneflow[bot]
git config user.email 129742071+noneflow[bot]@users.noreply.github.com
git add .
git commit -m ":bookmark: Release $(poetry version -s)"
git commit -m ":bookmark: Release $(uv version --short)"
git tag ${{ env.TAG_NAME }}
git push && git push --tags
2 changes: 1 addition & 1 deletion .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- ".github/actions/setup-python/**"
- ".github/workflows/ruff.yml"
- "pyproject.toml"
- "poetry.lock"
- "uv.lock"

jobs:
ruff:
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

## Pull Request

NoneBot 使用 [poetry](https://python-poetry.org/) 管理项目依赖,由于 pre-commit 也经其管理,所以在此一并说明。
NoneBot 使用 [uv](https://docs.astral.sh/uv/) 管理项目依赖,由于 pre-commit 也经其管理,所以在此一并说明。

下面的命令能在已安装 poetry 和 yarn 的情况下帮你快速配置开发环境。
下面的命令能在已安装 uv 和 yarn 的情况下帮你快速配置开发环境。

```bash
# 安装 python 依赖
poetry install
uv sync --all-extras
# 安装 pre-commit git hook
pre-commit install
uv run pre-commit install
```

### 使用 GitHub Codespaces(Dev Container)
Expand Down
Loading
Loading