Export Jupyter notebooks into narrated, cell-labeled text.
Project description
Neurobyte
Export Jupyter notebooks into narrated, cell-labeled text for LLM contexts.
Features
- Clean Export: Extracts code cells from
.ipynbfiles. - Narrative Summary: Generates a header paragraph summarizing the code's intent.
- Neurobyte Outline: Adds a structured outline with markdown headers.
- Redaction: Automatically redacts sensitive patterns (API keys, BQ table IDs).
- JSON Output: Machine-readable format for indexing and search.
- Markdown Cells: Include
# headersin the outline. - Custom Redaction: Add your own regex patterns.
- Cell Selection: Export specific cell ranges.
Installation
pip install neurobyte
Usage
CLI
# Basic export
python -m neurobyte export notebook.ipynb
# Specify output file
python -m neurobyte export notebook.ipynb -o summary.txt
# JSON output
python -m neurobyte export notebook.ipynb --json
# Include markdown cells
python -m neurobyte export notebook.ipynb --include-markdown
# Custom redaction pattern
python -m neurobyte export notebook.ipynb --redact-pattern 'client_id=\d+'
# Export specific cells
python -m neurobyte export notebook.ipynb --cells 1-5
# Disable redaction
python -m neurobyte export notebook.ipynb --no-redact
Python API
import neurobyte as nb
from neurobyte.export import ExportOptions
# Basic export
nb.export_notebook("notebook.ipynb", "export.txt")
# With options
opts = ExportOptions(
output_format="json",
include_markdown=True,
redact_secrets=True,
extra_redact_patterns=["client_id=\\d+"],
cell_indices=[1, 2, 3],
)
nb.export_notebook("notebook.ipynb", "export.json", options=opts)
# Export from live session (requires IPython)
nb.export_here("session.txt")
# Export from live session (requires IPython)
nb.export_here("session.txt")
Git Integration
Neurobyte provides a pre-commit hook to automatically export notebooks to text for better diffs.
Add this to your .pre-commit-config.yaml:
- repo: https://github.com/EllordParis/neurobyte
rev: main
hooks:
- id: neurobyte-export
Development
This project uses make for common development tasks.
# Install dependencies
make install
# Run tests (Pytest)
make test
# Linting & Formatting (Ruff, Black, Mypy)
make lint
make format
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file neurobyte-0.2.1.tar.gz.
File metadata
- Download URL: neurobyte-0.2.1.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18229205383511fc6c7832f09bc9659a46d11171e2a46df17913fa8e4bfde9af
|
|
| MD5 |
36cf2b464a9578669acffcd8da198630
|
|
| BLAKE2b-256 |
ef4098c9c79dd50ebc39b35bc043c0db2d26b3eac7e8a9d296b95ae69fd7a92f
|
File details
Details for the file neurobyte-0.2.1-py3-none-any.whl.
File metadata
- Download URL: neurobyte-0.2.1-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e63f351cc58e0729b3909dd3bf3dc0d7a2953cbb688e38f8a2a348721671804
|
|
| MD5 |
7b15e111765df2892b3cfe5a61fc6d29
|
|
| BLAKE2b-256 |
edaade8f7930149136b21c402944ce9866cc69fd6ead4e7d662a0a460637306a
|