[PYTHON] I want to blog with Jupyter Notebook

I think that many people write blogs with Markdown, but I think that there are times when you want to post a notebook created with Jupyter Notebook to the blog as it is.

Let's do this with the static site generator Pelican and its plugin pelican-ipynb.

Installation

I think it is better to create an environment on virtualenv.

$ pip install jupyter
$ pip install pytz
$ pip install Markdown pelican

Creating a project

This time, create a directory called my_project for testing.

$ mkdir my_project
$ cd my_project/
$ pelican-quickstart

For quickstart, I referred to here. Please replace the title, author, and other settings with your own.

> Where do you want to create your new web site? [.] 
> What will be the title of this web site? my project
> Who will be the author of this web site? patraqushe
> What will be the default language of this web site? [en] ja
> Do you want to specify a URL prefix? e.g., http://example.com   (Y/n) n
> Do you want to enable article pagination? (Y/n) n
> What is your time zone? [Europe/Paris] Asia/Tokyo
> Do you want to generate a Fabfile/Makefile to automate generation and publishing? (Y/n) y
> Do you want an auto-reload & simpleHTTP script to assist with theme and site development? (Y/n) y
> Do you want to upload your website using FTP? (y/N) n
> Do you want to upload your website using SSH? (y/N) n
> Do you want to upload your website using Dropbox? (y/N) n
> Do you want to upload your website using S3? (y/N) n
> Do you want to upload your website using Rackspace Cloud Files? (y/N) n
> Do you want to upload your website using GitHub Pages? (y/N) n
Done. Your new project is available at /home/driller/pelican/my_project

Install pelican-ipynb

In the my_project directory

$ mkdir plugins
$ git clone https://github.com/danielfrg/pelican-ipynb.git plugins/ipynb
$ vi pelicanconf.py

Add the following to pelicanconf.py

MARKUP = ('md', 'ipynb')

PLUGIN_PATH = './plugins'
PLUGINS = ['ipynb']

Place the created notebook

This time, prepare a directory for .ipynb files in the content directory. It can be directly under the content directory.

In the my_project directory

$ cd content/
$ mkdir notebook

Place the .ipynb file created by jupyter notebook in the my_project / content / notebook directory. Then create a file called -meta. This time, I prepared it with the file name test01.ipynb.

$ cd notebook/
$ ls
test01.ipynb
$ vi test01.ipynb-meta

Contents of test01.ipynb-meta

Title: notebook test
Slug: test01
Date: 2015-12-18 0:00
Category: Pelican
Tags: Python, Pelican, Jupyter
Author: patraqushe
Summary: jupyter notebook article

Site build / confirmation

Go back to the my_project directory, build your site with make html, and start the server with make serve.

$ ls
test01.ipynb  test01.ipynb-meta
$ cd ../..
$ make html
$ make serve

If you access http: // localhost: 8000 with a browser, you will see a screen like this.

pelican-ipynb.PNG

After that, change the theme and settings in various ways and adjust them to your liking.

Recommended Posts

I want to blog with Jupyter Notebook
I want to use a virtual environment with jupyter notebook!
I want to do ○○ with Pandas
I want to debug with Python
I want to use R functions easily with ipython notebook
I want to make a blog editor with django admin
I want to start a jupyter environment with one command
I want to pip install with PythonAnywhere
I want to analyze logs with Python
I want to play with aws with python
How to use jupyter notebook with ABCI
I wanted to create a smart presentation with Jupyter Notebook + nbpresent
How to debug with Jupyter or iPython Notebook
I want to use MATLAB feval with python
I want to analyze songs with Spotify API 2
I want to mock datetime.datetime.now () even with pytest!
I want to display multiple images with matplotlib.
I want to knock 100 data sciences with Colaboratory
I want to make a game with Python
I want to be an OREMO with setParam!
I want to analyze songs with Spotify API 1
I want to use Temporary Directory with Python2
I don't want to use -inf with np.log
#Unresolved I want to compile gobject-introspection with Python3
I want to use ip vrf with SONiC
I want to solve APG4b with Python (Chapter 2)
I want to start over with Django's Migrate
I tried to start Jupyter with Amazon lightsail
I want to write to a file with Python
I wanted to use jupyter notebook with docker in pip environment (opticspy)
I want to display an image on Jupyter Notebook using OpenCV (mac)
I want to convert an image to WebP with lollipop
I want to detect unauthorized login to facebook with Jubatus (1)
Using Graphviz with Jupyter Notebook
I want to transition with a button in flask
I want to handle optimization with python and cplex
Use pip with Jupyter Notebook
I want to climb a mountain with reinforcement learning
I want to solve Sudoku (Sudoku)
Use Cython with Jupyter Notebook
I want to inherit to the back with python dataclass
Play with Jupyter Notebook (IPython Notebook)
I want to work with a robot in python.
I want to split a character string with hiragana
I want to AWS Lambda with Python on Mac!
I want to manually create a legend with matplotlib
[TensorFlow] I want to process windows with Ragged Tensor
[ML Ops] I want to do multi-project with Python
I tried to touch jupyter
How to use Jupyter Notebook
I want to run a quantum computer with Python
Library for "I want to do that" of data science on Jupyter Notebook
I want to bind a local variable with lambda
I want to plot the location information of GTFS Realtime on Jupyter! (With balloon)
I want to remove Python's Unresolved Import Warning with vsCode
I want to specify another version of Python with pyvenv
I want to be able to analyze data with Python (Part 1)
[NetworkX] I want to search for nodes with specific attributes
I want to make a click macro with pyautogui (desire)
I want to change the Japanese flag to the Palau flag with Numpy
I want to be able to analyze data with Python (Part 4)