pelican-jupyter-reader 0.3.1

Last updated:

0 purchases

pelican-jupyter-reader 0.3.1 Image
pelican-jupyter-reader 0.3.1 Images
Add to Cart

Description:

pelicanjupyterreader 0.3.1

pelican-jupyter-reader: A Plugin for Pelican


This Pelican plugin provides a Jupyter Notebook (i.e. *.ipynb) reader.
The plugin intends to allow users to simply drop Jupyter notebooks in their
Pelican content directory and have the notebooks rendered (beautifully) in a Pelican
static website.
Installation
This plugin can be installed via:
pip install pelican-jupyter-reader

Quickstart

Add the plugin to pelicanconf.py:

# ...

from pelican.plugins import pelican_jupyter_reader
PLUGINS = [pelican_jupyter_reader]

# ...


Provide Pelican post
metadata as
a top-level object with key pelican in the Jupyter notebook metadata:

{
"pelican": {
"date": "2020-04-10",
"title": "this is a title",
"tags": "thats, awesome",
"category": "yeah",
"slug": "my-super-post",
"authors": "Alexis Metaireau, Conan Doyle",
"summary": "Short version for index and feeds"
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
//...the rest of the notebook JSON follows.


Drop your Jupyter notebook in the Pelican content directory, build your site,
and deploy! :rocket:

Example
The demo/
directory has a simple post with corresponding configuration in
pelicanconf.py. The demo site is deployed
here.
Notes
The Jupyter nbconvert configuration for
preprocessors
and the
HTMLExporter
are exposed in your Pelican config, pelicanconf.py. This
means you can manipulate notebooks with utilities provided by nbconvert.
For example, to use the basic template for the HTMLExporter, you could add
the following to your pelicanconf.py:
from traitlets.config import Config
NBCONVERT_CONFIG = Config()
NBCONVERT_CONFIG.HTMLExporter.template = 'basic'

To strip empty cells from the notebook before publishing, you might add this
option to pelicanconf.py:
# ...
NBCONVERT_CONFIG.RegexRemovePreprocessor.patterns = ['\\s*\\Z']

Other nbconvert configuration options can be found
here.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.