uw: add ./uw shell, warn about bare pixi shell after setup#168
uw: add ./uw shell, warn about bare pixi shell after setup#168lmoresi merged 2 commits intodevelopmentfrom
./uw shell, warn about bare pixi shell after setup#168Conversation
Bare `pixi shell` ignores .pixi-env and uses the literal 'default' environment in pixi.toml, which is the lightweight conda-forge PETSc env with no nodejs / dev tools. Users who configure a dev env via `./uw setup` (or `./uw set-env dev`) and then type `pixi shell` end up in the wrong env without realising — first-timer trap, also a trap when returning to a machine after a break. A. Add `./uw shell` subcommand: `exec pixi shell -e $(get_env)`. Mirrors the existing pattern of every other `./uw` command and always lands in the env `./uw` thinks you're in. Listed under Setup in --help. B. After "Setup complete!", advertise `./uw shell` in the Usage block and add a one-paragraph Note explaining the bare-pixi-shell trap. No changes to pixi.toml. No behaviour change for anything other than the new `./uw shell` invocation. Underworld development team with AI support from Claude Code (https://claude.com/claude-code)
There was a problem hiding this comment.
Pull request overview
Adds a ./uw shell convenience command and updates ./uw setup messaging to steer users away from the common “bare pixi shell uses the wrong env” pitfall, aligning interactive shell usage with the environment recorded in .pixi-env.
Changes:
- Extend
./uw setupcompletion output to recommend./uw shelland warn about barepixi shell/pixi runusing pixi’s literaldefaultenv. - Add
shellto./uw --helpunderSetup:with an explanation of why it exists. - Add a
shelldispatch case that executespixi shell -e "$(get_env)".
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| shell) | ||
| # Activate the env stored in .pixi-env, not pixi's literal 'default'. | ||
| # Bare `pixi shell` ignores .pixi-env and falls back to the env named | ||
| # 'default' in pixi.toml, which is the lightweight conda-forge PETSc | ||
| # env without nodejs / dev tools — a common first-timer trap. | ||
| exec $PIXI shell -e "$(get_env)" | ||
| ;; |
There was a problem hiding this comment.
Fixed in 42ccb25 — kept the existing shell) block at uw:1592 (the one with shift / "$@" arg-forwarding, as you suggested), folded the explanatory comment about the bare-pixi-shell trap into it, and deleted the duplicate block I had added lower down.
| Setup: | ||
| setup Interactive configuration wizard | ||
| set-env NAME Change environment directly | ||
| shell Open a pixi shell in the configured env (not pixi's 'default') | ||
| ai-tools Configure external AI instruction paths |
There was a problem hiding this comment.
Fixed in 42ccb25 — dropped the new Setup line entirely and updated the existing Development entry to read Interactive pixi shell in the configured env (avoid bare 'pixi shell') so the trap caveat is documented in the one remaining spot.
Address Copilot review on PR #168: - A `shell)` case already existed at uw:1592 (forwarding extra args via shift + "$@") and `shell` was already listed under the Development section of --help. The original commit added a second, simpler `shell)` case lower in the dispatch and a third `shell` line under Setup, both unreachable / confusing duplicates. - Fold the explanatory comment about the bare-`pixi shell` trap into the existing dispatch case. Drop the duplicate dispatch block. - Drop the duplicate Setup help line. Update the existing Development help line to mention the trap so the doc still earns its keep. The setup-wizard tail message (introduced in 1d1eccc) is unchanged and still advertises ./uw shell + warns about the bare-pixi-shell pitfall. Underworld development team with AI support from Claude Code (https://claude.com/claude-code)
Summary
./uw set-env <env>writes the chosen environment to.pixi-env, and every./uw <cmd>reads it viaget_env()and passes-e <env>to pixi. But pixi itself doesn't know.pixi-envexists — a barepixi shell(orpixi run …) falls back to the env literally nameddefaultinpixi.toml, which is the lightweight conda-forge-PETSc env with no nodejs / dev tools.That's a real first-timer trap (e.g. PR #167's
npm install -g …flow fails with "npm: command not found" because the bare shell isn't in a dev env), and the same trap bites people coming back to a machine after a gap.Two small additions:
./uw shellsubcommand.exec pixi shell -e $(get_env)— always lands in the env./uwthinks you're in. Mirrors every other./uwdispatch case. Listed underSetup:in./uw --help../uw shellis now in the Usage block, and a short Note explains the bare-pixi shelltrap.No changes to
pixi.toml. No behaviour change for anything other than the new./uw shellinvocation.Test plan
bash -n uwclean (verified locally)./uw --helplistsshellunder Setup./uw shellopens a pixi shell whosewhich npm(or other dev-feature binary) resolves into the configured env./uw setupend-of-wizard now mentions./uw shelland warns about barepixi shellpixi shell(bare) still works exactly as before — this PR doesn't change pixi's own default-env behaviour, only adds a./uw-side wrapperUnderworld development team with AI support from Claude Code