Skip to content

Instantly share code, notes, and snippets.

@bluss
Created October 5, 2024 23:30
Show Gist options
  • Save bluss/9f52215f647028321bb063b1d866e227 to your computer and use it in GitHub Desktop.
Save bluss/9f52215f647028321bb063b1d866e227 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [[ "$1" == +* ]]; then
PYVERSION=(-p "${1#+}")
shift
else
PYVERSION=()
fi
UVARGS=( "$@" )
IPYARGS=()
for i in "${!UVARGS[@]}"; do
if [[ "${UVARGS[$i]}" = "--" ]]; then
IPYARGS=( "${UVARGS[@]:$i+1}" )
UVARGS=( "${UVARGS[@]:0:$i}" )
break
fi
done
exec uv run "${PYVERSION[@]}" --with ipython "${UVARGS[@]}" ipython "${IPYARGS[@]}"
@bluss
Copy link
Author

bluss commented Oct 5, 2024

  • uvipython +3.11 to run with particular version
  • runs ipython in the context of the current project
  • uvipython <uv args> -- <ipython args>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment