repo2docker icon indicating copy to clipboard operation
repo2docker copied to clipboard

Jupyter configuration in .binder folder not taken into account

Open seignovert opened this issue 2 years ago • 3 comments

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.jsonfile in the .binder/folder to keep all the binder related files in the same folder.

Actual behaviour

The jupyter_config.jsonfile 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:

Binder

Expected behavior with jupyter_config.json at the root of the project:

Binder

This issue can be reproduce with repo2docker locally as well.

seignovert avatar Jun 29 '22 10:06 seignovert

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. welcome 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:

welcome[bot] avatar Jun 29 '22 10:06 welcome[bot]

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.

manics avatar Jun 29 '22 12:06 manics

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

Binder

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:

seignovert avatar Jul 05 '22 10:07 seignovert