Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Suggestion: improve MyBinder-served sessions with some minor changes #1122

Open
@fomightez

Description

@fomightez

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp