def default_config(self):
        # import jupyter_core.paths
        # import os
        c = Config({
            'NbConvertBase': {
                'display_data_priority': [
                    'application/javascript', 'text/html', 'text/markdown',
                    'image/svg+xml', 'text/latex', 'image/png', 'image/jpeg',
                    'text/plain'
                ]
            },
            'CSSHTMLHeaderPreprocessor': {
                'enabled': True
            },
            'HighlightMagicsPreprocessor': {
                'enabled': True
            },
            'ExtractOutputPreprocessor': {
                'enabled': True
            },
            'latex_envs.LenvsLatexPreprocessor': {
                'enabled': True
            }
        })
        from jupyter_contrib_nbextensions.nbconvert_support import (
            templates_directory)
        c.merge(super(LenvsLatexExporter, self).default_config)

        # user_templates = os.path.join(jupyter_core.paths.jupyter_data_dir(),
        # 'templates')
        c.TemplateExporter.template_path = ['.', templates_directory()]

        # c.Exporter.preprocessors = ['tmp.LenvsLatexPreprocessor' ]
        # c.NbConvertApp.postprocessor_class = 'tmp.TocPostProcessor'
        return c
예제 #2
0
    def default_config(self):
        import metapack.jupyter.templates

        c = Config()

        c.TemplateExporter.template_path = [dirname(metapack.jupyter.templates.__file__)]

        c.HTMLExporter.preprocessors = [
            'metapack.jupyter.preprocessors.NoShowInput',
            'metapack.jupyter.preprocessors.RemoveMetatab',
            'metapack.jupyter.preprocessors.HtmlBib'
        ]

        c.HTMLExporter.exclude_input_prompt = True
        c.HTMLExporter.exclude_output_prompt = True

        c.MarkdownExporter.preprocessors = ['metapack.jupyter.preprocessors.RemoveMagics']

        c.PDFExporter.preprocessors = [
            # 'metapack.jupyter.preprocessors.NoShowInput',
            'metapack.jupyter.preprocessors.RemoveMetatab',
            'metapack.jupyter.preprocessors.LatexBib',
            'metapack.jupyter.preprocessors.MoveTitleDescription'
        ]

        c.PDFExporter.exclude_input_prompt = True
        # Excluding the output prompt also excludes the output tables.
        # .PDFExporter.exclude_output_prompt = True

        c.merge(super(DocumentationExporter, self).default_config)
        return c
예제 #3
0
    def __init__(self, **kwargs):
        config = Config()
        config2 = kwargs.pop("config", None)

        options = {
            "gateway_url":
            "tls://127.0.0.1:%d" % random_port(),
            "private_url":
            "http://127.0.0.1:%d" % random_port(),
            "public_url":
            "http://127.0.0.1:%d" % random_port(),
            "db_url":
            "sqlite:///:memory:",
            "authenticator_class":
            "dask_gateway_server.auth.DummyAuthenticator",
            "cluster_manager_class":
            ("dask_gateway_server.managers.inprocess.InProcessClusterManager"),
        }
        options.update(kwargs)
        config["DaskGateway"].update(options)

        if config2:
            config.merge(config2)

        self.config = config
    def default_config(self):
        # import jupyter_core.paths
        # import os
        c = Config({
            'NbConvertBase': {
                'display_data_priority': ['application/javascript',
                                          'text/html',
                                          'text/markdown',
                                          'image/svg+xml',
                                          'text/latex',
                                          'image/png',
                                          'image/jpeg',
                                          'text/plain'
                                          ]
            },
            'CSSHTMLHeaderPreprocessor': {
                'enabled': True},
            'HighlightMagicsPreprocessor': {
                'enabled': True},
            'ExtractOutputPreprocessor': {
                'enabled': True},
            'latex_envs.LenvsLatexPreprocessor': {'enabled': True}
        }
        )
        from jupyter_contrib_nbextensions.nbconvert_support import (
            templates_directory)
        c.merge(super(LenvsLatexExporter, self).default_config)

        # user_templates = os.path.join(jupyter_core.paths.jupyter_data_dir(),
        # 'templates')
        c.TemplateExporter.template_path = ['.', templates_directory()]

        # c.Exporter.preprocessors = ['tmp.LenvsLatexPreprocessor' ]
        # c.NbConvertApp.postprocessor_class = 'tmp.TocPostProcessor'
        return c
