- Notifications
You must be signed in to change notification settings - Fork441
Description
I would suggest you improve your offering to the MyBinder-serves sessions by having things work right away when launched and open a specific example notebook.
DETAILS:
A. Set things to already be installed
You can make the provided MyBinder-served session more user friendly by making a directory named 'binder' and placing aconfiguration file namedrequirements.txt
in it with the following contents:
numpymatplotlibscipycontrolipympl
This will make the sessions that open already have these packages installed.
You even already had an example of stepping someone through the set uphere that you could eliminate that friction for everyone.
(Note thebinder
directory in root allows you to put configuration files in it that MyBinder will use and not interfere with other places the repo gets used. Thisbinder
directory option is currently covered in the documentationhere.)
B. Have the user already be presented an open notebook & the examples directory when the session comes up
I would even suggest maybe opening a particular notebook from that link. Maybe the one namedpython-control_tutorial.ipynb
?
You just need to extend the URL used from:
https://mybinder.org/v2/gh/python-control/python-control/HEAD
to
https://mybinder.org/v2/gh/python-control/python-control/HEAD?urlpath=%2Flab%2Ftree%2Fexamples%2Fpython-control_tutorial.ipynb
In fact, you can paste that URL in your address bar already to see it works to start with that one already open with all the other options already viewable in the file browser pane on the left. (Of course, without doing the step of adding the configuration file(s) suggested above it will need further work to run.)
EDIT TO ADDRESS ONE ADVANCED ISSUE I NOTED:
I see in thebode-and-nyquist-plots.ipynb
notbeook file you use,%matplotlib nbagg
in the second code cell. In the MyBinder-served launches that should be changed to%matplotlib ipympl
. I have already tested in launches fromhere whereipympl
is installed before the session starts that it adds the note functionality: "Enable interactive figures (panning and zooming)". That edit can be doneon-the-fly via apostBuild
orstart
file in thebinder
directory as well. (In fact, I have an examplehere where I use postBuild to completely remove a cell. Replacing some text is even easier. I have an example usingsed
to do find & replace in astart
filehere. Since you may be usingsed
, you can usehere as a model of thepostBuild
content to have a bash shell situation.)Note that the change is only done downstream where MyBinder-served sessions will use it and so it doesn't affect the notebook on the repo, or what people get when they clone thepython-control
repo.
Note: in this case the option to usepostBuild
orstart
won't really matter as you only need to do one thing & it isn't a time consuming step. Code instart
basically runs right before the user gets to see the session. It is the last thing done as the session spins up.postBuild
would make the change in the image that Docker will use later to make the session.start
files have a special command they need at the end to make the entrypoint still work right, and so I find in generalpostBuild
is easiest. Plus if it is already done in the docker image then it isn't a step that has to get done later when the session starts, saving a fraction of a second in this case but potentially much longer if the step were time consuming. Another caveat that makes this part trickier is that the permissions on these files have to be preserved. Unlike most things I suggested, you cannot do this in the GitHub browser as it will mess up being able to executestart
orpostBuild
in my experience.