Skip to content

Commit

Permalink
feat: use uv to manage dependencies (#1060)
Browse files Browse the repository at this point in the history
  • Loading branch information
clsty authored Feb 4, 2025
2 parents ee406ee + c095395 commit f06c831
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env -S\_/bin/sh\_-xc\_"source\_\$(eval\_echo\_\$ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate&&exec\_python\_-E\_"\$0"\_"\$@""
import argparse
import math
import json
Expand Down
2 changes: 1 addition & 1 deletion .config/ags/scripts/hyprland/get_keybinds.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env -S\_/bin/sh\_-xc\_"source\_\$(eval\_echo\_\$ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate&&exec\_python\_-E\_"\$0"\_"\$@""
import argparse
import re
import os
Expand Down
3 changes: 1 addition & 2 deletions .config/ags/scripts/wayland-idle-inhibitor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python

#!/usr/bin/env -S\_/bin/sh\_-xc\_"source\_\$(eval\_echo\_\$ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate&&exec\_python\_-E\_"\$0"\_"\$@""
import sys
from dataclasses import dataclass
from signal import SIGINT, SIGTERM, signal
Expand Down
3 changes: 3 additions & 0 deletions .config/hypr/hyprland/env.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ env = QT_QPA_PLATFORMTHEME, qt5ct
# ######## Screen tearing #########
# env = WLR_DRM_NO_ATOMIC, 1

# ######## Virtual envrionment #########
env = ILLOGICAL_IMPULSE_VIRTUAL_ENV, ~/.local/state/ags/.venv

# ############ Others #############

13 changes: 0 additions & 13 deletions arch-packages/illogical-impulse-pymyc-aur/PKGBUILD

This file was deleted.

15 changes: 8 additions & 7 deletions arch-packages/illogical-impulse-python/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
pkgname=illogical-impulse-python
pkgver=1.0
pkgver=1.1
pkgrel=1
pkgdesc='Illogical Impulse Python Dependencies'
arch=(any)
license=(None)
depends=(
python-build
python-pillow
python-pywal
python-setuptools-scm
python-wheel
gtk4
libadwaita
libsoup3
libportal-gtk4
blueprint-compiler
gobject-introspection
sassc
)

36 changes: 23 additions & 13 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ install-local-pkgbuild() {
}

# Install core dependencies from the meta-packages
metapkgs=(./arch-packages/illogical-impulse-{audio,backlight,basic,fonts-themes,gnome,gtk,portal,python,screencapture,widgets})
metapkgs=(./arch-packages/illogical-impulse-{audio,python,backlight,basic,fonts-themes,gnome,gtk,portal,screencapture,widgets})
metapkgs+=(./arch-packages/illogical-impulse-ags)
metapkgs+=(./arch-packages/illogical-impulse-microtex-git)
metapkgs+=(./arch-packages/illogical-impulse-oneui4-icons-git)
Expand All @@ -130,18 +130,28 @@ for i in "${metapkgs[@]}"; do
v install-local-pkgbuild "$i" "$metainstallflags"
done

# https://github.com/end-4/dots-hyprland/issues/428#issuecomment-2081690658
# https://github.com/end-4/dots-hyprland/issues/428#issuecomment-2081701482
# https://github.com/end-4/dots-hyprland/issues/428#issuecomment-2081707099
case $SKIP_PYMYC_AUR in
true) sleep 0;;
*)
pymycinstallflags=""
$ask && showfun install-local-pkgbuild || pymycinstallflags="$pymycinstallflags --noconfirm"
v install-local-pkgbuild "./arch-packages/illogical-impulse-pymyc-aur" "$pymycinstallflags"
;;
esac

ags_state_dir=~/.local/state/ags

showfun install-uv
v install-uv

x mkdir -p $ags_state_dir
# we need python 3.12 https://github.com/python-pillow/Pillow/issues/8089
x uv venv --prompt .venv $PYTHON_VENV_PATH -p 3.12
x source $PYTHON_VENV_PATH/bin/activate
x uv pip install -r scriptdata/requirements.txt

# install gradience
gradience_dir=/tmp/gradience
x git clone https://github.com/ZeyadMoustafaKamal/Gradience.git $gradience_dir
x cd $gradience_dir
x git submodule update --init --recursive
x uv pip install -r requirements.txt
x meson setup build --prefix=$VIRTUAL_ENV
x meson compile -C build
x meson install -C build
x cd -
x deactivate # We don't need the virtual environment anymore

# Why need cleanbuild? see https://github.com/end-4/dots-hyprland/issues/389#issuecomment-2040671585
# Why install deps by running a seperate command? see pinned comment of https://aur.archlinux.org/packages/hyprland-git
Expand Down
1 change: 0 additions & 1 deletion scriptdata/dependencies.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@

### Most dependencies have been moved to meta packages as declared in arch-packages.
### Use this file for declaring extra dependencies which you need but are not declared by default.

4 changes: 3 additions & 1 deletion scriptdata/environment-variables
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
XDG_STATE_HOME=${XDG_STATE_HOME:-$HOME/.local/state}
BACKUP_DIR=${BACKUP_DIR:-$HOME/backup}

UV_NO_MODIFY_PATH=1
PYTHON_VENV_PATH=$XDG_STATE_HOME/ags/.venv
PYTHON_BIN_PATH=$PYTHON_VENV_PATH/bin/python
5 changes: 5 additions & 0 deletions scriptdata/installers
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,8 @@ install-MicroTeX (){
x sudo cp -r ./res /opt/MicroTeX/
x cd $base
}

install-uv (){
x curl -LsSf https://astral.sh/uv/install.sh | sh
}

10 changes: 10 additions & 0 deletions scriptdata/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
build
pillow
pywal
setuptools-scm
wheel
pywayland
psutil
git+https://github.com/T-Dynamos/materialyoucolor-python.git
libsass
material-color-utilities
38 changes: 38 additions & 0 deletions scriptdata/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This file was autogenerated by uv via the following command:
# uv pip compile scriptdata/requirements.in -o scriptdata/requirements.txt
build==1.2.2.post1
# via -r scriptdata/requirements.in
cffi==1.17.1
# via pywayland
libsass==0.23.0
# via -r scriptdata/requirements.in
material-color-utilities==0.2.1
# via -r scriptdata/requirements.in
materialyoucolor @ git+https://github.com/T-Dynamos/materialyoucolor-python.git@73080739dc7c46d378a7624881e9c1e6b20b23f1
# via -r scriptdata/requirements.in
numpy==2.2.2
# via material-color-utilities
packaging==24.2
# via
# build
# setuptools-scm
pillow==11.1.0
# via
# -r scriptdata/requirements.in
# material-color-utilities
psutil==6.1.1
# via -r scriptdata/requirements.in
pycparser==2.22
# via cffi
pyproject-hooks==1.2.0
# via build
pywal==3.3.0
# via -r scriptdata/requirements.in
pywayland==0.4.18
# via -r scriptdata/requirements.in
setuptools==75.8.0
# via setuptools-scm
setuptools-scm==8.1.0
# via -r scriptdata/requirements.in
wheel==0.45.1
# via -r scriptdata/requirements.in

0 comments on commit f06c831

Please sign in to comment.