From 8ad76f9b82b3354fd9a99847f0837e09b9083017 Mon Sep 17 00:00:00 2001 From: Henrik Till Lemke Date: Thu, 15 Oct 2026 17:11:39 +0200 Subject: [PATCH] Remove baked bpy-default.sh/bpy-dev.sh; prefer system pixi bpy-default.sh and bpy-dev.sh were saved 'pixi shell-hook' output from another host, with PIXI_EXE and PATH pointing into a personal home that doesn't exist on the consoles. bpy-env.sh now runs the hook at runtime (--as-is, ~0.2 s) for its shared-env fallback instead of sourcing bpy-default.sh; nothing else used either file. Scripts that call pixi now prefer the system /usr/bin/pixi and fall back to /sf/bernina/bin/pixi (e.g. on ra, which has no system pixi). --- bpy-default.sh | 37 ------------------------------------- bpy-dev.sh | 37 ------------------------------------- bpy-env.sh | 12 ++++++++---- cheatsheet.md | 2 -- create-python-install | 3 ++- list_bin_commands | 2 -- pixi_local_sync | 3 ++- pixi_rebuild_local | 3 ++- 8 files changed, 14 insertions(+), 85 deletions(-) delete mode 100644 bpy-default.sh delete mode 100644 bpy-dev.sh diff --git a/bpy-default.sh b/bpy-default.sh deleted file mode 100644 index 9ef88b5..0000000 --- a/bpy-default.sh +++ /dev/null @@ -1,37 +0,0 @@ -export PATH="/sf/bernina/applications/python/.pixi/envs/bpy312/bin:/photonics/home/lemke_h/.pixi/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sf/bernina/bin:/sf/controls/bin:/usr/local/epics/base-7.0.10/bin/RHEL8-x86_64:/opt/puppetlabs/bin:/photonics/home/lemke_h/.local/bin:/photonics/home/lemke_h/bin" -export CONDA_SHLVL=1 -export CONDA_PREFIX=/sf/bernina/applications/python/.pixi/envs/bpy312 -export PIXI_PROJECT_NAME=berni -export PIXI_PROJECT_VERSION=0.1.0 -export PIXI_PROJECT_ROOT=/sf/bernina/applications/python -export PIXI_IN_SHELL=1 -export PIXI_EXE=/photonics/home/lemke_h/.pixi/bin/pixi -export PIXI_PROJECT_MANIFEST=/sf/bernina/applications/python/pixi.toml -export CONDA_DEFAULT_ENV=berni:bpy312 -export PIXI_ENVIRONMENT_NAME=bpy312 -export PIXI_ENVIRONMENT_PLATFORMS=linux-64 -export PIXI_PROMPT='(berni:bpy312) ' -. /sf/bernina/applications/python/.pixi/envs/bpy312/etc/conda/activate.d/epics-base_activate.sh -. /sf/bernina/applications/python/.pixi/envs/bpy312/etc/conda/activate.d/libarrow_activate.sh -. /sf/bernina/applications/python/.pixi/envs/bpy312/etc/conda/activate.d/libglib_activate.sh -. /sf/bernina/applications/python/.pixi/envs/bpy312/etc/conda/activate.d/libxml2-split_activate.sh -. /sf/bernina/applications/python/.pixi/envs/bpy312/etc/conda/activate.d/pyepics_activate.sh -source /sf/bernina/applications/python/.pixi/envs/bpy312/share/bash-completion/completions/* - -# shellcheck shell=bash -pixi() { - local first_arg="${1-}" - - "${PIXI_EXE-}" "$@" || return $? - - case "${first_arg-}" in - add | a | remove | rm | install | i) - eval "$("$PIXI_EXE" shell-hook --change-ps1 false)" - hash -r - ;; - esac || : - - return 0 -} - -export PS1="(berni:bpy312) ${PS1:-}" diff --git a/bpy-dev.sh b/bpy-dev.sh deleted file mode 100644 index 18eea9d..0000000 --- a/bpy-dev.sh +++ /dev/null @@ -1,37 +0,0 @@ -export PATH="/sf/bernina/applications/python/.pixi/envs/bpy312-dev/bin:/sf/bernina/applications/python/environments/bpy312-dev/bin:/photonics/home/lemke_h/.pixi/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sf/bernina/bin:/sf/controls/bin:/usr/local/epics/base-7.0.10/bin/RHEL8-x86_64:/opt/puppetlabs/bin:/photonics/home/lemke_h/.local/bin:/photonics/home/lemke_h/bin" -export CONDA_SHLVL=1 -export CONDA_PREFIX=/sf/bernina/applications/python/.pixi/envs/bpy312-dev -export PIXI_PROJECT_ROOT=/sf/bernina/applications/python -export PIXI_EXE=/photonics/home/lemke_h/.pixi/bin/pixi -export PIXI_PROJECT_MANIFEST=/sf/bernina/applications/python/pixi.toml -export PIXI_PROJECT_NAME=berni -export PIXI_PROJECT_VERSION=0.1.0 -export PIXI_IN_SHELL=1 -export CONDA_DEFAULT_ENV=berni:bpy312-dev -export PIXI_ENVIRONMENT_NAME=bpy312-dev -export PIXI_ENVIRONMENT_PLATFORMS=linux-64 -export PIXI_PROMPT='(berni:bpy312-dev) ' -. /sf/bernina/applications/python/.pixi/envs/bpy312-dev/etc/conda/activate.d/epics-base_activate.sh -. /sf/bernina/applications/python/.pixi/envs/bpy312-dev/etc/conda/activate.d/libarrow_activate.sh -. /sf/bernina/applications/python/.pixi/envs/bpy312-dev/etc/conda/activate.d/libglib_activate.sh -. /sf/bernina/applications/python/.pixi/envs/bpy312-dev/etc/conda/activate.d/libxml2-split_activate.sh -. /sf/bernina/applications/python/.pixi/envs/bpy312-dev/etc/conda/activate.d/pyepics_activate.sh -source /sf/bernina/applications/python/.pixi/envs/bpy312-dev/share/bash-completion/completions/* - -# shellcheck shell=bash -pixi() { - local first_arg="${1-}" - - "${PIXI_EXE-}" "$@" || return $? - - case "${first_arg-}" in - add | a | remove | rm | install | i) - eval "$("$PIXI_EXE" shell-hook --change-ps1 false)" - hash -r - ;; - esac || : - - return 0 -} - -export PS1="(berni:bpy312-dev) ${PS1:-}" diff --git a/bpy-env.sh b/bpy-env.sh index ffb5421..a9cabec 100644 --- a/bpy-env.sh +++ b/bpy-env.sh @@ -6,7 +6,7 @@ echo "Loading Bernina Python (pixi)" # <<< conda initialize <<< # over the shared NFS install, for speed -- but only once verified # identical: pixi.lock fully determines what gets built (see chat), so a # byte-for-byte match against the shared lock means the local bpy312 is -# guaranteed the same as what bpy-default.sh below would give you. +# guaranteed the same as the shared activation below. # Anything else (no local copy yet, a sync in progress, or behind) falls # back to the existing shared-NFS activation, unchanged. # @@ -17,6 +17,8 @@ echo "Loading Bernina Python (pixi)" # <<< conda initialize <<< # on the same lock file that script holds EXCLUSIVELY during that whole # window -- if we can't get it, a sync is actively running right now, so # fall back rather than risk activating a half-linked env. +_bpy_pixi=/usr/bin/pixi # console (system) pixi first +[ -x "$_bpy_pixi" ] || _bpy_pixi=/sf/bernina/bin/pixi # fallback, e.g. on ra (RHEL8) _bpy_local="$HOME/bpy" _bpy_activated=0 if [ -d "$_bpy_local/.pixi_local_sync" ]; then @@ -24,15 +26,17 @@ if [ -d "$_bpy_local/.pixi_local_sync" ]; then if flock -s -n 8; then if cmp -s "$_bpy_local/pixi.lock" /sf/bernina/applications/python/pixi.lock 2>/dev/null \ && [ -d "$_bpy_local/.pixi/envs/bpy312/bin" ]; then - eval "$(/sf/bernina/bin/pixi shell-hook -e bpy312 -s bash -m "$_bpy_local/pixi.toml")" + eval "$("$_bpy_pixi" shell-hook -e bpy312 -s bash -m "$_bpy_local/pixi.toml")" _bpy_activated=1 fi flock -u 8 fi exec 8>&- fi -[ "$_bpy_activated" -eq 1 ] || source /sf/bernina/bin/bpy-default.sh -unset _bpy_local _bpy_activated +# Shared env: --as-is never installs or relocks (users can't write there). +[ "$_bpy_activated" -eq 1 ] || eval "$("$_bpy_pixi" shell-hook --as-is -e bpy312 -s bash \ + --manifest-path /sf/bernina/applications/python/pixi.toml)" +unset _bpy_pixi _bpy_local _bpy_activated micromamba config append envs_dirs /sf/bernina/applications/python/environments diff --git a/cheatsheet.md b/cheatsheet.md index 3dd3e81..e0405df 100644 --- a/cheatsheet.md +++ b/cheatsheet.md @@ -203,8 +203,6 @@ Every script in `/sf/bernina/bin`, grouped by topic. Generated by `list_bin_comm | `anaconda_manual` | Show the anaconda environment manual (rendered markdown) | | `anaconda_testenv` | Activate the anaconda test environment | | `bpy` | Activate a named bpy (pixi) environment | -| `bpy-default.sh` | Set PATH for the default shared bpy312 pixi environment (source this) | -| `bpy-dev.sh` | Set PATH for the bpy312-dev pixi environment (source this) | | `bpy-env.sh` | Activate the Bernina pixi Python env -- local per-host mirror if in sync, else shared (source this) | | `bpy-select` | Interactively pick/switch the active bpy pixi environment | | `create-python-install` | Install the bernina pixi env into a pgroup work folder and show it in JupyterHub | diff --git a/create-python-install b/create-python-install index 90f5fe1..c5ef030 100755 --- a/create-python-install +++ b/create-python-install @@ -43,7 +43,8 @@ set -euo pipefail SOURCE_DIR="/sf/bernina/applications/python" -PIXI_BIN="/sf/bernina/bin/pixi" +PIXI_BIN="/usr/bin/pixi" # console (system) pixi first +[ -x "$PIXI_BIN" ] || PIXI_BIN="/sf/bernina/bin/pixi" # fallback, e.g. on ra (RHEL8) EXP_DIR="/sf/bernina/exp" DATA_DIR="/sf/bernina/data" LINK_DIR_NAME="conda_envs" # must not be "envs", see above diff --git a/list_bin_commands b/list_bin_commands index bb319b9..e371f1b 100755 --- a/list_bin_commands +++ b/list_bin_commands @@ -89,8 +89,6 @@ COMMANDS = { "bipython": ("Python, conda & pixi environments", "ipython from the shared bernina_default anaconda env"), "bjupyter": ("Python, conda & pixi environments", "jupyter from the shared bernina_default anaconda env"), "bpy": ("Python, conda & pixi environments", "Activate a named bpy (pixi) environment"), - "bpy-default.sh": ("Python, conda & pixi environments", "Set PATH for the default shared bpy312 pixi environment (source this)"), - "bpy-dev.sh": ("Python, conda & pixi environments", "Set PATH for the bpy312-dev pixi environment (source this)"), "bpy-env.sh": ("Python, conda & pixi environments", "Activate the Bernina pixi Python env -- local per-host mirror if in sync, else shared (source this)"), "bpy-select": ("Python, conda & pixi environments", "Interactively pick/switch the active bpy pixi environment"), "bpython": ("Python, conda & pixi environments", "python from the shared bernina_default anaconda env"), diff --git a/pixi_local_sync b/pixi_local_sync index 2c1f639..bf5f649 100755 --- a/pixi_local_sync +++ b/pixi_local_sync @@ -31,7 +31,8 @@ set -uo pipefail # no -e: one failed check/install must not kill the loop SOURCE_DIR="/sf/bernina/applications/python" -PIXI_BIN="/sf/bernina/bin/pixi" +PIXI_BIN="/usr/bin/pixi" # console (system) pixi first +[ -x "$PIXI_BIN" ] || PIXI_BIN="/sf/bernina/bin/pixi" # fallback, e.g. on ra (RHEL8) LOCAL_DIR="${PIXI_LOCAL_DIR:-$HOME/bpy}" export PIXI_CACHE_DIR="/sf/bernina/misc/pixi-cache" diff --git a/pixi_rebuild_local b/pixi_rebuild_local index 855ff6a..85f1791 100755 --- a/pixi_rebuild_local +++ b/pixi_rebuild_local @@ -18,7 +18,8 @@ set -euo pipefail SOURCE_DIR="/sf/bernina/applications/python" -PIXI_BIN="/sf/bernina/bin/pixi" +PIXI_BIN="/usr/bin/pixi" # console (system) pixi first +[ -x "$PIXI_BIN" ] || PIXI_BIN="/sf/bernina/bin/pixi" # fallback, e.g. on ra (RHEL8) export PIXI_CACHE_DIR="/sf/bernina/misc/pixi-cache" usage() {