-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
48 lines (39 loc) · 1.02 KB
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{ pkgs ? import <nixpkgs> {} }:
with pkgs.python310Packages;
pkgs.mkShell {
buildInputs = [
jupyterlab
ipykernel
matplotlib
pip
virtualenv
scikit-learn
pylint
pytest
numpy
cffi
graphviz
torch
networkx
pydot
];
shellHook = ''
VENV_DIR=.venv
KERNEL_NAME="shrimpgrad-kernel"
KERNEL_DISPLAY_NAME="ShrimpGrad Kernel"
if [ ! -d "$VENV_DIR" ]; then
python3.10 -m venv $VENV_DIR
fi
source $VENV_DIR/bin/activate
export PYTHONPATH=$PYTHONPATH:/$(pwd)
# Ensure pip is using the correct Python version
#pip install --upgrade pip setuptools wheel
# Install the package
pip install --upgrade --no-deps --force-reinstall -e .
# Create a new Jupyter kernel
python -m ipykernel install --user --name=$KERNEL_NAME --display-name="$KERNEL_DISPLAY_NAME"
echo "Virtual environment activated. Package installed in editable mode."
echo "Jupyter kernel '$KERNEL_DISPLAY_NAME' created."
echo "Python Path: '$PYTHONPATH'"
'';
}