Use pixi as env manager

https://github.com/prefix-dev/pixi
This commit is contained in:
2023-12-15 23:50:33 +01:00
parent fb4ac8ea73
commit 00abaab982
5 changed files with 762 additions and 22 deletions

View File

@@ -1,37 +1,21 @@
# https://github.com/casey/just
venv := "./venv"
pip := venv / "bin/pip"
python := venv / "bin/python"
python := "pixi run python"
last_commit_sha1 := `git rev-parse --short HEAD`
remote_image_name := "gitea.gdemontauzan.fr/maxenceg2m/github-release-notifier"
remote_build_image := remote_image_name + ":" + last_commit_sha1
# Run the script
run: _ensure_venv_is_ok
run: init
{{ python }} notifier.py
# Init python virtual env
# Init python env with pixi
init:
python3 -m venv venv
{{ pip }} install --requirement requirements.txt
sha256sum requirements.txt > {{ venv }}/requirements.sha
pixi install
# Inspiration: https://github.com/behave/behave/blob/afb6b6716cd0f3e028829416475312db804a6aa9/justfile
_ensure_venv_is_ok:
#!/usr/bin/env python3
from subprocess import run
from os import path
if run("sha256sum -c {{ venv }}/requirements.sha", shell=True).returncode != 0:
run("just init", shell=True)
# Clean workspace - remove venv - and init
reinit: hclean init
# Remove virtual env (venv)
# Remove virtual env (pixi)
hclean:
rm -fr venv
rm -fr .pixi
# Run docker compose then show logs
dup: dbuild