[PR #1792] [CLOSED] Add basedpyright type checking infrastructure to dify-official-plugins #2087

Closed
opened 2026-02-16 11:16:04 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-official-plugins/pull/1792
Author: @Copilot
Created: 9/30/2025
Status: Closed

Base: mainHead: copilot/fix-d8d029a8-4886-4f01-b709-f21caf2b09f2


📝 Commits (5)

  • d268072 Initial plan
  • 0594260 Add basedpyright type checking infrastructure
  • 9cfa787 Add comprehensive development documentation and improve type checking script
  • 13ce9f9 Delete DEVELOPMENT.md
  • 74c1ab0 Delete Makefile

📊 Changes

7 files changed (+209 additions, -3 deletions)

View changed files

📝 .github/workflows/pre-check-plugin.yaml (+9 -0)
.github/workflows/type-check.yml (+66 -0)
📝 .gitignore (+4 -3)
📝 README.md (+16 -0)
dev/basedpyright-check (+60 -0)
pyproject.toml (+21 -0)
pyrightconfig.json (+33 -0)

📄 Description

This PR implements comprehensive type checking infrastructure using basedpyright for the dify-official-plugins repository, mirroring the type checking setup from the main Dify repository.

Overview

Adds static type checking capabilities to improve code quality and catch type-related bugs during development and CI/CD processes.

Changes Made

Core Infrastructure

  • pyproject.toml - Root configuration with basedpyright development dependency
  • pyrightconfig.json - Type checking configuration optimized for plugin development
  • dev/basedpyright-check - Cross-platform executable script supporting both uv and direct Python execution
  • Makefile - Development targets for type checking, linting, and other common tasks

CI/CD Integration

  • .github/workflows/type-check.yml - Dedicated type checking workflow
  • Updated .github/workflows/pre-check-plugin.yaml - Integrated type checking into existing plugin validation

Documentation

  • DEVELOPMENT.md - Comprehensive development guide covering type checking, setup, and best practices
  • Updated README.md - Added development section with quick start commands
  • Updated .gitignore - Excludes type checking artifacts

Key Features

Flexible Execution

The type checking infrastructure works in multiple environments:

# Using uv (preferred when available)
make type-check

# Direct Python execution (fallback)
./dev/basedpyright-check models/openai

# Path-specific checking
make type-check-path PATH=tools/google_search

Sensible Configuration

The pyrightconfig.json is tuned for plugin development:

  • Disabled missing import errors (plugins have external dependencies)
  • Relaxed unknown type warnings (external library compatibility)
  • Enabled useful checks (unused imports, unnecessary casts, duplicate imports)
  • Basic type checking mode (balanced strictness)

CI Integration

Type checking automatically runs on:

  • Pull requests with Python file changes
  • Plugin-specific validation during pre-check workflow
  • Configurable to run on specific paths or entire repository

Testing

The implementation has been verified with existing plugins:

# Example output showing real type issues found
$ ./dev/basedpyright-check tools/dingo
Found 4 source files
tools/dingo/tools/text_quality_evaluator.py:22:76 - error: Expression of type "None" cannot be assigned to parameter of type "List[str]"
tools/dingo/tools/text_quality_evaluator.py:75:62 - error: Expression of type "None" cannot be assigned to parameter of type "List[str]"
tools/dingo/tools/text_quality_evaluator.py:137:13 - error: Declaration "issues" is obscured by a declaration of the same name
3 errors, 0 warnings, 0 notes

Benefits

  • Early Error Detection: Catch type-related bugs before runtime
  • Improved Code Quality: Encourage proper type annotations and safer code patterns
  • Developer Experience: IDE integration for real-time type checking
  • Consistent Standards: Align with main Dify repository's development practices
  • CI/CD Safety: Prevent type-unsafe code from being merged

Usage for Developers

Quick start:

# Set up development environment
make setup

# Check entire repository
make type-check

# Check specific plugin
make type-check-path PATH=models/gemini

# All development commands
make help

This implementation follows the same patterns and configuration philosophy as the main Dify repository, ensuring consistency across the ecosystem while being tailored for the unique requirements of plugin development.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • astral.sh
    • Triggering command: curl -LsSf REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>add basedpyright to do type check</issue_title>
<issue_description>### Self Checks

  • I have read the Contributing Guide and Language Policy.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

same as dify

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes langgenius/dify-official-plugins#1791

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/dify-official-plugins/pull/1792 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 9/30/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `copilot/fix-d8d029a8-4886-4f01-b709-f21caf2b09f2` --- ### 📝 Commits (5) - [`d268072`](https://github.com/langgenius/dify-official-plugins/commit/d2680729dde7ddf262edf5b54e8a0539ed6b5558) Initial plan - [`0594260`](https://github.com/langgenius/dify-official-plugins/commit/0594260a3d0b2aa6e32ed1ce7a9cfb5d9b4c8615) Add basedpyright type checking infrastructure - [`9cfa787`](https://github.com/langgenius/dify-official-plugins/commit/9cfa7875c47531acfcd203e0455d5dfb59dda0df) Add comprehensive development documentation and improve type checking script - [`13ce9f9`](https://github.com/langgenius/dify-official-plugins/commit/13ce9f9db5526628bd4201cb6d6f2e716bc2a717) Delete DEVELOPMENT.md - [`74c1ab0`](https://github.com/langgenius/dify-official-plugins/commit/74c1ab02674647c2935e0fd8d8311cf5fff55d19) Delete Makefile ### 📊 Changes **7 files changed** (+209 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/pre-check-plugin.yaml` (+9 -0) ➕ `.github/workflows/type-check.yml` (+66 -0) 📝 `.gitignore` (+4 -3) 📝 `README.md` (+16 -0) ➕ `dev/basedpyright-check` (+60 -0) ➕ `pyproject.toml` (+21 -0) ➕ `pyrightconfig.json` (+33 -0) </details> ### 📄 Description This PR implements comprehensive type checking infrastructure using `basedpyright` for the dify-official-plugins repository, mirroring the type checking setup from the main Dify repository. ## Overview Adds static type checking capabilities to improve code quality and catch type-related bugs during development and CI/CD processes. ## Changes Made ### Core Infrastructure - **`pyproject.toml`** - Root configuration with basedpyright development dependency - **`pyrightconfig.json`** - Type checking configuration optimized for plugin development - **`dev/basedpyright-check`** - Cross-platform executable script supporting both `uv` and direct Python execution - **`Makefile`** - Development targets for type checking, linting, and other common tasks ### CI/CD Integration - **`.github/workflows/type-check.yml`** - Dedicated type checking workflow - **Updated `.github/workflows/pre-check-plugin.yaml`** - Integrated type checking into existing plugin validation ### Documentation - **`DEVELOPMENT.md`** - Comprehensive development guide covering type checking, setup, and best practices - **Updated `README.md`** - Added development section with quick start commands - **Updated `.gitignore`** - Excludes type checking artifacts ## Key Features ### Flexible Execution The type checking infrastructure works in multiple environments: ```bash # Using uv (preferred when available) make type-check # Direct Python execution (fallback) ./dev/basedpyright-check models/openai # Path-specific checking make type-check-path PATH=tools/google_search ``` ### Sensible Configuration The pyrightconfig.json is tuned for plugin development: - Disabled missing import errors (plugins have external dependencies) - Relaxed unknown type warnings (external library compatibility) - Enabled useful checks (unused imports, unnecessary casts, duplicate imports) - Basic type checking mode (balanced strictness) ### CI Integration Type checking automatically runs on: - Pull requests with Python file changes - Plugin-specific validation during pre-check workflow - Configurable to run on specific paths or entire repository ## Testing The implementation has been verified with existing plugins: ```bash # Example output showing real type issues found $ ./dev/basedpyright-check tools/dingo Found 4 source files tools/dingo/tools/text_quality_evaluator.py:22:76 - error: Expression of type "None" cannot be assigned to parameter of type "List[str]" tools/dingo/tools/text_quality_evaluator.py:75:62 - error: Expression of type "None" cannot be assigned to parameter of type "List[str]" tools/dingo/tools/text_quality_evaluator.py:137:13 - error: Declaration "issues" is obscured by a declaration of the same name 3 errors, 0 warnings, 0 notes ``` ## Benefits - **Early Error Detection**: Catch type-related bugs before runtime - **Improved Code Quality**: Encourage proper type annotations and safer code patterns - **Developer Experience**: IDE integration for real-time type checking - **Consistent Standards**: Align with main Dify repository's development practices - **CI/CD Safety**: Prevent type-unsafe code from being merged ## Usage for Developers Quick start: ```bash # Set up development environment make setup # Check entire repository make type-check # Check specific plugin make type-check-path PATH=models/gemini # All development commands make help ``` This implementation follows the same patterns and configuration philosophy as the main Dify repository, ensuring consistency across the ecosystem while being tailored for the unique requirements of plugin development. > [!WARNING] > > <details> > <summary>Firewall rules blocked me from connecting to one or more addresses (expand for details)</summary> > > #### I tried to connect to the following addresses, but was blocked by firewall rules: > > - `astral.sh` > - Triggering command: `curl -LsSf REDACTED` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/langgenius/dify-official-plugins/settings/copilot/coding_agent) (admins only) > > </details> <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>add basedpyright to do type check</issue_title> > <issue_description>### Self Checks > > - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). > - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify-official-plugins/issues), including closed ones. > - [x] I confirm that I am using English to submit this report, otherwise it will be closed. > - [x] Please do not modify this template :) and fill in all the required fields. > > ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. > > same as dify > > ### 2. Additional context or comments > > _No response_ > > ### 3. Can you help us with this feature? > > - [x] I am interested in contributing to this feature.</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> Fixes langgenius/dify-official-plugins#1791 <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 11:16:04 -05:00
yindo closed this issue 2026-02-16 11:16:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#2087