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
 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
 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
 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
 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
 def default_config(self):
     c = Config({'ExtractOutputPreprocessor':{'enabled':True}})
     c.merge(super(MarkdownExporter,self).default_config)
     return c