Skip to main content

No project description provided

Project description

notebookllm

A Python package to bridge the gap between Jupyter Notebooks and Large Language Models (LLMs).

Why this package?

Current Large Language Models (LLMs) cannot directly read or process .ipynb files. This package provides a solution by converting .ipynb files to a simplified plain text format that LLMs can easily understand. It also allows converting Python files to .ipynb files.

Features

  • Convert .ipynb files to a simplified plain text (.py, .txt or .r file) format.
  • Convert Python or R (.py, .txt or .r files) to .ipynb files.
  • The plain text (.py, .txt or .r) format preserves the structure of the notebook, including code and markdown cells, using # %% [code] and # %% [markdown] identifiers.
  • The plain text (.py, .txt or .r) format can be easily parsed back into a .ipynb file.

Installation

pip install notebookllm

or

git clone https://github.com/yasirrazaa/notebookllm.git
cd notebookllm
pip install .  

Usage

CLI

to_text

Converts a .ipynb file to a simplified plain text format.

Usage:

notebookllm to_text <ipynb_file> --output <output_file>
  • <ipynb_file>: Path to the .ipynb file.
  • --output <output_file>: Path to save the plain text output. If not provided, the output will be printed to the console.

Example:

notebookllm to_text my_notebook.ipynb --output my_notebook.txt

to_ipynb

Converts a .py file to a .ipynb file.

Usage:

notebookllm to_ipynb <py_file> --output <output_file>
  • <py_file>: Path to the .py file.
  • --output <output_file>: Path to save the .ipynb output. If not provided, the output will be saved to output.ipynb.

Example:

notebookllm to_ipynb my_script.py --output my_notebook.ipynb

API

from notebookllm import Notebook

notebook = Notebook(filepath='notebook.ipynb')  # Load existing notebook or create a new one
notebook.add_code_cell('print("Hello, world!")') # Add a code cell
notebook.add_markdown_cell('# This is a markdown cell') # Add a markdown cell
notebook.execute_cell(0) # Execute a cell
notebook.delete_cell(1) # Delete a cell
notebook.add_raw_cell('{"data": {"text/plain": "This is a raw cell"}}') # Add a raw cell
notebook.save('new_notebook.ipynb') # Save the notebook
notebook.edit_cell(0, 'print("Hello, world!")') # Edit a cell
notebook.save() # Save the changes

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

notebookllm-1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

notebookllm-1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file notebookllm-1.0.tar.gz.

File metadata

  • Download URL: notebookllm-1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.2

File hashes

Hashes for notebookllm-1.0.tar.gz
Algorithm Hash digest
SHA256 2a304b118ca13f1fe3f9ec52c627af445040575005f7042dcaf70d06522b94cd
MD5 15b469989cae2f518b21c4523237fa41
BLAKE2b-256 711374975918419b1ba198d7918b340a8193130f5777da21edc5699777618e9d

See more details on using hashes here.

File details

Details for the file notebookllm-1.0-py3-none-any.whl.

File metadata

  • Download URL: notebookllm-1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.2

File hashes

Hashes for notebookllm-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a512372ef373ce38e71a455b26dd254c7646e9f9cf2528754afb07c075e4b597
MD5 0435d915099257bc87f5cbf609630c95
BLAKE2b-256 7d574622bb6c2e0c54e318b6a1dc4208c3836a17dd51f371617f4fd01e741298

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