All you still have to do is to type import notebook name, and I hope that it is close enough. By doing so, you can elimitate the step to manually export scripts. source ) # run the code in themodule exec ( code, mod. The config file /.jupyter/jupyternotebookconfig.py allows you to have JupyterLab automatically export notebooks as Python scripts each time you make changes. cell_type = 'code' : # transform the input to executable Python code = self. modules = mod # extra work to ensure that magics that would affect the user_ns # actually affect the notebook module's ns save_user_ns = self. ![]() open ( path, 'r', encoding = 'utf-8' ) as f : nb = read ( f, 4 ) # create the module and add it to sys.modules # if name in sys.modules: # return sys.modules mod = types. ![]() path ) print ( "importing Jupyter notebook from %s " % path ) # load the notebook object with io. path = path def load_module ( self, fullname ): """import a notebook as a module""" path = find_notebook ( fullname, self. Connecting to an existing IPython kernel using the Qt ConsoleĬlass NotebookLoader ( object ): """Module Loader for Jupyter Notebooks""" def _init_ ( self, path = None ): self. ![]()
0 Comments
Leave a Reply. |