예제 #5
0
    def default_config(self):

        c = Config({
            'ExtractOutputPreprocessor': {
                'enabled': True
            },
            'NbConvertBase': {
                'display_data_priority': [
                    'text/html', 'text/markdown', 'image/svg+xml',
                    'text/latex', 'image/png', 'image/jpeg', 'text/plain'
                ]
            },
            'NbConvertApp': {
                'writer_class': 'foobar'
            },
            'FilesWriter': {
                'build_directory': 'foobar/'
            },
            'HighlightMagicsPreprocessor': {
                'enabled': True
            },
        })

        c.merge(super(MarkdownExporter, self).default_config)

        return c
    def default_config(self):
        # import jupyter_core.paths
        # import os
        c = Config({
            'NbConvertBase': {
                'display_data_priority': ['application/javascript',
                                          'text/html',
                                          'text/markdown',
                                          'image/svg+xml',
                                          'text/latex',
                                          'image/png',
                                          'image/jpeg',
                                          'text/plain'
                                          ]
            },
            'CSSHTMLHeaderPreprocessor': {
                'enabled': True},
            'HighlightMagicsPreprocessor': {
                'enabled': True},
            'ExtractOutputPreprocessor': {
                'enabled': True},
            'latex_envs.LenvsLatexPreprocessor': {'enabled': True}
        }
        )
        c.merge(super(LenvsLatexExporter, self).default_config)

        if os.path.isdir(os.path.join(os.path.dirname(__file__), 'templates')):
            c.TemplateExporter.template_path = ['.',
                                                os.path.join(os.path.dirname(__file__), 'templates')]
        else:
            from jupyter_contrib_nbextensions.nbconvert_support import (
                templates_directory)
            c.TemplateExporter.template_path = ['.', templates_directory()]
        return c
예제 #7
0
 def default_config(self):
     c = Config({
         'NbConvertBase': {
             'display_data_priority': [
                 'text/latex', 'application/pdf', 'image/png', 'image/jpeg',
                 'image/svg+xml', 'text/markdown', 'text/plain'
             ]
         },
         'ExtractOutputPreprocessor': {
             'enabled': True
         },
         'SVG2PDFPreprocessor': {
             'enabled': True
         },
         'LatexPreprocessor': {
             'enabled': True
         },
         'SphinxPreprocessor': {
             'enabled': True
         },
         'HighlightMagicsPreprocessor': {
             'enabled': True
         }
     })
     c.merge(super(LatexExporter, self).default_config)
     return c
예제 #8
0
 def default_config(self):
     c = Config({
         'CSSHTMLHeaderPreprocessor': {
             'enabled': False
         },
     })
     c.merge(super(VoilaExporter, self).default_config)
     return c
예제 #9
0
    def default_config(self):

        c = Config()

        c.ExecutePreprocessor.timeout = 600

        c.merge(super(NotebookExecutor, self).default_config)
        return c
예제 #10
0
 def load_config(self, config_name):
     cfg = Config()
     for path in jupyter_config_path():
         file = os.path.join(path, config_name)
         if os.path.isfile(file):
             new_cfg = PyFileConfigLoader(file).load_config()
             cfg.merge(new_cfg)
     return cfg
예제 #11
0
파일: slides.py 프로젝트: CaptainAL/Spyder
 def default_config(self):
     c = Config({
         'RevealHelpPreprocessor': {
             'enabled': True,
             },
         })
     c.merge(super(SlidesExporter,self).default_config)
     return c
예제 #12
0
 def default_config(self):
     c = Config({
         'VoilaExporter': {
             'markdown_renderer_class': 'voila.exporter.VoilaMarkdownRenderer'
         }
     })
     c.merge(super(VoilaExporter, self).default_config)
     return c
예제 #13
0
 def default_config(self):
     c = Config({
         'RevealHelpPreprocessor': {
             'enabled': True,
         },
     })
     c.merge(super(SlidesExporter, self).default_config)
     return c
예제 #14
0
    def default_config(self):
        import jupyter_core.paths
        import os
        c = Config({'ExtractOutputPreprocessor': {'enabled': True}})
        c.merge(super(TocExporter, self).default_config)

        user_templates = os.path.join(jupyter_core.paths.jupyter_data_dir(),
                                      'templates')
        c.TemplateExporter.template_path = ['.', user_templates]
        return c
    def default_config(self):
        c = Config({"ExtractOutputPreprocessor": {"enabled": True}})
        #  import here to avoid circular import
        from jupyter_contrib_nbextensions.nbconvert_support import templates_directory

        c.merge(super(TocExporter, self).default_config)

        c.TemplateExporter.template_path = [".", templates_directory()]

        return c
