mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 13:18:18 +00:00
Setup vscode launch.json and configure pytests for dev container
This commit is contained in:
@@ -35,11 +35,16 @@
|
|||||||
"--profile",
|
"--profile",
|
||||||
"black",
|
"black",
|
||||||
"--filter-files"
|
"--filter-files"
|
||||||
]
|
],
|
||||||
|
"python.testing.pytestArgs": [
|
||||||
|
"tests"
|
||||||
|
],
|
||||||
|
"python.testing.unittestEnabled": false,
|
||||||
|
"python.testing.pytestEnabled": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"postCreateCommand": "scripts/dev_setup.sh",
|
"postCreateCommand": "scripts/dev_setup.sh --devcontainer",
|
||||||
"features": {
|
"features": {
|
||||||
"ghcr.io/devcontainers-contrib/features/black:2": {},
|
"ghcr.io/devcontainers-contrib/features/black:2": {},
|
||||||
"ghcr.io/devcontainers-contrib/features/mypy:2": {},
|
"ghcr.io/devcontainers-contrib/features/mypy:2": {},
|
||||||
|
|||||||
@@ -2,14 +2,18 @@
|
|||||||
# ---
|
# ---
|
||||||
PROJECT_ROOT=$(git rev-parse --show-toplevel)
|
PROJECT_ROOT=$(git rev-parse --show-toplevel)
|
||||||
|
|
||||||
# Default to minimal installation unless --full flag passed
|
# Default is a minimal, local installation unless config flags are set.
|
||||||
INSTALL_FULL=false
|
INSTALL_FULL=false
|
||||||
|
DEVCONTAINER=false
|
||||||
for arg in "$@"
|
for arg in "$@"
|
||||||
do
|
do
|
||||||
if [ "$arg" == "--full" ]
|
if [ "$arg" == "--full" ]
|
||||||
then
|
then
|
||||||
INSTALL_FULL=true
|
INSTALL_FULL=true
|
||||||
break
|
fi
|
||||||
|
if [ "$arg" == "--devcontainer" ]
|
||||||
|
then
|
||||||
|
DEVCONTAINER=true
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -42,6 +46,74 @@ if [ "$INSTALL_FULL" = true ] ; then
|
|||||||
yarn install
|
yarn install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Create .vscode/launch.json if it doesn't exist
|
||||||
|
# ---
|
||||||
|
VSCODE_DIR="$PROJECT_ROOT/.vscode"
|
||||||
|
LAUNCH_JSON_PATH="$VSCODE_DIR/launch.json"
|
||||||
|
|
||||||
|
# Overwrite project vscode launch.json in devcontainer
|
||||||
|
# ---
|
||||||
|
# Differs from default launch.json with sudo true.
|
||||||
|
# Required by pgserver in github codespaces, not in local dev.
|
||||||
|
mkdir -p "$VSCODE_DIR"
|
||||||
|
if [ "$DEVCONTAINER" = true ]; then
|
||||||
|
echo "Creating $LAUNCH_JSON_PATH..."
|
||||||
|
cat << EOF > "$LAUNCH_JSON_PATH"
|
||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Launch Khoj",
|
||||||
|
"type": "debugpy",
|
||||||
|
"request": "launch",
|
||||||
|
"module": "src.khoj.main",
|
||||||
|
"justMyCode": false,
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"sudo": true,
|
||||||
|
"args": [
|
||||||
|
"-v",
|
||||||
|
"--anonymous-mode",
|
||||||
|
"--non-interactive",
|
||||||
|
"--port=42110",
|
||||||
|
],
|
||||||
|
// You can load environment variables via a .env file, the env field below or Github Codespace secrets.
|
||||||
|
"envFile": "\${workspaceFolder}/.env",
|
||||||
|
"env": {
|
||||||
|
"KHOJ_ADMIN_EMAIL": "admin",
|
||||||
|
"KHOJ_ADMIN_PASSWORD": "admin",
|
||||||
|
"USE_EMBEDDED_DB": "True",
|
||||||
|
"KHOJ_DEBUG": "True",
|
||||||
|
"KHOJ_TELEMETRY_DISABLE": "True",
|
||||||
|
// Set LLM Provider API keys
|
||||||
|
// ---
|
||||||
|
// "GEMINI_API_KEY": "",
|
||||||
|
// "ANTHROPIC_API_KEY": "",
|
||||||
|
// "OPENAI_API_KEY": "",
|
||||||
|
// "OPENAI_BASE_URL": "http://localhost:11434/v1/",
|
||||||
|
// "KHOJ_DEFAULT_CHAT_MODEL": "claude-sonnet-4-0",
|
||||||
|
// Set Search Provider API keys
|
||||||
|
// ---
|
||||||
|
// "SERPER_DEV_API_KEY": "",
|
||||||
|
// "OLOSTEP_API_KEY": "",
|
||||||
|
// "FIRECRAWL_API_KEY": "",
|
||||||
|
// "JINA_API_KEY": "",
|
||||||
|
// Enable Khoj Operator
|
||||||
|
// ---
|
||||||
|
// "KHOJ_OPERATOR_ENABLED": "True",
|
||||||
|
// Configure Code Sandbox
|
||||||
|
// ---
|
||||||
|
// "KHOJ_TERRARIUM_URL": "http://localhost:8080",
|
||||||
|
// "E2B_API_KEY": "",
|
||||||
|
// Enable Promptracer to debug prompt flows
|
||||||
|
// ---
|
||||||
|
// "PROMPTRACE_DIR": "\${workspaceFolder}/promptrace",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
# Install pre-commit hooks
|
# Install pre-commit hooks
|
||||||
# ----
|
# ----
|
||||||
echo "Installing pre-commit hooks..."
|
echo "Installing pre-commit hooks..."
|
||||||
|
|||||||
Reference in New Issue
Block a user