@@ -424,10 +424,11 @@ class Exporter(nbconvert.RSTExporter):
424
424
425
425
"""
426
426
427
- def __init__ (self , execute = 'auto' , allow_errors = False , timeout = 30 ,
428
- codecell_lexer = 'none' ):
427
+ def __init__ (self , execute = 'auto' , execute_arguments = [] ,
428
+ allow_errors = False , timeout = 30 , codecell_lexer = 'none' ):
429
429
"""Initialize the Exporter."""
430
430
self ._execute = execute
431
+ self ._execute_arguments = execute_arguments
431
432
self ._allow_errors = allow_errors
432
433
self ._timeout = timeout
433
434
self ._codecell_lexer = codecell_lexer
@@ -467,6 +468,7 @@ def from_notebook_node(self, nb, resources=None, **kw):
467
468
'allow_errors' , self ._allow_errors )
468
469
timeout = nbsphinx_metadata .get ('timeout' , self ._timeout )
469
470
pp = nbconvert .preprocessors .ExecutePreprocessor (
471
+ extra_arguments = self ._execute_arguments ,
470
472
allow_errors = allow_errors , timeout = timeout )
471
473
nb , resources = pp .preprocess (nb , resources )
472
474
@@ -512,10 +514,13 @@ def parse(self, inputstring, document):
512
514
resources ['output_files_dir' ] = os .path .relpath (auxdir , srcdir )
513
515
resources ['unique_key' ] = env .docname .replace ('/' , '_' )
514
516
515
- exporter = Exporter (execute = env .config .nbsphinx_execute ,
516
- allow_errors = env .config .nbsphinx_allow_errors ,
517
- timeout = env .config .nbsphinx_timeout ,
518
- codecell_lexer = env .config .nbsphinx_codecell_lexer )
517
+ exporter = Exporter (
518
+ execute = env .config .nbsphinx_execute ,
519
+ execute_arguments = env .config .nbsphinx_execute_arguments ,
520
+ allow_errors = env .config .nbsphinx_allow_errors ,
521
+ timeout = env .config .nbsphinx_timeout ,
522
+ codecell_lexer = env .config .nbsphinx_codecell_lexer ,
523
+ )
519
524
520
525
try :
521
526
rststring , resources = exporter .from_notebook_node (nb , resources )
@@ -1137,6 +1142,7 @@ def setup(app):
1137
1142
_add_notebook_parser (app )
1138
1143
1139
1144
app .add_config_value ('nbsphinx_execute' , 'auto' , rebuild = 'env' )
1145
+ app .add_config_value ('nbsphinx_execute_arguments' , [], rebuild = 'env' )
1140
1146
app .add_config_value ('nbsphinx_allow_errors' , False , rebuild = '' )
1141
1147
app .add_config_value ('nbsphinx_timeout' , 30 , rebuild = '' )
1142
1148
app .add_config_value ('nbsphinx_codecell_lexer' , 'none' , rebuild = 'env' )
0 commit comments