예제 #16
0
 def default_config(self):
     import jupyter_core.paths
     import os
     c = Config({'ExtractOutputPreprocessor':{'enabled':True}})
     c.merge(super(TocExporter,self).default_config)
     
     user_templates = os.path.join(jupyter_core.paths.jupyter_data_dir(), 'templates')
     c.TemplateExporter.template_path = [
                             '.', user_templates ]
     return c
예제 #17
0
 def _compile_string(self, nb_json):
     """Export notebooks as HTML strings."""
     self._req_missing_ipynb()
     c = Config(get_default_jupyter_config())
     c.merge(Config(self.site.config['IPYNB_CONFIG']))
     if 'template_file' not in self.site.config['IPYNB_CONFIG'].get('Exporter', {}):
         c['Exporter']['template_file'] = 'basic.tpl'  # not a typo
     exportHtml = HTMLExporter(config=c)
     body, _ = exportHtml.from_notebook_node(nb_json)
     return body
예제 #18
0
 def default_config(self):
     c = Config({
         'ExtractOutputPreprocessor': {
             'enabled': True
         },
         'NbConvertBase': {
             'display_data_priority': ['text/plain']
         }
     })
     c.merge(super(ArcExporter, self).default_config)
     return c
예제 #19
0
 def default_config(self):
     c = Config({
         'ExtractOutputPreprocessor':{
             'enabled':True
             },
         'HighlightMagicsPreprocessor': {
             'enabled':True
             },
         })
     c.merge(super(RSTExporter,self).default_config)
     return c
예제 #20
0
 def default_config(self):
     c = Config({
         'RegexRemovePreprocessor': {
             'enabled': True
             },
         'TagRemovePreprocessor': {
             'enabled': True
             }
         })
     c.merge(super(TemplateExporter, self).default_config)
     return c
예제 #21
0
 def default_config(self):
     c = Config({
         'RegexRemovePreprocessor': {
             'enabled': True
             },
         'TagRemovePreprocessor': {
             'enabled': True
             }
         })
     c.merge(super().default_config)
     return c
예제 #22
0
 def default_config(self):
     c = Config({
         "RegexRemovePreprocessor": {
             "enabled": True
         },
         "TagRemovePreprocessor": {
             "enabled": True
         },
     })
     c.merge(super().default_config)
     return c
예제 #23
0
파일: exporter.py 프로젝트: yutiansut/voila
 def default_config(self):
     c = Config({
         'CSSHTMLHeaderPreprocessor': {
             'enabled': False
         },
         'VoilaExporter': {
             'markdown_renderer_class': 'voila.exporter.VoilaMarkdownRenderer'
         }
     })
     c.merge(super(VoilaExporter, self).default_config)
     return c
예제 #24
0
파일: rst.py 프로젝트: jupyter/nbconvert
 def default_config(self):
     c = Config({
         'ExtractOutputPreprocessor':{
             'enabled':True
             },
         'HighlightMagicsPreprocessor': {
             'enabled':True
             },
         })
     c.merge(super(RSTExporter,self).default_config)
     return c
예제 #25
0
 def default_config(self):
     c = Config({
         "ExtractOutputPreprocessor": {
             "enabled": True
         },
         "HighlightMagicsPreprocessor": {
             "enabled": True
         },
     })
     c.merge(super().default_config)
     return c
예제 #26
0
 def default_config(self):
     c = Config({
         'ExtractOutputPreprocessor': {
             'enabled': True,
             'output_filename_template': '{unique_key}_{cell_index}_{index}{extension}'
         },
         'HighlightMagicsPreprocessor': {
             'enabled': True
         },
     })
     c.merge(super(UpgradedRSTExporter, self).default_config)
     return c
    def default_config(self):
        c = Config({'ExtractOutputPreprocessor': {'enabled': False}})
        #  import here to avoid circular import
        from jupyter_contrib_nbextensions.nbconvert_support import (
            templates_directory)
        c.merge(super(TocExporter, self).default_config)

        c.TemplateExporter.template_path = [
            '.',
            templates_directory(),
        ]

        return c
