From a83df5d3d76c0cef7cae402a7216d2d71d60e0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laurent?= <francois.laurent@posteo.net> Date: Mon, 31 Mar 2025 15:35:45 +0200 Subject: [PATCH] new install defaults --- Manifest-v1.11.toml | 4 +-- Manifest.toml | 4 +-- scripts/install.sh | 81 +++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 79 insertions(+), 10 deletions(-) diff --git a/Manifest-v1.11.toml b/Manifest-v1.11.toml index 4a3fd72..0aa18a8 100644 --- a/Manifest-v1.11.toml +++ b/Manifest-v1.11.toml @@ -997,11 +997,11 @@ version = "1.2.0" [[deps.NyxWidgets]] deps = ["Bonito", "Colors", "Format", "LazyArtifacts", "Observables"] -git-tree-sha1 = "d5addf940e4265b3ca2a6fe29b8ff24bf3b13b98" +git-tree-sha1 = "cdc029870ac2ab9522e700f3e2b3209b33389fa4" repo-rev = "main" repo-url = "https://gitlab.com/dbc-nyx/NyxWidgets.jl" uuid = "c288fd06-43d3-4b04-8307-797133353e2e" -version = "0.2.1" +version = "0.2.2" [[deps.Observables]] git-tree-sha1 = "7438a59546cf62428fc9d1bc94729146d37a7225" diff --git a/Manifest.toml b/Manifest.toml index 5b90db9..ddca19f 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -985,11 +985,11 @@ version = "1.2.0" [[deps.NyxWidgets]] deps = ["Bonito", "Colors", "Format", "LazyArtifacts", "Observables"] -git-tree-sha1 = "d5addf940e4265b3ca2a6fe29b8ff24bf3b13b98" +git-tree-sha1 = "cdc029870ac2ab9522e700f3e2b3209b33389fa4" repo-rev = "main" repo-url = "https://gitlab.com/dbc-nyx/NyxWidgets.jl" uuid = "c288fd06-43d3-4b04-8307-797133353e2e" -version = "0.2.1" +version = "0.2.2" [[deps.Observables]] git-tree-sha1 = "7438a59546cf62428fc9d1bc94729146d37a7225" diff --git a/scripts/install.sh b/scripts/install.sh index a1a2b1d..d649e46 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,5 +1,38 @@ #!/usr/bin/env bash +for flag in "$@"; do + if [ "$flag" = "-h" -o "$flag" = "--help" ]; then + echo "Command-line installer for LarvaTagger" + echo + echo "Usage:" + echo " $0" + echo " WITH_BACKEND=1 $0" + echo " WITH_BACKEND=1 $0 --legacy" + echo " $0 --with-default-backend" + echo " $0 --with-backend --legacy" + echo " $0 --uninstall" + echo " $0 --help" + echo + echo "The legacy installation path for the MaggotUBA-based tagger relies" + echo "on Python3.8 and Torch1." + echo "The current default relies on Python3.11 and Torch2." + echo "Other environment variables can be set, similarly to WITH_BACKEND," + echo "to control the script's behavior:" + echo " variable default value" + echo " BIN_DIR ~/.local/bin" + echo " LARVATAGGER_PATH ~/.local/share/larvatagger" + echo " JULIA_CHANNEL lts" + echo " JULIA_VERSION 1.10" + echo " PYTHON_VERSION 3.11 (3.8 if --legacy)" + echo " MAGGOTUBA_CORE_BRANCH main" + echo " MAGGOTUBA_ADAPTER_BRANCH torch2 (main if --legacy)" + echo " TAGGINGBACKENDS_BRANCH main" + echo " PLANARLARVAE_BRANCH main" + echo " LARVATAGGER_BRANCH main" + exit 0 + fi +done + [ -d "`pwd`" ] || cd if [ -z "$BIN_DIR" ]; then @@ -41,28 +74,47 @@ if [ "$1" = "--uninstall" ]; then fi else +# former default: PYTHON_VERSION=3.8 + # the internal_<VAR> variables need to be set non-empty only if # the corresponding <VAR> variable is non-empty; they are used to # determine whether or not to report externally sourced variables internal_WITH_BACKEND= internal_MAGGOTUBA_ADAPTER_BRANCH= internal_MAGGOTUBA_ADAPTER_FREE_DEPENDENCIES= +internal_LEGACY= +internal_WITH_DEFAULT_BACKEND= + +# primary use cases: +# WITH_BACKEND=1 scripts/install.sh +# WITH_BACKEND=1 scripts/install.sh --legacy +# scripts/install.sh --with-default-backend +# scripts/install.sh --with-backend +# scripts/install.sh --with-backend --experimental +# scripts/install.sh --with-backend --legacy + for arg in "$@"; do if [ "$arg" = "--with-default-backend" ]; then WITH_BACKEND=1 internal_WITH_BACKEND=1 - MAGGOTUBA_CORE_BRANCH= - MAGGOTUBA_ADAPTER_BRANCH= + internal_WITH_DEFAULT_BACKEND=1 + if [ "$internal_LEGACY" = "1" ]; then + echo "Ignoring --legacy; pass --with-backend --legacy instead" + internal_LEGACY=0 + fi break elif [ "$arg" = "--with-backend" ]; then WITH_BACKEND=1 internal_WITH_BACKEND=1 elif [ "$arg" = "--experimental" ]; then + echo "The --experimental flag is deprecated and is now default" + internal_LEGACY=0 + elif [ "$arg" = "--legacy" ]; then + internal_LEGACY=1 MAGGOTUBA_CORE_BRANCH= - MAGGOTUBA_ADAPTER_BRANCH=torch2 - internal_MAGGOTUBA_ADAPTER_BRANCH=1 - PYTHON_VERSION=3.11 + # former default (empty) falls back to main + MAGGOTUBA_ADAPTER_BRANCH= elif [ "$arg" = "--free-python-dependencies" ]; then internal_MAGGOTUBA_ADAPTER_FREE_DEPENDENCIES=1 elif [ "$arg" = "--lock-python-dependencies" ]; then @@ -70,6 +122,23 @@ for arg in "$@"; do fi done +if [ "$WITH_BACKEND" = "1" -a "$internal_LEGACY" = "0" ]; then + # new defaults (formerly "--experimental") + MAGGOTUBA_CORE_BRANCH= + MAGGOTUBA_ADAPTER_BRANCH=torch2 + internal_MAGGOTUBA_ADAPTER_BRANCH=1 + PYTHON_VERSION=3.11 +elif [ "$internal_LEGACY" != "1" ]; then + if [ "$internal_WITH_DEFAULT_BACKEND" = "1" ]; then + echo "The Python3.11/Torch2 backend is now default" + echo "Pass flags --with-backend --legacy to select the former Python3.8/Torch1 backend" + fi + MAGGOTUBA_CORE_BRANCH= + MAGGOTUBA_ADAPTER_BRANCH=torch2 + internal_MAGGOTUBA_ADAPTER_BRANCH=1 + PYTHON_VERSION=3.11 +fi + PYTHON="python$PYTHON_VERSION" check_brew() { @@ -266,7 +335,7 @@ if [ -d LarvaTagger.jl ]; then echo "LarvaTagger.jl installation found; skipping" else if [ -z "$LARVATAGGER_BRANCH" ]; then - LARVATAGGER_BRANCH=dev + LARVATAGGER_BRANCH=main else echo "Using environment variable: LARVATAGGER_BRANCH= $LARVATAGGER_BRANCH" fi -- GitLab