From fdb681ca0edd19ec803dbf6d1c6016942824875e Mon Sep 17 00:00:00 2001 From: Debanjum Date: Mon, 19 May 2025 22:15:10 -0700 Subject: [PATCH] Only install desktop, obsidian app from dev_setup.sh with --full flag --- .../docs/contributing/development.mdx | 7 ++-- scripts/dev_setup.sh | 41 +++++++++++++------ 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/documentation/docs/contributing/development.mdx b/documentation/docs/contributing/development.mdx index 0faa471c..3e299745 100644 --- a/documentation/docs/contributing/development.mdx +++ b/documentation/docs/contributing/development.mdx @@ -191,18 +191,19 @@ In whichever clients you're using for testing, you'll need to update the server ## Validate ### Before Making Changes -1. Install Git Hooks for Validation +1. Install Khoj. Setup Git Hooks for Validation ```shell ./scripts/dev_setup.sh ``` - - This ensures standard code formatting fixes and other checks run automatically on every commit and push + - Installs the khoj server and web app by default. Use the `--full` flag to install the Khoj Desktop and Obsidian client apps as well. + - Git hooks format code, check types automatically on every commit and push respectively. - Note 1: If [pre-commit](https://pre-commit.com/#intro) didn't already get installed, [install it](https://pre-commit.com/#install) via `pip install pre-commit` - Note 2: To run the pre-commit changes manually, use `pre-commit run --hook-stage manual --all` before creating PR ### Before Creating PR :::tip[Note] -You should be in an active virtual environment for Khoj in order to run the unit tests and linter. +You should be in an active virtual environment for Khoj in order to run the unit tests and linter. The `dev_setup.sh` script wil automatically create and activate it for you. ::: 1. Ensure that you have a [Github Issue](https://github.com/khoj-ai/khoj/issues) that can be linked to the PR. If not, create one. Make sure you've tagged one of the maintainers to the issue. This will ensure that the maintainers are notified of the PR and can review it. It's best discuss the code design on an existing issue or Discord thread before creating a PR. This helps get your PR merged faster. diff --git a/scripts/dev_setup.sh b/scripts/dev_setup.sh index 8704e978..24be672d 100755 --- a/scripts/dev_setup.sh +++ b/scripts/dev_setup.sh @@ -2,6 +2,24 @@ # --- PROJECT_ROOT=$(git rev-parse --show-toplevel) +# Default to minimal installation unless --full flag passed +INSTALL_FULL=false +for arg in "$@" +do + if [ "$arg" == "--full" ] + then + INSTALL_FULL=true + break + fi +done + +# Install Server App +# --- +echo "Installing Server App..." +cd $PROJECT_ROOT +# pip install --user pipenv && pipenv install -e '.[dev]' --skip-lock && pipenv shell +python3 -m venv .venv && . .venv/bin/activate && python3 -m pip install -e '.[dev]' + # Install Web App # --- echo "Installing Web App..." @@ -10,22 +28,19 @@ yarn install # Install Obsidian App # --- -echo "Installing Obsidian App..." -cd $PROJECT_ROOT/src/interface/obsidian -yarn install +if [ "$INSTALL_FULL" = true ] ; then + echo "Installing Obsidian App..." + cd $PROJECT_ROOT/src/interface/obsidian + yarn install +fi # Install Desktop App # --- -echo "Installing Desktop App..." -cd $PROJECT_ROOT/src/interface/desktop -yarn install - -# Install Server App -# --- -echo "Installing Server App..." -cd $PROJECT_ROOT -# pip install --user pipenv && pipenv install -e '.[dev]' --skip-lock && pipenv shell -python3 -m venv .venv && pip install -e '.[dev]' && . .venv/bin/activate +if [ "$INSTALL_FULL" = true ] ; then + echo "Installing Desktop App..." + cd $PROJECT_ROOT/src/interface/desktop + yarn install +fi # Install pre-commit hooks # ----