This article is the 4th day post of Bakan Advent Calendar 2019. This is an article for Jupyterer. Please check the formula for details, as some parts are not well understood.
Perhaps briefly, it's a Python programming environment that completes the task with a single Jupyter Notebook by including the IDE role. Created by fast.ai and currently under development [fastai v2](https://forums.fast.ai/t/fastai-v2-read- This-before-posting-please / 53517) also uses nbdev.
Currently, trial and error such as EDA and model construction is often done using Jupyter Notebook, and it exists as the role of "exploring". However, it is common to use the IDE in the subsequent phases.
nbdev is trying to complete it on jupyter by providing the following functions. ・ Creating a py file ・ Creating a README ・ Visual diff ・ Confirmation and correction of merge conflict
(Borrowed from the official below)
The following is done on Mac, but the procedure is the same on Win.
1- Install from the terminal with the following command.
pip install nbdev
2- Official creates template, so create Repository based on it.
3- Clone the created Repository.
git clone [URL below]
4-Edit settings.ini
to add information about the repository to be linked.
Uncomment the following items in settings.ini
and edit as shown in the entry example.
Before editing
Entry example
lib_name, user, description correspond to the created repository. I don't know what keywords refers to, but please enter an appropriate string.
5-Type the following command from the terminal to create the lib_name directory.
nbdev_build_lib
(In the image above, Pipfile and Pipfile.lock are displayed, but they are irrelevant and should be ignored)
6-Open Jupyter Notebook with jupyter notebook
.
Open 00_core.ipynb
and follow the steps below to create a module.
# export
to the beginning of the cell. nbdev_build_lib
on the terminal.)
from nbdev.export import *
notebook2script()
The following example
As a result, what you specify with # export
will be listed in core.py
under the lib_name directory.
The core.py
is updated each time you perform step 2, so in addition to adding it, you can delete it by erasing the existing cell.
When you open 99_index.ipynb
, the following template will be displayed.
Since the cell with # hide
is hidden, we will import the module including the one with # export
here.
Template
The following example
After editing is complete, run nbdev_build_docs
on the terminal to update the README.md
in the directory.
After that, when you push to the remote repository, the README on github will show the following.
[How was it? ](Https://www.google.com/search?ei=BGXmXczDEIj90gTEkJ-IDg&q=%E3%81%84%E3%81%8B%E3%81%8C%E3%81%A7%E3%81%97 % E3% 81% 9F% E3% 81% 8B & oq =% E3% 81% 84% E3% 81% 8B% E3% 81% 8C% E3% 81% A7% E3% 81% 97% E3% 81% 9F% E3% 81% 8B & gs_l = psy-ab.3..0l9j0i7i30.0.0..1423 ... 0.0..0.158.225.1j1 ...... 0 ...... gws-wiz.dTg3WBRsT_o & ved = 0ahUKEwjM1ZHXzJnmAhWIvpQKHUTIB- EQ4dUDCAs & uact = 5) I introduced the outline of nbdev and a part of how to use it. We hope that this article will give you an opportunity to try out nbdev. Please check the following references as some parts may not be covered.
・ Nbdev: use Jupyter Notebooks for everything ・ Welcome to nbdev ・ Nbdev discussion ・ A Step-by-Step Introduction to Starting nbdev — Exploratory Programming ・ Introduction to git that will not be frustrated this time, Part 1
・ Vacan, Inc. ・ Vacan Advent Calendar 2019
Our CEO is Kaggle's recommendation.
Recommended Posts