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: enhance dev script robustness by determining the script directory (#19209)

Rajhans Jadhao8de24bc16e9d
diff --git a/dev/mypy-check b/dev/mypy-check
index 24cfb068246..c043faffe64 100755
--- a/dev/mypy-check
+++ b/dev/mypy-check
@@ -2,6 +2,9 @@
set -x
+SCRIPT_DIR="$(dirname "$(realpath "$0")")"
+cd "$SCRIPT_DIR/.."
+
# run mypy checks
uv run --directory api --dev --with pip \
python -m mypy --install-types --non-interactive --cache-fine-grained --sqlite-cache .
diff --git a/dev/pytest/pytest_all_tests.sh b/dev/pytest/pytest_all_tests.sh
index f0c8a785485..30898b4fcf2 100755
--- a/dev/pytest/pytest_all_tests.sh
+++ b/dev/pytest/pytest_all_tests.sh
@@ -1,6 +1,9 @@
#!/bin/bash
set -x
+SCRIPT_DIR="$(dirname "$(realpath "$0")")"
+cd "$SCRIPT_DIR/../.."
+
# ModelRuntime
dev/pytest/pytest_model_runtime.sh
diff --git a/dev/pytest/pytest_artifacts.sh b/dev/pytest/pytest_artifacts.sh
index d52acb22738..3086ef5cc4f 100755
--- a/dev/pytest/pytest_artifacts.sh
+++ b/dev/pytest/pytest_artifacts.sh
@@ -1,4 +1,7 @@
#!/bin/bash
set -x
+SCRIPT_DIR="$(dirname "$(realpath "$0")")"
+cd "$SCRIPT_DIR/../.."
+
pytest api/tests/artifact_tests/
diff --git a/dev/pytest/pytest_model_runtime.sh b/dev/pytest/pytest_model_runtime.sh
index dc6c6ac6273..2cbbbbfd81d 100755
--- a/dev/pytest/pytest_model_runtime.sh
+++ b/dev/pytest/pytest_model_runtime.sh
@@ -1,6 +1,9 @@
#!/bin/bash
set -x
+SCRIPT_DIR="$(dirname "$(realpath "$0")")"
+cd "$SCRIPT_DIR/../.."
+
pytest api/tests/integration_tests/model_runtime/anthropic \
api/tests/integration_tests/model_runtime/azure_openai \
api/tests/integration_tests/model_runtime/openai api/tests/integration_tests/model_runtime/chatglm \
diff --git a/dev/pytest/pytest_tools.sh b/dev/pytest/pytest_tools.sh
index 0b1a8c98779..d10934626fe 100755
--- a/dev/pytest/pytest_tools.sh
+++ b/dev/pytest/pytest_tools.sh
@@ -1,4 +1,7 @@
#!/bin/bash
set -x
+SCRIPT_DIR="$(dirname "$(realpath "$0")")"
+cd "$SCRIPT_DIR/../.."
+
pytest api/tests/integration_tests/tools
diff --git a/dev/pytest/pytest_unit_tests.sh b/dev/pytest/pytest_unit_tests.sh
index 2075596b7f5..1a1819ca28e 100755
--- a/dev/pytest/pytest_unit_tests.sh
+++ b/dev/pytest/pytest_unit_tests.sh
@@ -1,5 +1,8 @@
#!/bin/bash
set -x
+SCRIPT_DIR="$(dirname "$(realpath "$0")")"
+cd "$SCRIPT_DIR/../.."
+
# libs
pytest api/tests/unit_tests
diff --git a/dev/pytest/pytest_vdb.sh b/dev/pytest/pytest_vdb.sh
index dd03ca3514f..7f617a9c059 100755
--- a/dev/pytest/pytest_vdb.sh
+++ b/dev/pytest/pytest_vdb.sh
@@ -1,6 +1,9 @@
#!/bin/bash
set -x
+SCRIPT_DIR="$(dirname "$(realpath "$0")")"
+cd "$SCRIPT_DIR/../.."
+
pytest api/tests/integration_tests/vdb/chroma \
api/tests/integration_tests/vdb/milvus \
api/tests/integration_tests/vdb/pgvecto_rs \
diff --git a/dev/pytest/pytest_workflow.sh b/dev/pytest/pytest_workflow.sh
index db8fdb2fb9a..b63d49069f2 100755
--- a/dev/pytest/pytest_workflow.sh
+++ b/dev/pytest/pytest_workflow.sh
@@ -1,4 +1,7 @@
#!/bin/bash
set -x
+SCRIPT_DIR="$(dirname "$(realpath "$0")")"
+cd "$SCRIPT_DIR/../.."
+
pytest api/tests/integration_tests/workflow
diff --git a/dev/reformat b/dev/reformat
index 53d7703fcea..71cb6abb1e3 100755
--- a/dev/reformat
+++ b/dev/reformat
@@ -2,6 +2,9 @@
set -x
+SCRIPT_DIR="$(dirname "$(realpath "$0")")"
+cd "$SCRIPT_DIR/.."
+
# run ruff linter
uv run --directory api --dev ruff check --fix ./
diff --git a/dev/sync-uv b/dev/sync-uv
index 7bc3bb22be0..67a8133f5ab 100755
--- a/dev/sync-uv
+++ b/dev/sync-uv
@@ -6,5 +6,8 @@ if ! command -v uv &> /dev/null; then
pip install uv
fi
+SCRIPT_DIR="$(dirname "$(realpath "$0")")"
+cd "$SCRIPT_DIR/.."
+
# check uv.lock in sync with pyproject.toml
uv lock --project api