File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 1+ # A binder requirement file is required by sphinx-gallery. We don't really need
2+ # one since the binder requirement files live in the
3+ # scikit-learn/binder-examples repo and not in the scikit-learn.github.io repo
4+ # that comes from the scikit-learn doc build. This file can be removed if
5+ # 'dependencies' is made an optional key for binder in sphinx-gallery.
Original file line number Diff line number Diff line change 1515import sys
1616import os
1717import warnings
18+ import re
1819
1920# If extensions (or modules to document with autodoc) are in another
2021# directory, add these directories to sys.path here. If the directory
247248 'joblib' : ('https://joblib.readthedocs.io/en/latest/' , None ),
248249}
249250
251+ if 'dev' in version :
252+ binder_branch = 'master'
253+ else :
254+ match = re .match (r'^(\d+)\.(\d+)(?:\.\d+)?$' , version )
255+ if match is None :
256+ raise ValueError (
257+ 'Ill-formed version: {!r}. Expected either '
258+ "a version containing 'dev' "
259+ 'or a version like X.Y or X.Y.Z.' .format (version ))
260+
261+ major , minor = match .groups ()
262+ binder_branch = '{}.{}.X' .format (major , minor )
263+
250264sphinx_gallery_conf = {
251265 'doc_module' : 'sklearn' ,
252266 'backreferences_dir' : os .path .join ('modules' , 'generated' ),
253267 'show_memory' : True ,
254268 'reference_url' : {
255- 'sklearn' : None }
269+ 'sklearn' : None },
270+ 'examples_dirs' : ['../examples' ],
271+ 'gallery_dirs' : ['auto_examples' ],
272+ 'binder' : {
273+ 'org' : 'scikit-learn' ,
274+ 'repo' : 'binder-examples' ,
275+ 'binderhub_url' : 'https://mybinder.org' ,
276+ 'branch' : binder_branch ,
277+ 'dependencies' : './binder/requirements.txt' ,
278+ 'use_jupyter_lab' : True
279+ }
256280}
257281
258282
You can’t perform that action at this time.
0 commit comments