Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .binder/apt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build-essential
swig
43 changes: 43 additions & 0 deletions .binder/postBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

set -e

python -m pip install .[docs,examples]

# Taken from https://github.com/scikit-learn/scikit-learn/blob/22cd233e1932457947e9994285dc7fd4e93881e4/.binder/postBuild
# under BSD3 license, copyright the scikit-learn contributors

# This script is called in a binder context. When this script is called, we are
# inside a git checkout of the automl/auto-sklearn repo. This script
# generates notebooks from the auto-sklearn python examples.

if [[ ! -f /.dockerenv ]]; then
echo "This script was written for repo2docker and is supposed to run inside a docker container."
echo "Exiting because this script can delete data if run outside of a docker container."
exit 1
fi

# Copy content we need from the auto-sklearn repo
TMP_CONTENT_DIR=/tmp/auto-sklearn
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=examples
cp -r $TMP_CONTENT_DIR/examples $GENERATED_NOTEBOOKS_DIR

find $GENERATED_NOTEBOOKS_DIR -name 'example_*.py' -exec sphx_glr_python_to_jupyter.py '{}' +
# Keep __init__.py and custom_metrics.py
NON_NOTEBOOKS=$(find $GENERATED_NOTEBOOKS_DIR -type f | grep -v '\.ipynb' | grep -v 'init' | grep -v 'custom_metrics')
rm -f $NON_NOTEBOOKS

# Modify path to be consistent by the path given by sphinx-gallery
mkdir notebooks
mv $GENERATED_NOTEBOOKS_DIR 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
1 change: 1 addition & 0 deletions .binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-r ../requirements.txt
21 changes: 20 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@
autosectionlabel_prefix_document = True

# Sphinx-gallery configuration.

# get current branch
binder_branch = 'master'
import autosklearn
if "dev" in autosklearn.__version__:
binder_branch = "development"

sphinx_gallery_conf = {
# path to the examples
'examples_dirs': '../examples',
Expand All @@ -71,7 +78,19 @@
#},
'backreferences_dir': None,
'filename_pattern': 'example.*.py$',
'ignore_pattern': r'custom_metrics\.py|__init__\.py'
'ignore_pattern': r'custom_metrics\.py|__init__\.py',
'binder': {
# Required keys
'org': 'automl',
'repo': 'auto-sklearn',
'branch': binder_branch,
'binderhub_url': 'https://mybinder.org',
'dependencies': ['../.binder/apt.txt', '../.binder/requirements.txt'],
#'filepath_prefix': '<prefix>' # A prefix to prepend to any filepaths in Binder links.
# Jupyter notebooks for Binder will be copied to this directory (relative to built documentation root).
'notebooks_dir': 'notebooks/',
'use_jupyter_lab': True, # Whether Binder links should start Jupyter Lab instead of the Jupyter Notebook interface.
},
}

# Add any paths that contain templates here, relative to this directory.
Expand Down