[PYTHON] Easily convert Jupyter Notebooks to blogs with fastpages

A blogging tool called fastpages has been released by fastai, which is famous for free online courses of deep learning, so I tried using it immediately.

Some people may find the initial settings a little troublesome, so I have summarized the procedure in Japanese. If you're happy with the English explanation, see the official readme.

Target audience

--People who want to know an easy way to convert jupyter notebook to blog --People who can publish their blog on github pages

Caution

The content of the article is as of February 29, 2020.

In the future, the fastpages installation procedure may become easier. In the comment section, @peaceiris pointed out.

When you try the contents of this article, please check the text of the pull request just in case.

Features of fastpages

fastpages is a tool for automatically generating blogs published on github pages from Jupyter notebook. Github actions are used for automatic generation, which saves you the trouble of building a website from your notebook on your own PC.

According to the Official description, it has the following features:

--When you push the article changes to the master branch of github, a blog is automatically generated. --You can post Jupyter Notebook as an article as it is. --You can show / hide cells in Jupyter Notebook. -Embed images, Twitter cards, youtube videos

Initial settings for using fastpages

First, copy the template from the official repository and use it. Once you've set up your ssh key and merged the pull requests from your bot, your blog is complete. After that, every time I post or edit an article, I will push it to the master branch.

Create a new repository from a template

fastai/fastpages: An easy to use blogging platform, with enhanced support for Jupyter Notebooks. - Gyazo

First, create a new repository using the fastpages repository template. In the fastpages repository, click "Use this template".

Create a repository with a suitable name.

Create a New Repository from fastai/fastpages - Gyazo

If you wait about 1 minute after creating the repository, you will automatically receive a pull request to the repository. Follow the instructions in this pull request to proceed with the settings.

Pull Requests ยท yuki-data/fastpages-sample - Gyazo

Register private key and public key

The instructions for the pull request are as follows.

--Create ssh key-pair. Register the public key and private key generated here in the next step. --Register the private key with the name SSH_DEPLOY_KEY in the setting item called Secrets of the repository. --Register the public key in the setting item called Deploy keys in the repository.

Once you've done this, every time you push your changes to the master branch, your website will be built.

Specifically, do the following:

According to the instructions given in the pull request, I'm advised to use a tool called 8gwifi, but it's okay to create it yourself. 8gwifi is an ssh-key pair generation tool that can be used online for free.

Since it says Select: RSA and 4096 and leave Passphrase blank,

ssh-keygen -t rsa -b 4096

Generate a private key and a public key with.

$ ls /Users/your_name/.ssh/ | grep id_rsa
id_rsa
id_rsa.pub

Copy and paste the private key (id_rsa) and public key (id_rsa.pub) in the setting items of github, respectively.

Enter the NAME SSH_DEPLOY_KEY exactly as it is.

Secrets - Gyazo

You may decide the title of the public key appropriately. Check ** Allow write access **.

Add deploy key - Gyazo

That's it.

After merging the pull requests and waiting a few minutes, you can access the default website on github pages

After registering the ssh key-pair, finally merge the pull request.

You can now visit the website by visiting the url on github pages.

You can check the series of steps up to this point on youtube videos.

How to create your Free Data Science Blog on Github with Fastpages from Fastai - YouTube

Recommended Posts

Easily convert Jupyter Notebooks to blogs with fastpages
Convert 202003 to 2020-03 with pandas
Convert jupyter to py
Convert .ipynb to .html (with BatchFile)
Convert list to DataFrame with python
Convert sentences to vectors with gensim
Convert PDF to image with ImageMagick
Easily post to twitter with Python 3
Convert memo at once with Python 2to3
How to easily convert format from Markdown
Convert from PDF to CSV with pdfplumber
I want to blog with Jupyter Notebook
Convert character strings to features with RoBERTa
Convert Excel data to JSON with python
Convert Hiragana to Romaji with Python (Beta)
Convert FX 1-minute data to 5-minute data with Python
To import your own module with jupyter
How to use jupyter notebook with ABCI
Convert PDF files to PNG files with GIMP
Convert array (struct) to json with golang
I made a tool to convert Jupyter py to ipynb with VS Code
Convert HEIC files to PNG files with Python
Convert Chinese numerals to Arabic numerals with Python
Sample to convert image to Wavelet with Python
Convert DICOM to PNG with Ascending and Descending
Convert data with shape (number of data, 1) to (number of data,) with numpy.
Convert mp4 to mp3 with ffmpeg (thumbnail embedded version)
Convert svg file to png / ico with Python
Convert Windows epoch values to date with python
Easily log in to AWS with multiple accounts
Easily connect Xillybus to user logic with cReComp
How to convert (32,32,3) to 4D tensor (1,32,32,1) with ndarray type
Add / remove kernel to use jupyter with venv
I tried to start Jupyter with Amazon lightsail
[Small story] Easy way to convert Jupyter to PDF
Convert strings to character-by-character list format with python
Convert to HSV
Convert jupyter notebook .ipynb files to python executable .py files
I want to convert an image to WebP with lollipop
How to convert / restore a string with [] in python
How to convert horizontally held data to vertically held data with pandas
How to convert a class object to a dictionary with SQLAlchemy
Convert the image in .zip to PDF with Python
An easy way to create an import module with jupyter
Import specific cells from other notebooks with Jupyter notebook
How to convert JSON file to CSV file with Python Pandas
PyInstaller memorandum Convert Python [.py] to [.exe] with 2 lines
Convert multiple Jupyter notebooks together into an html file
Convert numeric variables to categorical with thresholds in pandas