notebookllm 1.0.0__tar.gz → 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,25 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: notebookllm
3
- Version: 1.0
3
+ Version: 1.1.0
4
+ Summary: A tool for converting Jupyter notebooks to interactive LLM-friendly and token efficient formats by providing CLI utilities for notebook management and processing.
5
+ Author-email: Yasir Raza <yasirabdali6@gmail.com>
6
+ Keywords: jupyter,notebook,llm,conversion,mcp,cli
7
+ Requires-Python: >=3.10
4
8
  Description-Content-Type: text/markdown
5
9
  Requires-Dist: nbformat
6
10
  Requires-Dist: jupyter_client
7
11
 
8
- # notebookllm
12
+ # notebookllm : https://pypi.org/project/notebookllm
9
13
 
10
- A Python package to bridge the gap between Jupyter Notebooks and Large Language Models (LLMs).
14
+
15
+ ![PyPI](https://img.shields.io/pypi/v/notebookllm?label=pypi%20package)
16
+ ![PyPI - Downloads](https://img.shields.io/pypi/dm/notebookllm)
17
+
18
+ A Python package to bridge the gap between Jupyter Notebooks and Large Language Models (LLMs). It reduces token usage,cost and makesit easy for llms to work with large notebooks by providing only the actual code omitting the cell metadata.
11
19
 
12
20
  ## Why this package?
13
21
 
14
- 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.
22
+ Current Large Language Models (LLMs) struggles when working with `.ipynb` files. Working with raw `.ipynb` files with LLMs often leads to heavy token usage, increased costs, and challenges with context window limitations due to the verbose JSON structure and metadata. This package provides a solution by converting `.ipynb` files to a simplified plain text format that LLMs can easily understand, significantly reducing token count. It also allows converting Python files back to `.ipynb` files.
15
23
 
16
24
  ## Features
17
25
 
@@ -88,4 +96,4 @@ notebook.add_raw_cell('{"data": {"text/plain": "This is a raw cell"}}') # Add a
88
96
  notebook.save('new_notebook.ipynb') # Save the notebook
89
97
  notebook.edit_cell(0, 'print("Hello, world!")') # Edit a cell
90
98
  notebook.save() # Save the changes
91
-
99
+ ````
@@ -1,17 +1,14 @@
1
- Metadata-Version: 2.1
2
- Name: notebookllm
3
- Version: 1.0
4
- Description-Content-Type: text/markdown
5
- Requires-Dist: nbformat
6
- Requires-Dist: jupyter_client
1
+ # notebookllm : https://pypi.org/project/notebookllm
7
2
 
8
- # notebookllm
9
3
 
10
- A Python package to bridge the gap between Jupyter Notebooks and Large Language Models (LLMs).
4
+ ![PyPI](https://img.shields.io/pypi/v/notebookllm?label=pypi%20package)
5
+ ![PyPI - Downloads](https://img.shields.io/pypi/dm/notebookllm)
6
+
7
+ A Python package to bridge the gap between Jupyter Notebooks and Large Language Models (LLMs). It reduces token usage,cost and makesit easy for llms to work with large notebooks by providing only the actual code omitting the cell metadata.
11
8
 
12
9
  ## Why this package?
13
10
 
14
- 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.
11
+ Current Large Language Models (LLMs) struggles when working with `.ipynb` files. Working with raw `.ipynb` files with LLMs often leads to heavy token usage, increased costs, and challenges with context window limitations due to the verbose JSON structure and metadata. This package provides a solution by converting `.ipynb` files to a simplified plain text format that LLMs can easily understand, significantly reducing token count. It also allows converting Python files back to `.ipynb` files.
15
12
 
16
13
  ## Features
17
14
 
@@ -88,4 +85,4 @@ notebook.add_raw_cell('{"data": {"text/plain": "This is a raw cell"}}') # Add a
88
85
  notebook.save('new_notebook.ipynb') # Save the notebook
89
86
  notebook.edit_cell(0, 'print("Hello, world!")') # Edit a cell
90
87
  notebook.save() # Save the changes
91
-
88
+ ````
@@ -272,17 +272,25 @@ class Notebook:
272
272
  """
273
273
  Converts the notebook content to a simplified plain text (.py ,.txt or .r file) representation.
274
274
  Each code and markdown cell is extracted into the string
275
- code cells are prefixed with '#CODE:'
276
- markdown cells are prefixed with '#MARKDOWN:'
275
+ code cells are prefixed with '# %% [code]'
276
+ markdown cells are prefixed with '# %% [markdown]'
277
+ Images embedded in markdown cells as base64 data will be replaced by a placeholder.
277
278
  Returns:
278
279
  str: The plain text representation of the notebook.
279
280
  """
280
281
  text_parts = []
282
+ # Regex to find base64 encoded images in markdown
283
+ # Matches ![alt text](data:image/png;base64,...) or similar
284
+ img_regex = r"!\[[^\]]*\]\s*\(data:image\/[a-zA-Z]+\;base64,[^)]+\)"
285
+
281
286
  for cell in self._notebook.cells:
282
287
  if cell.cell_type == "code":
283
288
  text_parts.append(f"# %% [code]\n{textwrap.dedent(cell.source)}")
284
289
  elif cell.cell_type == "markdown":
285
- text_parts.append(f"# %% [markdown]\n{textwrap.dedent(cell.source)}")
290
+ source = cell.source
291
+ # Remove base64 image data from markdown source
292
+ modified_source = re.sub(img_regex, "[Image Data Omitted]", source)
293
+ text_parts.append(f"# %% [markdown]\n{textwrap.dedent(modified_source)}")
286
294
  return "\n".join(text_parts)
287
295
 
288
296
  @staticmethod
@@ -1,10 +1,25 @@
1
- # notebookllm
1
+ Metadata-Version: 2.4
2
+ Name: notebookllm
3
+ Version: 1.1.0
4
+ Summary: A tool for converting Jupyter notebooks to interactive LLM-friendly and token efficient formats by providing CLI utilities for notebook management and processing.
5
+ Author-email: Yasir Raza <yasirabdali6@gmail.com>
6
+ Keywords: jupyter,notebook,llm,conversion,mcp,cli
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ Requires-Dist: nbformat
10
+ Requires-Dist: jupyter_client
2
11
 
3
- A Python package to bridge the gap between Jupyter Notebooks and Large Language Models (LLMs).
12
+ # notebookllm : https://pypi.org/project/notebookllm
13
+
14
+
15
+ ![PyPI](https://img.shields.io/pypi/v/notebookllm?label=pypi%20package)
16
+ ![PyPI - Downloads](https://img.shields.io/pypi/dm/notebookllm)
17
+
18
+ A Python package to bridge the gap between Jupyter Notebooks and Large Language Models (LLMs). It reduces token usage,cost and makesit easy for llms to work with large notebooks by providing only the actual code omitting the cell metadata.
4
19
 
5
20
  ## Why this package?
6
21
 
7
- 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.
22
+ Current Large Language Models (LLMs) struggles when working with `.ipynb` files. Working with raw `.ipynb` files with LLMs often leads to heavy token usage, increased costs, and challenges with context window limitations due to the verbose JSON structure and metadata. This package provides a solution by converting `.ipynb` files to a simplified plain text format that LLMs can easily understand, significantly reducing token count. It also allows converting Python files back to `.ipynb` files.
8
23
 
9
24
  ## Features
10
25
 
@@ -81,4 +96,4 @@ notebook.add_raw_cell('{"data": {"text/plain": "This is a raw cell"}}') # Add a
81
96
  notebook.save('new_notebook.ipynb') # Save the notebook
82
97
  notebook.edit_cell(0, 'print("Hello, world!")') # Edit a cell
83
98
  notebook.save() # Save the changes
84
-
99
+ ````
@@ -1,7 +1,6 @@
1
1
  README.md
2
2
  cli.py
3
3
  pyproject.toml
4
- setup.py
5
4
  notebookllm/__init__.py
6
5
  notebookllm/notebookllm.py
7
6
  notebookllm.egg-info/PKG-INFO
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ notebookllm = notebookllm.cli:main
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+ backend-path = ["."] # Ensures setuptools can find local configurations if needed
5
+
6
+ [project]
7
+ name = "notebookllm"
8
+ version = "1.1.0"
9
+ description = "A tool for converting Jupyter notebooks to interactive LLM-friendly and token efficient formats by providing CLI utilities for notebook management and processing."
10
+ readme = "README.md"
11
+ requires-python = ">=3.10" # You can adjust this if needed
12
+ license = { file = "LICENSE" } # Consider creating a LICENSE file (e.g., MIT)
13
+ authors = [
14
+ { name = "Yasir Raza", email = "yasirabdali6@gmail.com" }
15
+ ]
16
+ keywords = ["jupyter", "notebook", "llm", "conversion", "mcp", "cli"]
17
+
18
+ dependencies = [
19
+ "nbformat",
20
+ "jupyter_client",
21
+
22
+ ]
23
+
24
+ [project.scripts]
25
+ notebookllm = "notebookllm.cli:main"
26
+
27
+ # Optional: If you want to be more explicit about package discovery for setuptools
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- notebookllm = cli:main
@@ -1,3 +0,0 @@
1
- [build-system]
2
- requires = ["setuptools>=43.0.0", "wheel"]
3
- build-backend = "setuptools.build_meta"
notebookllm-1.0/setup.py DELETED
@@ -1,23 +0,0 @@
1
- from setuptools import setup, find_packages
2
- import os
3
-
4
- def read(fname):
5
- return open(os.path.join(os.path.dirname(__file__), fname)).read()
6
-
7
- setup(
8
- name='notebookllm',
9
- version='1.0',
10
- packages=find_packages(),
11
- py_modules=['cli'],
12
- install_requires=[
13
- 'nbformat',
14
- 'jupyter_client',
15
- ],
16
- long_description=read('README.md'),
17
- long_description_content_type='text/markdown',
18
- entry_points={
19
- "console_scripts": [
20
- "notebookllm = cli:main",
21
- ],
22
- },
23
- )
File without changes
File without changes