def python_to_jupyter_cli(args=None, namespace=None):
 parser = argparse.ArgumentParser(description='Sphinx-Gallery Notebook converter')
 parser.add_argument('python_src_file', nargs='+', help='Input Python file script to convert. Supports multiple files and shell wildcards (e.g. *.py)')
 args = parser.parse_args(args, namespace)
 for src_file in args.python_src_file:
  blocks = split_code_and_text_blocks(src_file)
  print('Converting {0}'.format(src_file))
  example_nb = jupyter_notebook(blocks)
  save_notebook(example_nb, src_file.replace('.py', '.ipynb'))

def python_to_jupyter_cli ( args = None , namespace = None ) : parser = argparse . ArgumentParser ( description = 'Sphinx-Gallery Notebook converter' ) parser . add_argument ( 'python_src_file' , nargs = '+' , help = 'Input Python file script to convert. Supports multiple files and shell wildcards (e.g. *.py)' ) args = parser . parse_args ( args , namespace ) for src_file in args . python_src_file : blocks = split_code_and_text_blocks ( src_file ) print ( 'Converting {0}' . format ( src_file ) ) example_nb = jupyter_notebook ( blocks ) save_notebook ( example_nb , src_file . replace ( '.py' , '.ipynb' ) )
exposes the jupyter notebook renderer to the command line takes the same arguments as argumentparser .