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.

fix: determine cpu cores determination in baseedpyright-check script on macos (#28058)

Bowen Liang1369119a0c77
diff --git a/api/app.py b/api/app.py
index 4ed743dcb43..99f70f32d59 100644
--- a/api/app.py
+++ b/api/app.py
@@ -1,7 +1,7 @@
import sys
-def is_db_command():
+def is_db_command() -> bool:
if len(sys.argv) > 1 and sys.argv[0].endswith("flask") and sys.argv[1] == "db":
return True
return False
diff --git a/dev/basedpyright-check b/dev/basedpyright-check
index 1c87b27d6fa..1b3d1df7ad3 100755
--- a/dev/basedpyright-check
+++ b/dev/basedpyright-check
@@ -8,9 +8,14 @@ cd "$SCRIPT_DIR/.."
# Get the path argument if provided
PATH_TO_CHECK="$1"
-# run basedpyright checks
-if [ -n "$PATH_TO_CHECK" ]; then
- uv run --directory api --dev -- basedpyright --threads $(nproc) "$PATH_TO_CHECK"
-else
- uv run --directory api --dev -- basedpyright --threads $(nproc)
-fi
+# Determine CPU core count based on OS
+CPU_CORES=$(
+ if [[ "$(uname -s)" == "Darwin" ]]; then
+ sysctl -n hw.ncpu 2>/dev/null
+ else
+ nproc
+ fi
+)
+
+# Run basedpyright checks
+uv run --directory api --dev -- basedpyright --threads "$CPU_CORES" $PATH_TO_CHECK