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

Jupyter notebookに#@タグをつけることで, notebookの一連の処理を関数に変換することができます.
たとえば, 下記short_sample.ipynbの処理を関数化する場合,

short_sample.ipynb

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

以下を実行すると, 関数化された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

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をリストにして渡す.

Installation

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.3.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nbtof-0.0.3-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file nbtof-0.0.3.tar.gz.

File metadata

  • Download URL: nbtof-0.0.3.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for nbtof-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e685b7d37d7594238b39639854c20f27d482d4bfd7300b4eea908eb72768ce39
MD5 4047107d2a68905419a77a9de84562a6
BLAKE2b-256 9a9131662ac27269769acead3207cdbdd13bf8a57c02fb3b60a297d1268d7d7d

See more details on using hashes here.

File details

Details for the file nbtof-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: nbtof-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for nbtof-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e734e7ca5e47ff5cc99a0691070d062958661ebb12538572a9fbb840de0a18de
MD5 98e0700e17fd99f4f041be905112ae6a
BLAKE2b-256 1bd24db105b959232b7b761edd75c0f7ec606c7919525baba5f6602d32a63f3b

See more details on using hashes here.

Supported by

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