예제 #28
0
    def default_config(self):
        c = Config({'ExtractOutputPreprocessor': {'enabled': True}})
        #  import here to avoid circular import
        from jupyter_contrib_nbextensions.nbconvert_support import (
            templates_directory)
        c.merge(super(TocExporter, self).default_config)

        c.TemplateExporter.template_path = [
            '.',
            templates_directory(),
        ]

        return c
예제 #29
0
def export_through_preprocessor(
        notebook_node, preproc_cls, exporter_class, export_format, customconfig=None):
    """Export a notebook through a given preprocessor."""
    config=Config(NbConvertApp={'export_format': export_format })
    if customconfig is not None:
        config.merge(customconfig)
    exporter = exporter_class(
        preprocessors=[preproc_cls.__module__ + '.' + preproc_cls.__name__],
        config=config)
    try:
        return exporter.from_notebook_node(notebook_node)
    except PandocMissing:
        raise SkipTest("Pandoc wasn't found")
예제 #30
0
 def _merge_profile_config(self, proposal):
     direct_config = proposal.value
     if not self.load_profile:
         return direct_config
     profile_config = self.profile_config
     if not profile_config:
         return direct_config
     # priority ?! direct > profile
     config = Config()
     if profile_config:
         config.merge(profile_config)
     config.merge(direct_config)
     return config
예제 #31
0
 def default_config(self):
     c = Config({
         'ExtractOutputPreprocessor': {
             'enabled':
             True,
             'output_filename_template':
             '{unique_key}_{cell_index}_{index}{extension}'
         },
         'HighlightMagicsPreprocessor': {
             'enabled': True
         },
     })
     c.merge(super(UpgradedRSTExporter, self).default_config)
     return c
예제 #32
0
 def default_config(self):
     c = Config({
         'NbConvertBase': {
             'display_data_priority' : ['application/javascript', 'text/html', 'text/markdown', 'application/pdf', 'image/svg+xml', 'text/latex', 'image/png', 'image/jpeg', 'text/plain']
             },
         'CSSHTMLHeaderPreprocessor':{
             'enabled':True
             },
         'HighlightMagicsPreprocessor': {
             'enabled':True
             }
         })
     c.merge(super(HTMLExporter,self).default_config)
     return c
예제 #33
0
    def load_config(self):
        paths = jupyter_config_path()
        paths.insert(0, os.getcwd())

        config_found = False
        full_config = Config()
        for config in NbGrader._load_config_files("nbgrader_config", path=paths, log=self.log):
            full_config.merge(config)
            config_found = True

        if not config_found:
            self.log.warning("No nbgrader_config.py file found. Rerun with DEBUG log level to see where nbgrader is looking.")

        return full_config
예제 #34
0
 def default_config(self):
     c = Config({
         'NbConvertBase': {
             'display_data_priority': [
                 'text/html', 'text/markdown', 'image/svg+xml', 'image/png',
                 'image/jpeg', 'text/plain', 'text/latex'
             ]
         },
         'ExtractOutputPreprocessor': {
             'enabled': True
         }
     })
     c.merge(super(ASCIIDocExporter, self).default_config)
     return c
예제 #35
0
    def load_config(self):
        paths = jupyter_config_path()
        paths.insert(0, os.getcwd())

        config_found = False
        full_config = Config()
        for config in NbGrader._load_config_files("nbgrader_config", path=paths, log=self.log):
            full_config.merge(config)
            config_found = True

        if not config_found:
            self.log.warning("No nbgrader_config.py file found. Rerun with DEBUG log level to see where nbgrader is looking.")

        return full_config
예제 #36
0
    def __init__(self, **kwargs):
        c = Config()
        c.DaskGateway.backend_class = InProcessBackend

        config2 = kwargs.pop("config", None)

        c.DaskGateway.address = "127.0.0.1:0"
        c.Proxy.address = "127.0.0.1:0"
        c.DaskGateway.authenticator_class = (
            "dask_gateway_server.auth.SimpleAuthenticator")
        c.DaskGateway.update(kwargs)

        if config2:
            c.merge(config2)

        self.config = c
