# Stop everything if one command fails
set -e

# Install from sources
# NB: If you want to use Jupytext on your binder, don't install it from source,
# just add "jupytext" to your "binder/requirements.txt" instead.
HATCH_BUILD_HOOKS_ENABLE=true pip install .

mkdir -p ${HOME}/.jupyter/labconfig
cp binder/labconfig/* ${HOME}/.jupyter/labconfig

# Create the notebook for our jupytext demo
jupytext demo/get_started.md --to ipynb --update-metadata '{"jupytext":null}'

# Remove the markdown representation
# (the demo starts with just the ipynb file)
rm demo/get_started.md

# Trust our World Population notebook
jupyter trust demo/World\ population.ipynb

# Install the bash kernel
python -m bash_kernel.install
