@@ -545,7 +545,13 @@ def jupyterlite_build(app: Sphinx, error):
545545 print ("[jupyterlite-sphinx] Running JupyterLite build" )
546546 jupyterlite_config = app .env .config .jupyterlite_config
547547 jupyterlite_contents = app .env .config .jupyterlite_contents
548- jupyterlite_dir = app .env .config .jupyterlite_dir
548+
549+ jupyterlite_dir = str (app .env .config .jupyterlite_dir )
550+
551+ jupyterlite_debug = app .env .config .jupyterlite_debug
552+ jupyterlite_log_level = app .env .config .jupyterlite_log_level
553+ jupyterlite_verbosity = app .env .config .jupyterlite_verbosity
554+ jupyterlite_reporter = app .env .config .jupyterlite_reporter
549555
550556 config = []
551557 if jupyterlite_config :
@@ -574,21 +580,36 @@ def jupyterlite_build(app: Sphinx, error):
574580 apps_option .extend (["--apps" , "voici" ])
575581
576582 command = [
577- "jupyter" ,
578- "lite" ,
579- "build" ,
580- "--debug" ,
581- * config ,
582- * contents ,
583- "--contents" ,
584- os .path .join (app .srcdir , CONTENT_DIR ),
585- "--output-dir" ,
586- os .path .join (app .outdir , JUPYTERLITE_DIR ),
587- * apps_option ,
588- "--lite-dir" ,
589- jupyterlite_dir ,
583+ c
584+ for c in (
585+ "jupyter" ,
586+ "lite" ,
587+ "doit" "build" ,
588+ "--debug" if jupyterlite_debug else None ,
589+ * config ,
590+ * contents ,
591+ "--contents" ,
592+ os .path .join (app .srcdir , CONTENT_DIR ),
593+ "--output-dir" ,
594+ os .path .join (app .outdir , JUPYTERLITE_DIR ),
595+ * apps_option ,
596+ "--lite-dir" ,
597+ jupyterlite_dir ,
598+ "--log-level" if jupyterlite_log_level is not None else None ,
599+ jupyterlite_log_level ,
600+ "--" ,
601+ "--verbosity" if jupyterlite_verbosity else None ,
602+ jupyterlite_verbosity ,
603+ "--reporter" if jupyterlite_reporter else None ,
604+ jupyterlite_reporter ,
605+ )
606+ if c is not None
590607 ]
591608
609+ assert all (
610+ [isinstance (s , str ) for s in command ]
611+ ), f"Expected all commands arguments to be a str, got { command } "
612+
592613 subprocess .run (command , cwd = app .srcdir , check = True )
593614
594615 print ("[jupyterlite-sphinx] JupyterLite build done" )
@@ -611,10 +632,16 @@ def setup(app):
611632
612633 # Config options
613634 app .add_config_value ("jupyterlite_config" , None , rebuild = "html" )
614- app .add_config_value ("jupyterlite_dir" , app .srcdir , rebuild = "html" )
635+ app .add_config_value ("jupyterlite_dir" , str ( app .srcdir ) , rebuild = "html" )
615636 app .add_config_value ("jupyterlite_contents" , None , rebuild = "html" )
616637 app .add_config_value ("jupyterlite_bind_ipynb_suffix" , True , rebuild = "html" )
617638
639+ # JLite debug configuration options
640+ app .add_config_value ("jupyterlite_debug" , False , rebuild = "html" )
641+ app .add_config_value ("jupyterlite_log_level" , "WARN" , rebuild = "html" )
642+ app .add_config_value ("jupyterlite_verbosity" , "0" , rebuild = "html" )
643+ app .add_config_value ("jupyterlite_reporter" , "zero" , rebuild = "html" )
644+
618645 app .add_config_value ("global_enable_try_examples" , default = False , rebuild = True )
619646 app .add_config_value ("try_examples_global_theme" , default = None , rebuild = True )
620647 app .add_config_value ("try_examples_global_warning_text" , default = None , rebuild = True )
0 commit comments