mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-03-19 08:06:16 +00:00
refactor(dfm): replace per-language install commands with mise
This commit is contained in:
@@ -1,53 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
# @description Install Python packages using uv.
|
||||
# @description Install Python libraries via uv pip (tools are managed by mise).
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
source "$DOTFILES/config/shared.sh"
|
||||
|
||||
msgr run "Starting to install Python packages"
|
||||
msgr run "Starting to install Python libraries"
|
||||
|
||||
# Ensure uv is available
|
||||
if ! command -v uv &> /dev/null; then
|
||||
msgr nested "uv not found, installing via official installer"
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
msgr err "uv not found — install it via mise first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# CLI tools — installed isolated with `uv tool install`
|
||||
tools=(
|
||||
ansible # IT automation and configuration management
|
||||
openapi-python-client # Generate Python API clients from OpenAPI specs
|
||||
ruff # Fast Python linter and formatter
|
||||
)
|
||||
|
||||
# Library packages — installed into system Python with `uv pip install --system`
|
||||
libraries=(
|
||||
libtmux # Python API for tmux
|
||||
pynvim # Neovim Python client
|
||||
)
|
||||
|
||||
# Function to install CLI tools via uv tool install
|
||||
install_tools()
|
||||
{
|
||||
msgr run "Installing Python CLI tools"
|
||||
for pkg in "${tools[@]}"; do
|
||||
# Strip inline comments and trim whitespace
|
||||
pkg="${pkg%%#*}"
|
||||
pkg="${pkg// /}"
|
||||
[[ -z "$pkg" ]] && continue
|
||||
|
||||
msgr nested "Installing tool: $pkg"
|
||||
uv tool install --upgrade "$pkg"
|
||||
echo ""
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# Function to install library packages via uv pip install
|
||||
install_libraries()
|
||||
{
|
||||
msgr run "Installing Python libraries"
|
||||
for pkg in "${libraries[@]}"; do
|
||||
# Strip inline comments and trim whitespace
|
||||
pkg="${pkg%%#*}"
|
||||
@@ -61,22 +35,5 @@ install_libraries()
|
||||
return 0
|
||||
}
|
||||
|
||||
# Function to upgrade all uv-managed tools
|
||||
upgrade_tools()
|
||||
{
|
||||
msgr run "Upgrading all uv-managed tools"
|
||||
uv tool upgrade --all
|
||||
return 0
|
||||
}
|
||||
|
||||
# Install Python tools, libraries, and upgrade all
|
||||
main()
|
||||
{
|
||||
install_tools
|
||||
install_libraries
|
||||
upgrade_tools
|
||||
msgr yay "Python package installations complete"
|
||||
return 0
|
||||
}
|
||||
|
||||
main "$@"
|
||||
install_libraries
|
||||
msgr yay "Python library installations complete"
|
||||
|
||||
Reference in New Issue
Block a user