Path: blob/master/nbconvert_config.py
409 views
from pathlib import Path1import os23# Configuration file for jupyter-nbconvert.45#------------------------------------------------------------------------------6# Application(SingletonConfigurable) configuration7#------------------------------------------------------------------------------89## This is an application.1011## The date format used by logging formatters for %(asctime)s12#c.Application.log_datefmt = '%Y-%m-%d %H:%M:%S'1314## The Logging format template15#c.Application.log_format = '[%(name)s]%(highlevel)s %(message)s'1617## Set the log level by value or name.18#c.Application.log_level = 301920#------------------------------------------------------------------------------21# JupyterApp(Application) configuration22#------------------------------------------------------------------------------2324## Base class for Jupyter applications2526## Answer yes to any prompts.27#c.JupyterApp.answer_yes = False2829## Full path of a config file.30#c.JupyterApp.config_file = ''3132## Specify a config file to load.33#c.JupyterApp.config_file_name = ''3435## Generate default config file.36#c.JupyterApp.generate_config = False3738#------------------------------------------------------------------------------39# NbConvertApp(JupyterApp) configuration40#------------------------------------------------------------------------------4142## This application is used to convert notebook files (*.ipynb) to various other43# formats.44#45# WARNING: THE COMMANDLINE INTERFACE MAY CHANGE IN FUTURE RELEASES.4647## The export format to be used, either one of the built-in formats, or a dotted48# object name that represents the import path for an `Exporter` class49#c.NbConvertApp.export_format = 'html'5051## read a single notebook from stdin.52#c.NbConvertApp.from_stdin = False5354## List of notebooks to convert. Wildcards are supported. Filenames passed55# positionally will be added to the list.56c.NbConvertApp.notebooks = ['notebooks/*.ipynb']5758## overwrite base name use for output files. can only be used when converting one59# notebook at a time.60# c.NbConvertApp.output_base = ''6162## Directory to copy extra files (figures) to. '{notebook_name}' in the string63# will be converted to notebook basename64#c.NbConvertApp.output_files_dir = '{notebook_name}_files'6566## PostProcessor class used to write the results of the conversion67#c.NbConvertApp.postprocessor_class = ''6869## Whether to apply a suffix prior to the extension (only relevant when70# converting to notebook format). The suffix is determined by the exporter, and71# is usually '.nbconvert'.72#c.NbConvertApp.use_output_suffix = True7374## Writer class used to write the results of the conversion75#c.NbConvertApp.writer_class = 'FilesWriter'7677#------------------------------------------------------------------------------78# NbConvertBase(LoggingConfigurable) configuration79#------------------------------------------------------------------------------8081## Global configurable class for shared config82#83# Useful for display data priority that might be used by many transformers8485## Deprecated default highlight language as of 5.0, please use language_info86# metadata instead87#c.NbConvertBase.default_language = 'ipython'8889## An ordered list of preferred output type, the first encountered will usually90# be used when converting discarding the others.91#c.NbConvertBase.display_data_priority = ['text/html', 'application/pdf', 'text/latex', 'image/svg+xml', 'image/png', 'image/jpeg',92# 'text/markdown', 'text/plain']9394#------------------------------------------------------------------------------95# Exporter(LoggingConfigurable) configuration96#------------------------------------------------------------------------------9798# Class containing methods that sequentially run a list of preprocessors on a99# NotebookNode object and then return the modified NotebookNode object and100# accompanying resources dict.101102103# List of preprocessors available by default, by name, namespace, instance,104# or type.105c.Exporter.default_preprocessors = ['nbconvert.preprocessors.ExecutePreprocessor',106'nbconvert.preprocessors.coalesce_streams',107'nbconvert.preprocessors.SVG2PDFPreprocessor',108'nbconvert.preprocessors.CSSHTMLHeaderPreprocessor',109'nbconvert.preprocessors.LatexPreprocessor',110'nbconvert.preprocessors.HighlightMagicsPreprocessor',111'nbconvert.preprocessors.ExtractOutputPreprocessor']112113## Extension of the file that should be written to disk114#c.Exporter.file_extension = '.txt'115116## List of preprocessors, by name or namespace, to enable.117#c.Exporter.preprocessors = []118119#------------------------------------------------------------------------------120# TemplateExporter(Exporter) configuration121#------------------------------------------------------------------------------122123## Exports notebooks into other file formats. Uses Jinja 2 templating engine to124# output new formats. Inherit from this class if you are creating a new125# template type along with new filters/preprocessors. If the filters/126# preprocessors provided by default suffice, there is no need to inherit from127# this class. Instead, override the template_file and file_extension traits via128# a config file.129#130# Filters available by default for templates:131#132# - add_anchor - add_prompts - ansi2html - ansi2latex - ascii_only -133# citation2latex - comment_lines - convert_pandoc - escape_latex -134# filter_data_type - get_lines - get_metadata - highlight2html - highlight2latex135# - html2text - indent - ipython2python - json_dumps - markdown2asciidoc -136# markdown2html - markdown2latex - markdown2rst - path2url - posix_path -137# prevent_list_blocks - strip_ansi - strip_dollars - strip_files_prefix -138# wrap_text139140## Dictionary of filters, by name and namespace, to add to the Jinja environment.141#c.TemplateExporter.filters = {}142143## formats of raw cells to be included in this Exporter's output.144#c.TemplateExporter.raw_mimetypes = []145146##147#c.TemplateExporter.template_extension = '.tpl'148149## Name of the template file to use150#c.TemplateExporter.template_file = ''151152##153#c.TemplateExporter.template_path = ['.']154155#------------------------------------------------------------------------------156# ASCIIDocExporter(TemplateExporter) configuration157#------------------------------------------------------------------------------158159## Exports to an ASCIIDoc document (.asciidoc)160161#------------------------------------------------------------------------------162# HTMLExporter(TemplateExporter) configuration163#------------------------------------------------------------------------------164165## Exports a basic HTML document. This exporter assists with the export of HTML.166# Inherit from it if you are writing your own HTML template and need custom167# preprocessors/filters. If you don't need custom preprocessors/ filters, just168# change the 'template_file' config option.169170#------------------------------------------------------------------------------171# LatexExporter(TemplateExporter) configuration172#------------------------------------------------------------------------------173174## Exports to a Latex template. Inherit from this class if your template is175# LaTeX based and you need custom tranformers/filters. Inherit from it if you176# are writing your own HTML template and need custom tranformers/filters. If177# you don't need custom tranformers/filters, just change the 'template_file'178# config option. Place your template in the special "/latex" subfolder of the179# "../templates" folder.180181##182#c.LatexExporter.template_extension = '.tplx'183184#------------------------------------------------------------------------------185# MarkdownExporter(TemplateExporter) configuration186#------------------------------------------------------------------------------187188## Exports to a markdown document (.md)189190#------------------------------------------------------------------------------191# NotebookExporter(Exporter) configuration192#------------------------------------------------------------------------------193194## Exports to an IPython notebook.195#196# This is useful when you want to use nbconvert's preprocessors to operate on a197# notebook (e.g. to execute it) and then write it back to a notebook file.198199## The nbformat version to write. Use this to downgrade notebooks.200#c.NotebookExporter.nbformat_version = 4201202#------------------------------------------------------------------------------203# PDFExporter(LatexExporter) configuration204#------------------------------------------------------------------------------205206## Writer designed to write to PDF files.207#208# This inherits from :class:`LatexExporter`. It creates a LaTeX file in a209# temporary directory using the template machinery, and then runs LaTeX to210# create a pdf.211212## Shell command used to run bibtex.213#c.PDFExporter.bib_command = ['bibtex', '{filename}']214215## Shell command used to compile latex.216#c.PDFExporter.latex_command = ['xelatex', '{filename}']217218## How many times latex will be called.219#c.PDFExporter.latex_count = 3220221## File extensions of temp files to remove after running.222#c.PDFExporter.temp_file_exts = ['.aux', '.bbl', '.blg', '.idx', '.log', '.out']223224## Whether to display the output of latex commands.225#c.PDFExporter.verbose = False226227#------------------------------------------------------------------------------228# PythonExporter(TemplateExporter) configuration229#------------------------------------------------------------------------------230231## Exports a Python code file.232233#------------------------------------------------------------------------------234# RSTExporter(TemplateExporter) configuration235#------------------------------------------------------------------------------236237## Exports reStructuredText documents.238239#------------------------------------------------------------------------------240# ScriptExporter(TemplateExporter) configuration241#------------------------------------------------------------------------------242243#------------------------------------------------------------------------------244# SlidesExporter(HTMLExporter) configuration245#------------------------------------------------------------------------------246247## Exports HTML slides with reveal.js248249## The URL prefix for reveal.js. This can be a a relative URL for a local copy of250# reveal.js, or point to a CDN.251#252# For speaker notes to work, a local reveal.js prefix must be used.253#c.SlidesExporter.reveal_url_prefix = ''254255#------------------------------------------------------------------------------256# Preprocessor(NbConvertBase) configuration257#------------------------------------------------------------------------------258259## A configurable preprocessor260#261# Inherit from this class if you wish to have configurability for your262# preprocessor.263#264# Any configurable traitlets this class exposed will be configurable in profiles265# using c.SubClassName.attribute = value266#267# you can overwrite :meth:`preprocess_cell` to apply a transformation268# independently on each cell or :meth:`preprocess` if you prefer your own logic.269# See corresponding docstring for informations.270#271# Disabled by default and can be enabled via the config by272# 'c.YourPreprocessorName.enabled = True'273274##275#c.Preprocessor.enabled = False276277#------------------------------------------------------------------------------278# CSSHTMLHeaderPreprocessor(Preprocessor) configuration279#------------------------------------------------------------------------------280281## Preprocessor used to pre-process notebook for HTML output. Adds IPython282# notebook front-end CSS and Pygments CSS to HTML output.283284## CSS highlight class identifier285#c.CSSHTMLHeaderPreprocessor.highlight_class = '.highlight'286287#------------------------------------------------------------------------------288# ClearOutputPreprocessor(Preprocessor) configuration289#------------------------------------------------------------------------------290291## Removes the output from all code cells in a notebook.292293#------------------------------------------------------------------------------294# ConvertFiguresPreprocessor(Preprocessor) configuration295#------------------------------------------------------------------------------296297## Converts all of the outputs in a notebook from one format to another.298299## Format the converter accepts300#c.ConvertFiguresPreprocessor.from_format = ''301302## Format the converter writes303#c.ConvertFiguresPreprocessor.to_format = ''304305#------------------------------------------------------------------------------306# ExecutePreprocessor(Preprocessor) configuration307#------------------------------------------------------------------------------308309## Executes all the cells in a notebook310311## If `False` (default), when a cell raises an error the execution is stopped and312# a `CellExecutionError` is raised. If `True`, execution errors are ignored and313# the execution is continued until the end of the notebook. Output from314# exceptions is included in the cell output in both cases.315#c.ExecutePreprocessor.allow_errors = False316317## If execution of a cell times out, interrupt the kernel and continue executing318# other cells rather than throwing an error and stopping.319#c.ExecutePreprocessor.interrupt_on_timeout = False320321## The time to wait (in seconds) for IOPub output. This generally doesn't need to322# be set, but on some slow networks (such as CI systems) the default timeout323# might not be long enough to get all messages.324#c.ExecutePreprocessor.iopub_timeout = 4325326## The kernel manager class to use.327#c.ExecutePreprocessor.kernel_manager_class = 'jupyter_client.manager.KernelManager'328329## Name of kernel to use to execute the cells. If not set, use the kernel_spec330# embedded in the notebook.331c.ExecutePreprocessor.kernel_name = 'bayesian'332333## If `False` (default), then the kernel will continue waiting for iopub messages334# until it receives a kernel idle message, or until a timeout occurs, at which335# point the currently executing cell will be skipped. If `True`, then an error336# will be raised after the first timeout. This option generally does not need to337# be used, but may be useful in contexts where there is the possibility of338# executing notebooks with memory-consuming infinite loops.339#c.ExecutePreprocessor.raise_on_iopub_timeout = False340341## If `graceful` (default), then the kernel is given time to clean up after342# executing all cells, e.g., to execute its `atexit` hooks. If `immediate`, then343# the kernel is signaled to immediately terminate.344#c.ExecutePreprocessor.shutdown_kernel = 'graceful'345346## The time to wait (in seconds) for output from executions. If a cell execution347# takes longer, an exception (TimeoutError on python 3+, RuntimeError on python348# 2) is raised.349#350# `None` or `-1` will disable the timeout. If `timeout_func` is set, it351# overrides `timeout`.352c.ExecutePreprocessor.timeout = 600353354## A callable which, when given the cell source as input, returns the time to355# wait (in seconds) for output from cell executions. If a cell execution takes356# longer, an exception (TimeoutError on python 3+, RuntimeError on python 2) is357# raised.358#359# Returning `None` or `-1` will disable the timeout for the cell. Not setting360# `timeout_func` will cause the preprocessor to default to using the `timeout`361# trait for all cells. The `timeout_func` trait overrides `timeout` if it is not362# `None`.363#c.ExecutePreprocessor.timeout_func = None364365#------------------------------------------------------------------------------366# ExtractOutputPreprocessor(Preprocessor) configuration367#------------------------------------------------------------------------------368369## Extracts all of the outputs from the notebook file. The extracted outputs370# are returned in the 'resources' dictionary.371372##373#c.ExtractOutputPreprocessor.extract_output_types = {'image/jpeg', 'image/png', 'application/pdf', 'image/svg+xml'}374375##376#c.ExtractOutputPreprocessor.output_filename_template = '{unique_key}_{cell_index}_{index}{extension}'377378#------------------------------------------------------------------------------379# HighlightMagicsPreprocessor(Preprocessor) configuration380#------------------------------------------------------------------------------381382## Detects and tags code cells that use a different languages than Python.383384## Syntax highlighting for magic's extension languages. Each item associates a385# language magic extension such as %%R, with a pygments lexer such as r.386#c.HighlightMagicsPreprocessor.languages = {}387388#------------------------------------------------------------------------------389# LatexPreprocessor(Preprocessor) configuration390#------------------------------------------------------------------------------391392## Preprocessor for latex destined documents.393#394# Mainly populates the `latex` key in the resources dict, adding definitions for395# pygments highlight styles.396397#------------------------------------------------------------------------------398# SVG2PDFPreprocessor(ConvertFiguresPreprocessor) configuration399#------------------------------------------------------------------------------400401## Converts all of the outputs in a notebook from SVG to PDF.402403## The command to use for converting SVG to PDF404#405# This string is a template, which will be formatted with the keys to_filename406# and from_filename.407#408# The conversion call must read the SVG from {from_flename}, and write a PDF to409# {to_filename}.410#c.SVG2PDFPreprocessor.command = ''411412## The path to Inkscape, if necessary413#c.SVG2PDFPreprocessor.inkscape = ''414415#------------------------------------------------------------------------------416# WriterBase(NbConvertBase) configuration417#------------------------------------------------------------------------------418419## Consumes output from nbconvert export...() methods and writes to a useful420# location.421422## List of the files that the notebook references. Files will be included with423# written output.424#c.WriterBase.files = []425426#------------------------------------------------------------------------------427# DebugWriter(WriterBase) configuration428#------------------------------------------------------------------------------429430## Consumes output from nbconvert export...() methods and writes usefull431# debugging information to the stdout. The information includes a list of432# resources that were extracted from the notebook(s) during export.433434#------------------------------------------------------------------------------435# FilesWriter(WriterBase) configuration436#------------------------------------------------------------------------------437438## Consumes nbconvert output and produces files.439440## Directory to write output(s) to. Defaults to output to the directory of each441# notebook. To recover previous default behaviour (outputting to the current442# working directory) use . as the flag value.443c.FilesWriter.build_directory = 'docs'444445## When copying files that the notebook depends on, copy them in relation to this446# path, such that the destination filename will be os.path.relpath(filename,447# relpath). If FilesWriter is operating on a notebook that already exists448# elsewhere on disk, then the default will be the directory containing that449# notebook.450#c.FilesWriter.relpath = ''451452#------------------------------------------------------------------------------453# StdoutWriter(WriterBase) configuration454#------------------------------------------------------------------------------455456## Consumes output from nbconvert export...() methods and writes to the stdout457# stream.458459#------------------------------------------------------------------------------460# PostProcessorBase(NbConvertBase) configuration461#------------------------------------------------------------------------------462463#------------------------------------------------------------------------------464# ServePostProcessor(PostProcessorBase) configuration465#------------------------------------------------------------------------------466467## Post processor designed to serve files468#469# Proxies reveal.js requests to a CDN if no local reveal.js is present470471## The IP address to listen on.472#c.ServePostProcessor.ip = '127.0.0.1'473474## Should the browser be opened automatically?475#c.ServePostProcessor.open_in_browser = True476477## port for the server to listen on.478#c.ServePostProcessor.port = 8000479480## URL for reveal.js CDN.481#c.ServePostProcessor.reveal_cdn = 'https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.1.0'482483## URL prefix for reveal.js484#c.ServePostProcessor.reveal_prefix = 'reveal.js'485486487