8000 [MRG] Move binder setup to scikit-learn/scikit-learn repo (#14719) · lesteve/scikit-learn@c39a050 · GitHub
[go: up one dir, main page]

Skip to content

Commit c39a050

Browse files
committed
[MRG] Move binder setup to scikit-learn/scikit-learn repo (scikit-learn#14719)
1 parent b0af586 commit c39a050

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

.binder/postBuild

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# This script is called in a binder context. When this script is called, we are
6+
# inside a git checkout of the scikit-learn/scikit-learn repo. This script is
7+
# generating notebooks from the scikit-learn python examples.
8+
9+
if [[ ! -f /.dockerenv ]]; then
10+
echo "This script was written for repo2docker and is supposed to run inside a docker container."
11+
echo "Exiting because this script can delete data if run outside of a docker container."
12+
exit 1
13+
fi
14+
15+
# Back up content we need from the scikit-learn repo
16+
TMP_CONTENT_DIR=/tmp/scikit-learn
17+
mkdir -p $TMP_CONTENT_DIR
18+
cp -r examples .binder $TMP_CONTENT_DIR
19+
# delete everything in current directory including dot files and dot folders
20+
find . -delete
21+
22+
# Generate notebooks and remove other files from examples folder
23+
GENERATED_NOTEBOOKS_DIR=.generated-notebooks
24+
cp -r $TMP_CONTENT_DIR/examples $GENERATED_NOTEBOOKS_DIR
25+
26+
find $GENERATED_NOTEBOOKS_DIR -name '*.py' -exec sphx_glr_python_to_jupyter.py '{}' +
27+
NON_NOTEBOOKS=$(find $GENERATED_NOTEBOOKS_DIR -type f | grep -v '\.ipynb')
28+
rm -f $NON_NOTEBOOKS
29+
30+
# Put the .binder folder back (may be useful for debugging purposes)
31+
mv $TMP_CONTENT_DIR/.binder .
32+
# Final clean up
33+
rm -rf $TMP_CONTENT_DIR
34+
35+
# This is for compatibility with binder sphinx-gallery integration: this makes
36+
# sure that the binder links generated by sphinx-gallery are correct even tough
37+
# the repo we use for binder (scikit-learn/scikit-learn) is not the repo of the
38+
# generated doc (scikit-learn/scikit-learn.github.io)
39+
mkdir notebooks
40+
ln -s ../$GENERATED_NOTEBOOKS_DIR notebooks/auto_examples

.binder/requirements.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
--find-links https://sklearn-nightly.scdn8.secure.raxcdn.com scikit-learn
2+
matplotlib
3+
scikit-image
4+
pandas
5+
sphinx-gallery
6+
scikit-learn>=0.22.dev0
7+

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@
267267
'gallery_dirs': ['auto_examples'],
268268
'binder': {
269269
'org': 'scikit-learn',
270-
'repo': 'binder-examples',
270+
'repo': 'scikit-learn',
271271
'binderhub_url': 'https://mybinder.org',
272272
'branch': binder_branch,
273273
'dependencies': './binder/requirements.txt',

0 commit comments

Comments
 (0)
0