repo2docker
repo2docker copied to clipboard
Jupyter configuration in .binder folder not taken into account
Bug description
JupyterLab allows real time collaboration between multiple users. As shown by @jtpio, it is possible to enable the collaborative mode in Binder by putting a jupyter_config.json
file, with at least this content:
{
"LabApp": {
"collaborative": true
}
}
Unfortunately, if the configure is put in a .binder/
folder, the jupyter_config.json
file is not taken into account and the collaboration mode is not enabled.
As reported by @adrienpacifico, this file must be located at the root of the project to be taken into account by Binder.
Expected behaviour
It should be possible to put the jupyter_config.json
file in the .binder/
folder to keep all the binder related files in the same folder.
Actual behaviour
The jupyter_config.json
file is ignored when it is put in the .binder/
folder
How to reproduce
See: seignovert/binder-collab-issue
Issue example with jupyter_config.json
in .binder/
folder:
Expected behavior with jupyter_config.json
at the root of the project:
This issue can be reproduce with repo2docker locally as well.
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:
That's sounds like expected behaviour. Repo2docker only takes into account a limited number of files, as described in https://repo2docker.readthedocs.io/en/latest/configuration/index.html
Automatically moving binder/*
to the parent directory could lead to unexpected behaviour, e.g. it might overwrite another file, as well as making the files more visible which people may not want.
If you want to keep all files in the same directory you can put everything into the root directory, using the binder/
or .binder/
directories is optional. Alternatively you can use postBuild
to move files.
Thanks @manics for your response.
The main idea is to isolate the project (located at the root directory) and the configuration required for Binder (in the .binder/
folder).
I was able to generate a jupyter config file for Binder with a postBuild
file like this:
if [ -f ~/.jupyter/jupyter_lab_config.py ]
then
sed -i 's/# c.LabApp.collaborative = False/c.LabApp.collaborative = True/' ~/.jupyter/jupyter_lab_config.py
else
mkdir -p ~/.jupyter/
echo 'c.LabApp.collaborative = True' > ~/.jupyter/jupyter_lab_config.py
fi
but it is not really straight forward (to keep repo2docker
compatibility) and artificially complex.
Do you have a better approach to recommend?
This problem could also be solved by adding a --collaborative
flag to the entrypoint, but I don't know if it is possible. Maybe in the start
file? :thinking: