Blog from jupyter notebook
how to setup fastpages to blog from jupyter notebook
- get local repo from github
- create a blog entry with Jupyter Notebook
- commit and push to github
- check entries into blog
- Move to another repo
- Get local repo
That will be great if I can simply write blog entries using Jupyter Notebook.
I usually paste inner images into jupyter cells. But this feature is not available yet into fastpages. So for the moment I won't include images into these posts.
That way I could simply use markdown and insert images
And directly see rendered impact before commiting and pushing to my blog.
As I am behind a proxy most of my time when working from office, the easiest way for me is to work from WSL.
I won't detail how to install WSL on Windows.
I use ubuntu images (18.04) on my PC.
I have just added some bash commands at the end of my .bashrc
file.
# Set Proxy
function setproxy() {
export {http,https,ftp}_proxy="http://<my proxy ip address>:80"
export {HTTP,HTTPS,FTP}_PROXY="http://<my proxy ip address>:80"
}
# Unset Proxy
function unsetproxy() {
unset {http,https,ftp}_proxy
unset {HTTP,HTTPS,FTP}_PROXY
}
I keep most of my local repos under ~/git/
cd ~/git
setproxy
git clone https://github.com/castorfou/castorfou.github.io.git
(base) guillaume@LL11LPC0PQARQ:~$ cd git
(base) guillaume@LL11LPC0PQARQ:~/git$ cd castorfou.github.io/
(base) guillaume@LL11LPC0PQARQ:~/git/castorfou.github.io$ git add .
(base) guillaume@LL11LPC0PQARQ:~/git/castorfou.github.io$ git commit -m 'new blog entry: blog from jupyter'
[master 6b7460a] new blog entry: blog from jupyter
4 files changed, 516 insertions(+)
create mode 100644 _posts/.ipynb_checkpoints/2020-09-10-blog-from-jupyter-checkpoint.ipynb
create mode 100644 _posts/2020-09-10-blog-from-jupyter.ipynb
create mode 100644 _posts/2020-09-10-blog-from-jupyter.py
create mode 100644 _posts/Untitled.txt
(base) guillaume@LL11LPC0PQARQ:~/git/castorfou.github.io$ git push
fatal: unable to access 'https://github.com/castorfou/castorfou.github.io.git/': gnutls_handshake() failed: The TLS connection was non-properly terminated.
Just googling this error gives some insight: https://github.community/t/unable-to-push-to-repo-gnutls-handshake-failed/885
It is likely some local firewell issue.
(base) guillaume@LL11LPC0PQARQ:~/git/castorfou.github.io$ unsetproxy
(base) guillaume@LL11LPC0PQARQ:~/git/castorfou.github.io$ git push
Username for 'https://github.com': castorfou
Password for 'https://castorfou@github.com':
Counting objects: 7, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (7/7), 141.26 KiB | 10.09 MiB/s, done.
Total 7 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
remote:
remote: GitHub found 3 vulnerabilities on castorfou/castorfou.github.io's default branch (2 high, 1 moderate). To find out more, visit:
remote: https://github.com/castorfou/castorfou.github.io/network/alerts
remote:
To https://github.com/castorfou/castorfou.github.io.git
6adeb02..6b7460a master -> master
Double entries: one for the notebook (.ipynb) and one for the auto python export (.py). I will have to update my jupyter settings to avoid this python file creation. In the meantime I can just delete the python file, and commit.
.gitignore
to avoid these double entries
Clicking just ask me to download the notebook, it doesn't display it into the browser.
Just by looking into .gitignore
, there is an interesting entry:
*.swp
~*
*~
_site
.sass-cache
.jekyll-cache
.jekyll-metadata
vendor
_notebooks/.ipynb_checkpoints
Wait what is in this last line.
Let's create _notebooks
directory and move my notebook in that directory.
No entries, I guess there is some additional settings to do...
There is no problem with that.
Creating a local md file in _posts
then pushing to github is creating the right entry blog.
troubleshooting guide
following fastpagesTry the automated upgrade as described in https://github.com/fastai/fastpages/blob/master/_fastpages_docs/UPGRADE.md
Unfortunately I don't see
I have to follow the manual upgrade.
I am surprised because the 1st step from manual upgrade is to copy the fastpages repo. It is what I did 2 days ago. I doubt having an outdated version of fastpages.
fastpages category
fastai forum:I will browse through nbdev & faspages category in fastai forums. I should see people with the same issue.
I have created an entry, into fastai forums: Fastpages - cannot see build process of GitHub Actions
And quite immediately Hamel Hussain answered guiding to the write direction:
I misread the Settings instruction: my github repo should explicitely NOT include my github username and I did exactly the opposite.
And another surprising subject: at github in Actions tab. I have a kind of default page. I expect something like an execution journal of Actions.
The page build failed for the master
branch with the following error:
Page build failed. For more information, see https://docs.github.com/github/working-with-github-pages/troubleshooting-jekyll-build-errors-for-github-pages-sites#troubleshooting-build-errors.
For information on troubleshooting Jekyll see:
https://docs.github.com/articles/troubleshooting-jekyll-builds
If you have any questions you can submit a request on the Contact GitHub page at https://support.github.com/contact?repo_id=293820308&page_build_id=202240535
It was just a matter of creating a new repo:
Monitoring is effective
Following the steps:
- Create keys using ssh utility
- Enter Secret Key
- Enter Deploy Key
There are conflicts to be fixed before that.
https://castorfou.github.io/guillaume_blog/
And it works:cd ~/git
unsetproxy
git clone https://github.com/castorfou/guillaume_blog.git