Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

chore: add local pyrefly exclude workflow (#33059)

盐粒 Yanli49dcf5e0d9d4
diff --git a/Makefile b/Makefile
index 0aff26b3e5a..55871c86a72 100644
--- a/Makefile
+++ b/Makefile
@@ -68,8 +68,9 @@ lint:
@echo "✅ Linting complete"
type-check:
- @echo "📝 Running type checks (basedpyright + mypy)..."
+ @echo "📝 Running type checks (basedpyright + pyrefly + mypy)..."
@./dev/basedpyright-check $(PATH_TO_CHECK)
+ @./dev/pyrefly-check-local
@uv --directory api run mypy --exclude-gitignore --exclude 'tests/' --exclude 'migrations/' --check-untyped-defs --disable-error-code=import-untyped .
@echo "✅ Type checks complete"
@@ -131,7 +132,7 @@ help:
@echo " make format - Format code with ruff"
@echo " make check - Check code with ruff"
@echo " make lint - Format, fix, and lint code (ruff, imports, dotenv)"
- @echo " make type-check - Run type checks (basedpyright, mypy)"
+ @echo " make type-check - Run type checks (basedpyright, pyrefly, mypy)"
@echo " make test - Run backend unit tests (or TARGET_TESTS=./api/tests/<target_tests>)"
@echo ""
@echo "Docker Build Targets:"
diff --git a/api/pyproject.toml b/api/pyproject.toml
index 3c89601dc5d..bf786f45849 100644
--- a/api/pyproject.toml
+++ b/api/pyproject.toml
@@ -247,3 +247,13 @@ module = [
"extensions.logstore.repositories.logstore_api_workflow_run_repository",
]
ignore_errors = true
+
+[tool.pyrefly]
+project-includes = ["."]
+project-excludes = [
+ ".venv",
+ "migrations/",
+]
+python-platform = "linux"
+python-version = "3.11.0"
+infer-with-first-use = false
diff --git a/api/pyrefly-local-excludes.txt b/api/pyrefly-local-excludes.txt
new file mode 100644
index 00000000000..d3b2ede7451
--- /dev/null
+++ b/api/pyrefly-local-excludes.txt
@@ -0,0 +1,200 @@
+configs/middleware/cache/redis_pubsub_config.py
+controllers/console/app/annotation.py
+controllers/console/app/app.py
+controllers/console/app/app_import.py
+controllers/console/app/mcp_server.py
+controllers/console/app/site.py
+controllers/console/auth/email_register.py
+controllers/console/human_input_form.py
+controllers/console/init_validate.py
+controllers/console/ping.py
+controllers/console/setup.py
+controllers/console/version.py
+controllers/console/workspace/trigger_providers.py
+controllers/service_api/app/annotation.py
+controllers/web/workflow_events.py
+core/agent/fc_agent_runner.py
+core/app/apps/advanced_chat/app_generator.py
+core/app/apps/advanced_chat/app_runner.py
+core/app/apps/advanced_chat/generate_task_pipeline.py
+core/app/apps/agent_chat/app_generator.py
+core/app/apps/base_app_generate_response_converter.py
+core/app/apps/base_app_generator.py
+core/app/apps/chat/app_generator.py
+core/app/apps/common/workflow_response_converter.py
+core/app/apps/completion/app_generator.py
+core/app/apps/pipeline/pipeline_generator.py
+core/app/apps/pipeline/pipeline_runner.py
+core/app/apps/workflow/app_generator.py
+core/app/apps/workflow/app_runner.py
+core/app/apps/workflow/generate_task_pipeline.py
+core/app/apps/workflow_app_runner.py
+core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py
+core/datasource/datasource_manager.py
+core/external_data_tool/api/api.py
+core/llm_generator/llm_generator.py
+core/llm_generator/output_parser/structured_output.py
+core/mcp/mcp_client.py
+core/ops/aliyun_trace/data_exporter/traceclient.py
+core/ops/arize_phoenix_trace/arize_phoenix_trace.py
+core/ops/mlflow_trace/mlflow_trace.py
+core/ops/ops_trace_manager.py
+core/ops/tencent_trace/client.py
+core/ops/tencent_trace/utils.py
+core/plugin/backwards_invocation/base.py
+core/plugin/backwards_invocation/model.py
+core/prompt/utils/extract_thread_messages.py
+core/rag/datasource/keyword/jieba/jieba.py
+core/rag/datasource/keyword/jieba/jieba_keyword_table_handler.py
+core/rag/datasource/vdb/analyticdb/analyticdb_vector.py
+core/rag/datasource/vdb/analyticdb/analyticdb_vector_openapi.py
+core/rag/datasource/vdb/baidu/baidu_vector.py
+core/rag/datasource/vdb/chroma/chroma_vector.py
+core/rag/datasource/vdb/clickzetta/clickzetta_vector.py
+core/rag/datasource/vdb/couchbase/couchbase_vector.py
+core/rag/datasource/vdb/elasticsearch/elasticsearch_vector.py
+core/rag/datasource/vdb/huawei/huawei_cloud_vector.py
+core/rag/datasource/vdb/lindorm/lindorm_vector.py
+core/rag/datasource/vdb/matrixone/matrixone_vector.py
+core/rag/datasource/vdb/milvus/milvus_vector.py
+core/rag/datasource/vdb/myscale/myscale_vector.py
+core/rag/datasource/vdb/oceanbase/oceanbase_vector.py
+core/rag/datasource/vdb/opensearch/opensearch_vector.py
+core/rag/datasource/vdb/oracle/oraclevector.py
+core/rag/datasource/vdb/pgvecto_rs/pgvecto_rs.py
+core/rag/datasource/vdb/relyt/relyt_vector.py
+core/rag/datasource/vdb/tablestore/tablestore_vector.py
+core/rag/datasource/vdb/tencent/tencent_vector.py
+core/rag/datasource/vdb/tidb_on_qdrant/tidb_on_qdrant_vector.py
+core/rag/datasource/vdb/tidb_on_qdrant/tidb_service.py
+core/rag/datasource/vdb/tidb_vector/tidb_vector.py
+core/rag/datasource/vdb/upstash/upstash_vector.py
+core/rag/datasource/vdb/vikingdb/vikingdb_vector.py
+core/rag/datasource/vdb/weaviate/weaviate_vector.py
+core/rag/extractor/csv_extractor.py
+core/rag/extractor/excel_extractor.py
+core/rag/extractor/firecrawl/firecrawl_app.py
+core/rag/extractor/firecrawl/firecrawl_web_extractor.py
+core/rag/extractor/html_extractor.py
+core/rag/extractor/jina_reader_extractor.py
+core/rag/extractor/markdown_extractor.py
+core/rag/extractor/notion_extractor.py
+core/rag/extractor/pdf_extractor.py
+core/rag/extractor/text_extractor.py
+core/rag/extractor/unstructured/unstructured_doc_extractor.py
+core/rag/extractor/unstructured/unstructured_eml_extractor.py
+core/rag/extractor/unstructured/unstructured_epub_extractor.py
+core/rag/extractor/unstructured/unstructured_markdown_extractor.py
+core/rag/extractor/unstructured/unstructured_msg_extractor.py
+core/rag/extractor/unstructured/unstructured_ppt_extractor.py
+core/rag/extractor/unstructured/unstructured_pptx_extractor.py
+core/rag/extractor/unstructured/unstructured_xml_extractor.py
+core/rag/extractor/watercrawl/client.py
+core/rag/extractor/watercrawl/extractor.py
+core/rag/extractor/watercrawl/provider.py
+core/rag/extractor/word_extractor.py
+core/rag/index_processor/processor/paragraph_index_processor.py
+core/rag/index_processor/processor/parent_child_index_processor.py
+core/rag/index_processor/processor/qa_index_processor.py
+core/rag/retrieval/router/multi_dataset_function_call_router.py
+core/rag/summary_index/summary_index.py
+core/repositories/sqlalchemy_workflow_execution_repository.py
+core/repositories/sqlalchemy_workflow_node_execution_repository.py
+core/tools/__base/tool.py
+core/tools/mcp_tool/provider.py
+core/tools/plugin_tool/provider.py
+core/tools/utils/message_transformer.py
+core/tools/utils/web_reader_tool.py
+core/tools/workflow_as_tool/provider.py
+core/trigger/debug/event_selectors.py
+core/trigger/entities/entities.py
+core/trigger/provider.py
+core/workflow/workflow_entry.py
+dify_graph/entities/workflow_execution.py
+dify_graph/file/file_manager.py
+dify_graph/graph_engine/error_handler.py
+dify_graph/graph_engine/layers/execution_limits.py
+dify_graph/nodes/agent/agent_node.py
+dify_graph/nodes/base/node.py
+dify_graph/nodes/code/code_node.py
+dify_graph/nodes/datasource/datasource_node.py
+dify_graph/nodes/document_extractor/node.py
+dify_graph/nodes/human_input/human_input_node.py
+dify_graph/nodes/if_else/if_else_node.py
+dify_graph/nodes/iteration/iteration_node.py
+dify_graph/nodes/knowledge_index/knowledge_index_node.py
+dify_graph/nodes/knowledge_retrieval/knowledge_retrieval_node.py
+dify_graph/nodes/list_operator/node.py
+dify_graph/nodes/llm/node.py
+dify_graph/nodes/loop/loop_node.py
+dify_graph/nodes/parameter_extractor/parameter_extractor_node.py
+dify_graph/nodes/question_classifier/question_classifier_node.py
+dify_graph/nodes/start/start_node.py
+dify_graph/nodes/template_transform/template_transform_node.py
+dify_graph/nodes/tool/tool_node.py
+dify_graph/nodes/trigger_plugin/trigger_event_node.py
+dify_graph/nodes/trigger_schedule/trigger_schedule_node.py
+dify_graph/nodes/trigger_webhook/node.py
+dify_graph/nodes/variable_aggregator/variable_aggregator_node.py
+dify_graph/nodes/variable_assigner/v1/node.py
+dify_graph/nodes/variable_assigner/v2/node.py
+dify_graph/variables/types.py
+extensions/ext_fastopenapi.py
+extensions/logstore/repositories/logstore_api_workflow_run_repository.py
+extensions/otel/instrumentation.py
+extensions/otel/runtime.py
+extensions/storage/aliyun_oss_storage.py
+extensions/storage/aws_s3_storage.py
+extensions/storage/azure_blob_storage.py
+extensions/storage/baidu_obs_storage.py
+extensions/storage/clickzetta_volume/clickzetta_volume_storage.py
+extensions/storage/clickzetta_volume/file_lifecycle.py
+extensions/storage/google_cloud_storage.py
+extensions/storage/huawei_obs_storage.py
+extensions/storage/opendal_storage.py
+extensions/storage/oracle_oci_storage.py
+extensions/storage/supabase_storage.py
+extensions/storage/tencent_cos_storage.py
+extensions/storage/volcengine_tos_storage.py
+factories/variable_factory.py
+libs/external_api.py
+libs/gmpy2_pkcs10aep_cipher.py
+libs/helper.py
+libs/login.py
+libs/module_loading.py
+libs/oauth.py
+libs/oauth_data_source.py
+models/trigger.py
+models/workflow.py
+repositories/sqlalchemy_api_workflow_node_execution_repository.py
+repositories/sqlalchemy_api_workflow_run_repository.py
+repositories/sqlalchemy_execution_extra_content_repository.py
+schedule/queue_monitor_task.py
+services/account_service.py
+services/audio_service.py
+services/auth/firecrawl/firecrawl.py
+services/auth/jina.py
+services/auth/jina/jina.py
+services/auth/watercrawl/watercrawl.py
+services/conversation_service.py
+services/dataset_service.py
+services/document_indexing_proxy/document_indexing_task_proxy.py
+services/document_indexing_proxy/duplicate_document_indexing_task_proxy.py
+services/external_knowledge_service.py
+services/plugin/plugin_migration.py
+services/recommend_app/buildin/buildin_retrieval.py
+services/recommend_app/database/database_retrieval.py
+services/recommend_app/remote/remote_retrieval.py
+services/summary_index_service.py
+services/tools/tools_transform_service.py
+services/trigger/trigger_provider_service.py
+services/trigger/trigger_subscription_builder_service.py
+services/trigger/webhook_service.py
+services/workflow_draft_variable_service.py
+services/workflow_event_snapshot_service.py
+services/workflow_service.py
+tasks/app_generate/workflow_execute_task.py
+tasks/regenerate_summary_index_task.py
+tasks/trigger_processing_tasks.py
+tasks/workflow_cfs_scheduler/cfs_scheduler.py
+tasks/workflow_execution_tasks.py
diff --git a/api/pyrefly.toml b/api/pyrefly.toml
deleted file mode 100644
index 01f4c5a5292..00000000000
--- a/api/pyrefly.toml
+++ /dev/null
@@ -1,8 +0,0 @@
-project-includes = ["."]
-project-excludes = [
- ".venv",
- "migrations/",
-]
-python-platform = "linux"
-python-version = "3.11.0"
-infer-with-first-use = false
diff --git a/dev/pyrefly-check-local b/dev/pyrefly-check-local
new file mode 100755
index 00000000000..80f90927bb1
--- /dev/null
+++ b/dev/pyrefly-check-local
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+set -euo pipefail
+
+SCRIPT_DIR="$(dirname "$(realpath "$0")")"
+REPO_ROOT="$SCRIPT_DIR/.."
+cd "$REPO_ROOT"
+
+EXCLUDES_FILE="api/pyrefly-local-excludes.txt"
+
+pyrefly_args=(
+ "--summary=none"
+ "--project-excludes=.venv"
+ "--project-excludes=migrations/"
+ "--project-excludes=tests/"
+)
+
+if [[ -f "$EXCLUDES_FILE" ]]; then
+ while IFS= read -r exclude; do
+ [[ -z "$exclude" || "${exclude:0:1}" == "#" ]] && continue
+ pyrefly_args+=("--project-excludes=$exclude")
+ done < "$EXCLUDES_FILE"
+fi
+
+tmp_output="$(mktemp)"
+set +e
+uv run --directory api --dev pyrefly check "${pyrefly_args[@]}" >"$tmp_output" 2>&1
+pyrefly_status=$?
+set -e
+
+uv run --directory api python libs/pyrefly_diagnostics.py < "$tmp_output"
+rm -f "$tmp_output"
+
+exit "$pyrefly_status"