JUPYTER-NBCONVERT(1)

πŸ’– jupyter-nbconvert β€” the manual page, but make it cute πŸ’–

okay bestie, so jupyter-nbconvert is a User Command, and here's the whole tea: it converts notebook files (*.ipynb) into basically any other format you could want. that's the whole vibe. πŸ¦‹


✨ DESCRIPTION ✨

⚠️ WARNING: THE COMMANDLINE INTERFACE MAY CHANGE IN FUTURE RELEASES. not me telling you to be careful, but like… be careful. 🫢

so here's the thing: all those arguments that take a value? they're actually just ✨convenience aliases✨ for the full Configurables. the aliases are listed on the help line. if you wanna meet the real full configurables, run '--help-all'. it's giving behind-the-scenes lore. πŸ‘‘


πŸŽ€ the options, bestie πŸŽ€

  • -y β€” answer yes to every question instead of getting prompted. no cap, it just says yes to everything. πŸ’…
  • --execute β€” run the notebook before exporting it. (execution first, export second, main character energy.)
  • --allow-errors β€” keep executing the notebook even if a cell throws an error, and shove that error message into the cell output. the default behaviour is to abort the conversion β€” so this flag is literally only relevant if '--execute' was specified too. 🫢
  • --stdout β€” write the notebook output to stdout instead of to files. stream it, don't file it.
  • --debug β€” set log level to logging.DEBUG (maximize logging output). it's giving verbose.
  • --inplace β€” run nbconvert in place, overwriting the existing notebook. ⚠️ only relevant when converting to notebook format β€” so don't be out here overwriting things for no reason. 😭
  • --generate-config β€” generate the default config file. so iconic of it.
  • --reveal-prefix=<Unicode> (RevealHelpPreprocessor.url_prefix) β€” the URL prefix for reveal.js. this can be a relative URL pointing at a local copy of reveal.js, or it can point at a CDN. heads up though: for speaker notes to work, a local reveal.js prefix must be used. (default: 'reveal.js')
  • --nbformat=<Enum> (NotebookExporter.nbformat_version) β€” the nbformat version to write. use this to downgrade notebooks. Choices: [1, 2, 3, 4] (with default 4)
  • --writer=<DottedObjectName> (NbConvertApp.writer_class) β€” the Writer class used to write the results of the conversion (default: 'FilesWriter')
  • --log-level=<Enum> (Application.log_level) β€” set the log level by value or by name. Choices: (0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL') (default: 30)
  • --to=<CaselessStrEnum> (NbConvertApp.export_format) β€” the export format to be used. Choices: ['custom', 'html', 'latex', 'markdown', 'notebook', 'pdf', 'python', 'rst', 'script', 'slides'] (default: 'html')
  • --template=<Unicode> (TemplateExporter.template_file) β€” name of the template file to use (default: u'')
  • --output=<Unicode> (NbConvertApp.output_base) β€” overwrite the base name used for output files. ⚠️ can only be used when converting one notebook at a time (default: '').
  • --post=<DottedOrNone> (NbConvertApp.postprocessor_class) β€” the PostProcessor class used to write the results of the conversion (default u'')
  • --config=<Unicode> (JupyterApp.config_file) β€” full path of a config file (default: u'').

and to see all available configurables, just use --help-all. it's the whole extended universe, iykyk. 🌈


🌸 EXAMPLES 🌸

the simplest way to use nbconvert is literally this:

jupyter nbconvert mynotebook.ipynb

which converts mynotebook.ipynb to the default format (probably HTML). easy, ate, no crumbs. ✨

you can specify the export format with --to. options include ['custom', 'html', 'latex', 'markdown', 'notebook', 'pdf', 'python', 'rst', 'script', 'slides']

jupyter nbconvert --to latex mynotebook.ipynb

both HTML and LaTeX support multiple output templates. LaTeX includes 'base', 'article' and 'report'. HTML includes 'basic' and 'full'. you can specify the flavor of the format used. 🧚

jupyter nbconvert --to html --template basic mynotebook.ipynb

you can also pipe the output to stdout, rather than a file:

jupyter nbconvert mynotebook.ipynb --stdout

PDF is generated via latex:

jupyter nbconvert mynotebook.ipynb --to pdf

you can get (and serve) a Reveal.js-powered slideshow:

jupyter nbconvert myslides.ipynb --to slides --post serve

multiple notebooks can be given at the command line in a couple of different ways:

jupyter nbconvert notebook*.ipynb
jupyter nbconvert notebook1.ipynb notebook2.ipynb

or you can specify the notebooks list in a config file, containing::

c.NbConvertApp.notebooks = ["my_notebook.ipynb"]
jupyter nbconvert --config mycfg.py

okay that's the whole page, bestie πŸ’œ this was jupyter-nbconvert, version 4.0.0, dated October 2015 β€” yeah, she's a vintage queen πŸ‘‘βœ¨ go convert something cute, mwah! πŸŽ€πŸ’–