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

Feature/pyright check #1845

Merged
merged 16 commits into from
Mar 24, 2025
Merged

Feature/pyright check #1845

merged 16 commits into from
Mar 24, 2025

Conversation

HibiKier
Copy link
Owner

@HibiKier HibiKier commented Feb 8, 2025

No description provided.

@AkashiCoin AkashiCoin added the ci Issues related to automated workflows, build pipelines, and CI tools. label Feb 8, 2025
Copy link
Contributor

sourcery-ai bot commented Feb 8, 2025

审阅者指南 by Sourcery

这个拉取请求引入了新的 GitHub 工作流配置,以改进代码质量检查。它添加了 Pyright 类型检查和 Ruff 代码风格检查的工作流,并进一步将这些工作流链接成顺序工作流,以确保在进行类型检查之前先执行代码风格检查。此外,还更新了 VSCode 扩展建议以支持这些新工具。

顺序代码风格检查和类型检查工作流的序列图

sequenceDiagram
    participant Dev as Developer
    participant GH as GitHub Workflow Engine
    participant Ruff as Ruff Lint Workflow
    participant Pyright as Pyright Lint Workflow

    Dev->>GH: 触发 push/pull_request
    GH->>Ruff: 启动 Ruff 代码风格检查作业 (ruff-call)
    Ruff-->>GH: Ruff 作业完成
    GH->>Pyright: 启动 Pyright 类型检查作业 (pyright-call)
    Pyright-->>GH: Pyright 作业完成
    GH-->>Dev: 代码风格检查和类型检查反馈
Loading

文件级变更

变更 详情 文件
引入新的 GitHub 工作流进行 Pyright 类型检查。
  • 配置工作流在 push、pull_request 和手动触发事件中运行。
  • 设置矩阵策略,在 Python 3.10、3.11 和 3.12 版本上执行测试。
  • 包括检出代码、设置 Python、安装 Poetry、缓存依赖项和运行 Pyright 代码风格检查操作的步骤。
.github/workflows/pyright.yml
添加新的 GitHub 工作流进行 Ruff 代码风格检查。
  • 配置工作流在 push 和 pull_request 事件中触发,基于指定的文件路径变更。
  • 实现检出仓库、通过专用 GitHub Action 安装 Ruff,并执行 Ruff 检查和格式化命令的步骤。
.github/workflows/ruff.yml
创建顺序代码风格检查和类型检查工作流。
  • 定义一个工作流,首先调用 Ruff 代码风格检查工作流,然后调用 Pyright 工作流,确保代码风格检查在类型检查之前进行。
  • 使用作业依赖来强制执行两个工作流之间的执行顺序。
.github/workflows/linting.yml
更新 VSCode 扩展配置。
  • 修改扩展配置,包括与新的代码风格检查和类型检查工作流一致的建议或调整。
.vscode/extensions.json

提示和命令

与 Sourcery 交互

  • 触发新的审阅: 在拉取请求中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub 问题: 通过回复审阅评论,要求 Sourcery 创建一个问题。你也可以用 @sourcery-ai issue 回复审阅评论来创建问题。
  • 生成拉取请求标题: 在拉取请求标题的任何位置写 @sourcery-ai 以随时生成标题。你也可以在拉取请求中评论 @sourcery-ai title 以随时(重新)生成标题。
  • 生成拉取请求摘要: 在拉取请求正文的任何位置写 @sourcery-ai summary 以在你想要的确切位置生成 PR 摘要。你也可以在拉取请求中评论 @sourcery-ai summary 以随时(重新)生成摘要。
  • 生成审阅者指南: 在拉取请求中评论 @sourcery-ai guide 以随时(重新)生成审阅者指南。
  • 解决所有 Sourcery 评论: 在拉取请求中评论 @sourcery-ai resolve 以解决所有 Sourcery 评论。如果你已经处理了所有评论,不想再看到它们,这很有用。
  • 取消所有 Sourcery 审阅: 在拉取请求中评论 @sourcery-ai dismiss 以取消所有现有的 Sourcery 审阅。特别是当你想重新开始审阅时很有用 - 别忘了评论 @sourcery-ai review 以触发新的审阅!
  • 为问题生成行动计划: 在问题中评论 @sourcery-ai plan 以生成该问题的行动计划。

自定义你的体验

访问你的仪表板以:

  • 启用或禁用审阅功能,如 Sourcery 生成的拉取请求摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、删除或编辑自定义审阅说明。
  • 调整其他审阅设置。

