Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tonyfast/nbd

bootstrapped notebook documentation
https://github.com/tonyfast/nbd

bootstrap documentation jupyter-notebook notebook

Last synced: 5 days ago
JSON representation

bootstrapped notebook documentation

Awesome Lists containing this project

README

        

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# It's `no big deal`, it just works.\n",
"\n",
"Documentation ∀ files; based on the [`nbformat`](nbformat.readthedocs.io).\n",
"\n",
"#### Install with version control\n",
"\n",
"`pip install git+`https://github.com/tonyfast/nbd/\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Why\n",
"\n",
"* `nbconvert` doesn't accept all file formats. `nbd` adds the concept of loaders\n",
"that transform arbitrary files to the nbformat."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## An Example Configuration"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1. Configure your documentation in python"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"More configuration options are available at [nbconvert.readthedocs.io/en/latest/config_options.html]()"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting demo.py\n"
]
}
],
"source": [
"%%file demo.py\n",
"from nbd import *\n",
"# use nbd's super basic index\n",
"\n",
"from nbd import index\n",
"\n",
"# Store data in a notebook object\n",
"data = notebook(cells=[\n",
" markdown('''# My Demo Page \\n\\nCheck out the complete [`nbd` documentation](../index.html).''')])\n",
"\n",
"def report(): yield 'index', data\n",
" \n",
"c.Docs.notebooks = ['nbd.ipynb', 'readme.md', 'nbd.py']\n",
"c.FilesWriter.build_directory = 'docs/demo'\n",
"c.Docs.post, c.Docs.report = __import__('nbd').index(data), report"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 2. Execute `nbd`"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[Docs] Converting notebook nbd.ipynb to html\r\n",
"[Docs] Writing 280231 bytes to docs/demo/nbd.ipynb.html\r\n",
"[Docs] Converting notebook readme.md to html\r\n",
"[Docs] Writing 257617 bytes to docs/demo/readme.md.html\r\n",
"[Docs] Converting notebook nbd.py to html\r\n",
"[Docs] Writing 275472 bytes to docs/demo/nbd.py.html\r\n",
"[Docs] Converting notebook into html\r\n",
"[Docs] Writing 250170 bytes to docs/demo/index.html\r\n"
]
}
],
"source": [
"!jupyter nbd --config demo.py"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Motivation\n",
"\n",
"* An Ipython backed make configuration system\n",
"* It works for every file"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Developer\n",
"\n",
"Configure the documentation for this project through the readme file."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[NbConvertApp] Converting notebook config.ipynb to python\r\n",
"[NbConvertApp] Writing 1182 bytes to ./config.py\r\n",
"[NbConvertApp] Converting notebook nbd.ipynb to python\r\n",
"[NbConvertApp] Writing 5966 bytes to ./nbd.py\r\n",
"parsing nbd.py...\r\n",
"[NbConvertApp] Converting notebook readme.ipynb to markdown\r\n",
"[NbConvertApp] Writing 2721 bytes to readme.md\r\n",
"[Docs] Converting notebook nbd.ipynb to html\r\n",
"[Docs] Writing 280231 bytes to docs/nbd.ipynb.html\r\n",
"[Docs] Converting notebook config.ipynb to html\r\n",
"[Docs] Writing 256375 bytes to docs/config.ipynb.html\r\n",
"[Docs] Converting notebook config.py to html\r\n",
"[Docs] Writing 254329 bytes to docs/config.py.html\r\n",
"[Docs] Converting notebook template.ipynb to html\r\n",
"[Docs] Writing 250263 bytes to docs/template.ipynb.html\r\n",
"[Docs] Converting notebook readme.md to html\r\n",
"[Docs] Writing 257146 bytes to docs/readme.md.html\r\n",
"[Docs] Converting notebook flake8.txt to html\r\n",
"[Docs] Writing 271255 bytes to docs/flake8.txt.html\r\n",
"[Docs] Converting notebook into html\r\n",
"[Docs] Writing 252550 bytes to docs/index.html\r\n",
"[Docs] Converting notebook into html\r\n",
"[Docs] Writing 249380 bytes to docs/uml.html\r\n"
]
}
],
"source": [
"!jupyter nbconvert --to python config.ipynb nbd.ipynb --output-dir .\n",
"!flake8 nbd.py --output-file=flake8.txt\n",
"!pyreverse -o png -p nbd nbd.py\n",
"!jupyter nbconvert --to markdown readme.ipynb\n",
"!jupyter nbd --config config.py\n",
"!mv classes_nbd.png config.py flake8.txt docs\n",
"# !wget https://bootswatch.com/readable/bootstrap.min.css --no-check-certificate\n",
"# !mv bootstrap.min.css docs/custom.css"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Views\n",
"### HTML Views\n",
"\n",
"* [Raw Git](https://rawgit.com/tonyfast/nbd/master/docs/index.html)\n",
"* [Github Pages](https://tonyfast.github.io/nbd)\n",
"\n",
"### Notebook Views\n",
"\n",
"* [nbviewer](http://nbviewer.jupyter.org/github/tonyfast/nbd/blob/master/readme.ipynb)\n",
"* [github](https://github.com/tonyfast/nbd/blob/master/usage/readme.ipynb)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}