Skip to main content

nbdocgen is a command line tool to generate documentation for each and every cell in a Jupyter notebook using OpenAI Chat Completion APIs.

Project description

nbdocgen is a command line tool to generate documentation for each and every cell in a Jupyter notebook using OpenAI.

Getting Started

Prerequisites

  • Python >=3.8
  • Poetry
  • OpenAI API Key

Installation

git clone https://github.com/santiadavani/nbdocgen
cd nbdocgen
poetry shell
poetry install
pip install .

Usage

Set OPENAI_API_KEY environment variable. If you don't have a key please check documentation here

export OPENAI_API_KEY=<OPENAI_API_KEY>

You can check all the options using --help.

(nbdocgen-py3.9) bash-3.2$ nbdocgen --help
Usage: nbdocgen [OPTIONS]

Options:
  --input PATH          Input Jupyter Notebook
  --output PATH         Output Jupyter Notebook
  --temperature FLOAT   Temperature for OpenAI  [default: 0.7]
  --top_p FLOAT         Top p for OpenAI  [default: 1.0]
  --max_tokens INTEGER  Max tokens for OpenAI completion  [default: 256]
  --base_prompt TEXT    Base prompt for OpenAI completion  [default: Please
                        generate a two sentence markdown documentation for the
                        given Python code.]
  --help                Show this message and exit.

Examples

Basic Usage

nbdocgen --input <input_notebook> --output <output_notebook>

Advanced Usage

In this example, we show how to use temperature and base_prompt options.

nbdocgen --input ~/Downloads/input_notebook.ipynb \
--output ./output_notebook.ipynb --temperature 0.3 \
--base_prompt "Please generate 5 sentence markdown documentation for the code below"

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

nbdocgen-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

nbdocgen-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file nbdocgen-0.1.0.tar.gz.

File metadata

  • Download URL: nbdocgen-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.7.9 Darwin/19.6.0

File hashes

Hashes for nbdocgen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1ffbdf5561eaf0215173c683b9c62a93115467ce6f48dba08d9861d598b6c8ea
MD5 59ef627350606ece9de844f5b481d863
BLAKE2b-256 4e00bbc3deb75121e3a8ab4dfb79f33c9694e4ca3e02cbf450d1d8ef91eecf05

See more details on using hashes here.

File details

Details for the file nbdocgen-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nbdocgen-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.7.9 Darwin/19.6.0

File hashes

Hashes for nbdocgen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e860b98519ad22baea4a130f6a9c7f695a793d7c919c366c7994a970c88b186e
MD5 c98aa889e141a0de410f24fde5a35448
BLAKE2b-256 d2140e4993807159767892e05ddae3a111ebfdff53dfc4f24289e4525609cb65

See more details on using hashes here.

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