获取帮助

Original review guide in English

Reviewer's Guide by Sourcery

This pull request introduces new GitHub workflow configurations to improve code quality checks. It adds workflows for Pyright type checking and Ruff linting, and further chains these in a sequential workflow to ensure that linting is performed before type checks. Additionally, there is an update to VSCode extension recommendations to support these new tools.

Sequence diagram for sequential lint and type check workflow

sequenceDiagram
    participant Dev as Developer
    participant GH as GitHub Workflow Engine
    participant Ruff as Ruff Lint Workflow
    participant Pyright as Pyright Lint Workflow

    Dev->>GH: Trigger push/pull_request
    GH->>Ruff: Start Ruff Lint Job (ruff-call)
    Ruff-->>GH: Ruff Job Complete
    GH->>Pyright: Start Pyright Lint Job (pyright-call)
    Pyright-->>GH: Pyright Job Complete
    GH-->>Dev: Feedback on Lint & Type Check
Loading

File-Level Changes

Change Details Files
Introduced a new GitHub workflow for Pyright type checking.
  • Configured the workflow to run on push, pull_request, and manual dispatch events.
  • Set up a matrix strategy to execute tests across Python versions 3.10, 3.11, and 3.12.
  • Included steps for checking out code, setting up Python, installing Poetry, caching dependencies, and running the Pyright lint action.
.github/workflows/pyright.yml
Added a new GitHub workflow for Ruff linting.
  • Configured the workflow to trigger on push and pull_request events based on specified file path changes.
  • Implemented steps for checking out the repository, installing Ruff via a dedicated GitHub Action, and executing Ruff check and format commands.
.github/workflows/ruff.yml
Created a sequential lint and type check workflow.
  • Defined a workflow that first calls the Ruff linting workflow and then the Pyright workflow, ensuring that linting precedes type checking.
  • Used job dependencies to enforce the execution order between the two workflows.
.github/workflows/linting.yml
Updated VSCode extensions configuration.
  • Modified the extensions configuration to include recommendations or adjustments that align with the new linting and type checking workflows.
.vscode/extensions.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@BalconyJH
Copy link
Collaborator

你现在的pyright action并没有进到你的环境里面导致ci爆掉

@BalconyJH BalconyJH marked this pull request as ready for review February 13, 2025 12:36
@BalconyJH BalconyJH linked an issue Feb 13, 2025 that may be closed by this pull request
@BalconyJH BalconyJH added the P0 Immediate action required. Blocking critical functionality. label Feb 22, 2025
@BalconyJH
Copy link
Collaborator

@sourcery-ai review

Copy link
Contributor

sourcery-ai bot commented Mar 1, 2025

Hi @BalconyJH! 👋

Only authors and team members can run @sourcery-ai commands on public repos.

Comment on lines 3 to 31
on:
workflow_call:
push:
branches:
- "*"
pull_request:
paths:
- "zhenxun/**"
- "tests/**"
- ".github/workflows/pyright.yml"
- "pyproject.toml"
- "poetry.lock"
workflow_dispatch:
inputs:
python-version:
description: "Python version"
required: false
type: choice
options:
- "all"
- "3.10"
- "3.11"
- "3.12"
default: "all"
debug-mode:
description: "enable debug mode"
required: false
type: boolean
default: false
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里改成只被workflow_call和手动触发吧,现在重复触发了

Comment on lines 3 to 14
on:
workflow_call:
push:
branches:
- "*"
pull_request:
paths:
- "zhenxun/**"
- "tests/**"
- ".github/workflows/ruff.yml"
- "pyproject.toml"
- "poetry.lock"
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里也是重复触发了

Comment on lines 31 to 32
- name: Run Ruff Format
run: ruff format
Copy link
Collaborator

Choose a reason for hiding this comment

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

删掉格式化,仅检查

@AkashiCoin AkashiCoin added the dependencies Tracks issues related to external dependencies or library updates. label Mar 16, 2025
@BalconyJH BalconyJH merged commit 737a740 into main Mar 24, 2025
12 checks passed
@BalconyJH BalconyJH deleted the feature/pyright-check branch March 24, 2025 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Issues related to automated workflows, build pipelines, and CI tools. dependencies Tracks issues related to external dependencies or library updates. P0 Immediate action required. Blocking critical functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: 增加 Pydantic 多版本验证
3 participants