-
Notifications
You must be signed in to change notification settings - Fork 12
[DOC] add binder #464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Remi-Gau
wants to merge
3
commits into
mind-inria:main
Choose a base branch
from
Remi-Gau:doc/binder
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[DOC] add binder #464
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Adapted from scikit-learn | ||
| # https://github.com/scikit-learn/scikit-learn/blob/main/.binder/ | ||
|
|
||
| set -e | ||
|
|
||
| # This script is called in a binder context. When this script is called, we are | ||
| # inside a git checkout of the nilearn/nilearn repo. This script is | ||
| # generating notebooks from the nilearn python examples. | ||
|
|
||
| if [[ -z "${REPO_DIR}" ]]; then | ||
| echo "This script was written for repo2docker and the REPO_DIR environment variable is supposed to be set." | ||
| echo "Exiting because this script can delete data if run outside of a repo2docker context." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Back up content we need from the nilearn repo | ||
| TMP_CONTENT_DIR=/tmp/hidimstat | ||
| mkdir -p $TMP_CONTENT_DIR | ||
| cp -r examples .binder $TMP_CONTENT_DIR | ||
| # delete everything in current directory including dot files and dot folders | ||
| find . -delete | ||
|
|
||
| # Generate notebooks and remove other files from examples folder | ||
| GENERATED_NOTEBOOKS_DIR=.generated-notebooks | ||
| cp -r $TMP_CONTENT_DIR/examples $GENERATED_NOTEBOOKS_DIR | ||
|
|
||
| find $GENERATED_NOTEBOOKS_DIR -name '*.py' -exec sphinx_gallery_py2jupyter '{}' + | ||
| NON_NOTEBOOKS=$(find $GENERATED_NOTEBOOKS_DIR -type f | grep -v '\.ipynb') | ||
| rm -f $NON_NOTEBOOKS | ||
|
|
||
| # Put the .binder folder back (may be useful for debugging purposes) | ||
| mv $TMP_CONTENT_DIR/.binder . | ||
| # Final clean up | ||
| rm -rf $TMP_CONTENT_DIR | ||
|
|
||
| # This is for compatibility with binder sphinx-gallery integration: this makes | ||
| # sure that the binder links generated by sphinx-gallery are correct even tough | ||
| # the repo we use for binder (nilearn/nilearn) is not the repo of the | ||
| # generated doc (nilearn/nilearn.github.io) | ||
| mkdir notebooks | ||
| ln -s ../$GENERATED_NOTEBOOKS_DIR notebooks/auto_examples |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| .[example] | ||
| sphinx-gallery |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| python - 3.10 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # A binder requirement file is required by sphinx-gallery. | ||
| # We don't really need one since our binder requirement file lives in the | ||
| # .binder directory. | ||
| # This file can be removed if 'dependencies' is made an optional key for | ||
| # binder in sphinx-gallery. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.