-
-
Save fepegar/235c65fff85c0cd62f226d2711ac48b0 to your computer and use it in GitHub Desktop.
Revisions
-
fepegar revised this gist
Feb 18, 2025 . 1 changed file with 25 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ #!/bin/bash PYTHON_VERSION="3.13" tmp_dir=$(mktemp -d) @@ -19,6 +19,15 @@ done notebook_contents=$(cat <<EOF { "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%load_ext rich" ] }, { "cell_type": "code", "execution_count": null, @@ -28,8 +37,22 @@ notebook_contents=$(cat <<EOF } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.2" } }, "nbformat": 4, -
fepegar created this gist
Feb 18, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ #!/bin/bash PYTHON_VERSION=3.13 tmp_dir=$(mktemp -d) uv init \ --bare \ --quiet \ --python $PYTHON_VERSION \ $tmp_dir cmd=(uv add --directory $tmp_dir ipykernel ipywidgets rich) for dependency in "$@"; do cmd+=( "$dependency") done "${cmd[@]}" notebook_contents=$(cat <<EOF { "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 2 } EOF ) echo $notebook_contents > $tmp_dir/notebook.ipynb code --new-window $tmp_dir code --reuse-window $tmp_dir/notebook.ipynb