Skip to main content

nbtof: transfering notebook to function

Project description

nbtof

This module is used to transfer .ipynb file to .py function.
Table of contents

Intoroduction

By writing the #@~ marks in notebook files, you can transfer notebook file to py file with the function which perform the same process as notebook.
For example, in the case that you want to transfer short_sample.ipynb to function,

short_sample.ipynb

#@param
a = 1
b = 1
c = a + b
#@return
c

you can take functionalized py file output.py.

import nbtof

nbtof.nbtof_generate(
    output_py_file='output.py',
    notebook_file='short_sample.ipynb',
    )

output.py

def short_sample(a, b):
    c = a + b
    return c

Installation

The latest nbtof can be installed from PyPI:

pip install nbtof

Documantation

Tags

Tag Description
#@param 関数の引数になります. 代入した数値は無視されます.
#@default 関数の引数になります. 代入した数値が既定値として設定されます.
#@args 関数の可変長引数 *args になります. 代入した数値は無視されます.
#@kwargs 関数の可変長引数 **kwargs になります. 代入した数値は無視されます.
#@return 関数の戻り値になります.
#@ignore セル内の内容は無視されます.
#@help 関数内の docstring になります.

Examples and Recomended Usage

Setting Parameters

Batch processing

複数のnotebook, 関数をまとめて1つの py fileに出力する場合は引数のnotebook_fileにnotebookのfilenameもしくはfilepathをリストにして渡す.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nbtof-0.0.4.tar.gz (8.3 kB view hashes)

Uploaded Source

Built Distribution

nbtof-0.0.4-py3-none-any.whl (7.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page