Restructure

This commit is contained in:
2025-10-20 23:06:52 +02:00
parent 995857ae54
commit c17e5bcc22
54 changed files with 19217 additions and 324966 deletions

View File

@@ -1,13 +1,25 @@
#!/bin/bash
for f in $(git diff --name-only --cached); do
if [[ $f == *.ipynb ]]; then
jupyter nbconvert --clear-output --inplace $f
git add $f
set -e
# Find all staged .ipynb files
NOTEBOOKS=$(git diff --cached --name-only --diff-filter=ACM | grep '\.ipynb$' || true)
if [ -z "$NOTEBOOKS" ]; then
echo "No Jupyter notebooks staged. Skipping Jupytext conversion."
exit 0
fi
echo "Converting staged Jupyter notebooks to .py (percent format)..."
# Loop through each notebook and convert
for nb in $NOTEBOOKS; do
if [ -f "$nb" ]; then
echo " - Converting $nb"
jupytext --to py:percent "$nb"
pyfile="${nb%.ipynb}.py"
# Stage the generated .py file
git add "$pyfile"
fi
done
if git diff --name-only --cached --exit-code
then
echo "No changes detected after removing notebook output"
exit 1
fi
echo "✅ Jupytext conversion complete."