From 2478ce5baef409108051ec9ccebc2d26608ae666 Mon Sep 17 00:00:00 2001 From: didericis Date: Fri, 17 Apr 2026 00:54:42 -0400 Subject: [PATCH] Update setup command --- .gitignore | 4 ++++ pyrightconfig.json | 3 --- requirements.txt | 2 ++ run.sh | 44 ++++++++++++++++++++++++++++++++++++++------ 4 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 .gitignore create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b316ddd --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.env +.env.* +.venv/ +.vscode/ diff --git a/pyrightconfig.json b/pyrightconfig.json index 7bf1c1f..c7a67a5 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -1,7 +1,4 @@ { - "extraPaths": [ - "/Applications/SageMath-10-8.app/Contents/Frameworks/Sage.framework/Versions/10.8/local/lib/python3.13/site-packages" - ], "reportUnknownMemberType": "warning", "reportUnknownArgumentType": "warning", "reportUnknownParameterType": "warning", diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..b04fd74 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +pylint +pyright diff --git a/run.sh b/run.sh index e98d57e..6994d62 100755 --- a/run.sh +++ b/run.sh @@ -2,10 +2,13 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -PYTHON_PATH="/Applications/SageMath-10-8.app/Contents/Frameworks/Sage.framework/Versions/10.8/local/bin/python3" -SAGE_SITE_PACKAGES="/Applications/SageMath-10-8.app/Contents/Frameworks/Sage.framework/Versions/10.8/local/lib/python3.13/site-packages" VENV_PYTHON="$SCRIPT_DIR/.venv/bin/python3" +if [ -f "$SCRIPT_DIR/.env" ]; then + # shellcheck source=/dev/null + source "$SCRIPT_DIR/.env" +fi + init_paper() { local raw="${1:-.}" local name @@ -20,12 +23,40 @@ init_paper() { } setup() { - "$PYTHON_PATH" -m venv "$SCRIPT_DIR/.venv" - "$VENV_PYTHON" -m pip install pylint + local python_path="${1:?Usage: setup }" + local sage_site_packages="${2:?Usage: setup }" + local system_name="${3:?Usage: setup }" + + printf 'SAGE_PYTHON_PATH=%s\nSAGE_SITE_PACKAGES=%s\n' "$python_path" "$sage_site_packages" \ + > "$SCRIPT_DIR/.env.$system_name" + ln -sf ".env.$system_name" "$SCRIPT_DIR/.env" + source "$SCRIPT_DIR/.env" + + mkdir -p "$SCRIPT_DIR/.vscode" + "$python_path" - <