feat: mise, brew and fastfetch perf
This commit is contained in:
@@ -2,74 +2,30 @@
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Description:
|
||||
# Configure Python.
|
||||
# Install Python via mise and configure poetry.
|
||||
#
|
||||
|
||||
# Skip in Codespaces (use pre-installed Python)
|
||||
# Skip in Codespaces (use pre-installed versions)
|
||||
[[ "$DOTS_ENV" == "codespaces" ]] && { log_pass "Skipping in Codespaces"; return 0; }
|
||||
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
log_info "Installing Python..."
|
||||
mise install python@3
|
||||
mise use -g python@3
|
||||
|
||||
local version="3.14.2"
|
||||
log_info "Installing Poetry..."
|
||||
mise install poetry@latest
|
||||
mise use -g poetry@latest
|
||||
|
||||
if ! pyenv versions --bare | grep -q "$version"; then
|
||||
pyenv install "$version"
|
||||
fi
|
||||
pyenv global "$version"
|
||||
|
||||
pip3 install --quiet --upgrade --user pip
|
||||
python3 --version
|
||||
pip3 --version
|
||||
|
||||
pip_dependencies=(
|
||||
# docker-compose
|
||||
# neovim
|
||||
# "python-language-server[all]"
|
||||
# pyvim
|
||||
)
|
||||
installed_packages=$(pip3 list --format=freeze | awk -F'==' '{print $1}')
|
||||
pip_dependencies=($(comm -13 <(printf "%s\n" "${installed_packages[@]}" | sort) <(printf "%s\n" "${pip_dependencies[@]}" | sort)))
|
||||
|
||||
if [ ${#pip_dependencies[@]} -gt 0 ]; then
|
||||
pip3 install --quiet --upgrade --user "${pip_dependencies[@]}"
|
||||
fi
|
||||
|
||||
unset installed_packages pip_dependencies PYTHON_KEYRING_BACKEND
|
||||
|
||||
local_bin_path="$HOME/.local/bin"
|
||||
if [[ ":$PATH:" != *":$local_bin_path:"* ]]; then
|
||||
export PATH="$local_bin_path:$PATH"
|
||||
fi
|
||||
mkdir -p ~/.local/bin
|
||||
unset local_bin_path
|
||||
|
||||
if ! command -v pipx &>/dev/null; then
|
||||
case "$DOTS_PKG" in
|
||||
apt)
|
||||
sudo apt-get install -qq pipx
|
||||
;;
|
||||
pacman)
|
||||
sudo pacman -S --noconfirm python-pipx
|
||||
;;
|
||||
brew)
|
||||
brew install pipx
|
||||
;;
|
||||
*)
|
||||
log_warn "Skipping pipx install: no supported package manager found"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo "pipx $(pipx --version)"
|
||||
|
||||
if ! command -v poetry &>/dev/null; then
|
||||
pipx install poetry
|
||||
# Setup Poetry ZSH completions
|
||||
ZSH_CUSTOM="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"
|
||||
if [[ -d "$ZSH_CUSTOM/plugins" ]]; then
|
||||
POETRY_PLUGIN="$ZSH_CUSTOM/plugins/poetry"
|
||||
if [ ! -d "$POETRY_PLUGIN" ]; then
|
||||
mkdir -p "$POETRY_PLUGIN"
|
||||
poetry completions zsh > "$POETRY_PLUGIN/_poetry"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Verify installations
|
||||
python --version
|
||||
poetry --version
|
||||
|
||||
POETRY_PLUGIN="$ZSH/custom/plugins/poetry"
|
||||
if [ ! -d "$POETRY_PLUGIN" ]; then
|
||||
mkdir -p "$POETRY_PLUGIN"
|
||||
poetry completions zsh > "$POETRY_PLUGIN/_poetry"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user