예제 #37
0
 def default_config(self):
     c = Config({
         'NbConvertBase': {
             'display_data_priority': [
                 'application/vnd.jupyter.widget-state+json',
                 'application/vnd.jupyter.widget-view+json',
                 'application/javascript', 'text/html', 'text/markdown',
                 'image/svg+xml', 'text/latex', 'image/png', 'image/jpeg',
                 'text/plain'
             ]
         },
         'HighlightMagicsPreprocessor': {
             'enabled': True
         }
     })
     c.merge(super().default_config)
     return c
예제 #38
0
    def default_config(self):
        c = Config({
            'ExtractOutputPreprocessor': {'enabled': True},
            'NbConvertBase': {
                'display_data_priority': ['text/html',
                                          'text/markdown',
                                          'image/svg+xml',
                                          'text/latex',
                                          'image/png',
                                          'image/jpeg',
                                          'text/plain'
                                          ]
            },

        })
        c.merge(super(MarkdownExporter, self).default_config)
        return c
예제 #39
0
 def default_config(self):
     c = Config({
         'NbConvertBase': {
             'display_data_priority': [
                 'application/javascript', 'text/html', 'text/markdown',
                 'application/pdf', 'image/svg+xml', 'text/latex',
                 'image/png', 'image/jpeg', 'text/plain'
             ]
         },
         'CSSHTMLHeaderPreprocessor': {
             'enabled': True
         },
         'HighlightMagicsPreprocessor': {
             'enabled': True
         }
     })
     c.merge(super(HTMLExporter, self).default_config)
     return c
예제 #40
0
 def default_config(self):
     c = Config({
         'ExtractOutputPreprocessor': {'enabled': True},
         'NbConvertBase': {
             'display_data_priority': ['text/html',
                                       'text/markdown',
                                       'image/svg+xml',
                                       'text/latex',
                                       'image/png',
                                       'image/jpeg',
                                       'text/plain'
                                       ]
         },
         'HighlightMagicsPreprocessor': {
             'enabled':True
             },
     })
     c.merge(super().default_config)
     return c
예제 #41
0
def _load_dict(directory):
    #check the config file exists
    if not os.path.exists(os.path.join(directory, 'jupyterhub_config.py')):
        sys.exit(
             f"""
             There is no jupyterhub_config.py in the specified directory ({directory}). 
             Please specify a directory with a valid jupyterhub_config.py file. 
             """
           )
    #load the config
    config = Config()
    config.merge(PyFileConfigLoader('jupyterhub_config.py', path=directory).load_config())
    try:
        epwrds = config.DictionaryAuthenticator.encrypted_passwords
        if not isinstance(epwrds, dict):
            epwrds = epwrds.to_dict()
    except KeyError as e:
        print('jupyterhub_config.py does not have an entry for c.DictionaryAuthenticator.encrypted_passwords; continuing with empty dict')
        epwrds = {}
    return epwrds
예제 #42
0
 def default_config(self):
     c = Config(
         {
             "NbConvertBase": {
                 "display_data_priority": [
                     "text/latex",
                     "application/pdf",
                     "image/png",
                     "image/jpeg",
                     "image/svg+xml",
                     "text/markdown",
                     "text/plain",
                 ]
             },
             "ExtractOutputPreprocessor": {"enabled": True},
             "SVG2PDFPreprocessor": {"enabled": True},
             "LatexPreprocessor": {"enabled": True},
             "SphinxPreprocessor": {"enabled": True},
             "HighlightMagicsPreprocessor": {"enabled": True},
         }
     )
     c.merge(super(LatexExporter, self).default_config)
     return c
예제 #43
0
파일: latex.py 프로젝트: Carreau/nbconvert
 def default_config(self):
     c = Config({
         'NbConvertBase': {
             'display_data_priority' : ['text/latex', 'application/pdf', 'image/png', 'image/jpeg', 'image/svg+xml', 'text/markdown', 'text/plain']
             },
          'ExtractOutputPreprocessor': {
                 'enabled':True
              },
          'SVG2PDFPreprocessor': {
                 'enabled':True
              },
          'LatexPreprocessor': {
                 'enabled':True
              },
          'SphinxPreprocessor': {
                 'enabled':True
              },
          'HighlightMagicsPreprocessor': {
                 'enabled':True
              }
      })
     c.merge(super(LatexExporter,self).default_config)
     return c
예제 #44
0
파일: markdown.py 프로젝트: 3kwa/nbconvert
 def default_config(self):
     c = Config({'ExtractOutputPreprocessor':{'enabled':True}})
     c.merge(super(MarkdownExporter,self).default_config)
     return c