Skip to main content

nbskill

nbskill gives Python agents and maintainers tools to read, edit, run, and review nbdev notebooks by chapter, symbol, or cell ID.

from pyskills import doc, list_pyskills
from nbskill import skill
from nbskill.foundation import cell_source, parse_cells
from nbskill.graph import notebook_knowledge_graph_data
from nbskill.read import context

Why it exists

nbskill validates notebook edits before writing and keeps existing cell IDs stable. Use focused execution and source diffs to check what changed.

Learn the problem areas

Start with the Pyskill workflow. The source notebooks contain the implementation, examples, and tests for reading, editing, execution, and review. The editing notebook documents validation, export, and rollback for batch edits.

Choose a tool

Need Public operation
Find the relevant chapter or symbol context
Route generated Python back to its source notebook generated_owner
Make an atomic edit using stable cell IDs edit_notebook
Run focused checks in the project environment exec_nb
Review changed cell source and notebook style diff_nb, style_check
Assess execution evidence after a change notebook_state

Load nbskill.skill through Pyskills, then read doc() for the callable you intend to use. Its signature and parameter documentation are the operation’s contract.

Parse notebook cells

parse_cells accepts a compact text format with %%markdown, %%code, and --- boundaries. This is useful when proposing several cells without notebook JSON. The result retains the two different cell types:

cell_text = "\n".join(["%%markdown", "## Demo", "---", "%%code", "value = 42"])
parsed_cells = parse_cells(cell_text)
assert [cell.cell_type for cell in parsed_cells] == ["markdown", "code"]
[(cell.cell_type, cell_source(cell)) for cell in parsed_cells]
[('markdown', '## Demo'), ('code', 'value = 42')]

Read a notebook

Use context to get stable cell addresses. Start with a summary, then select a chapter or symbol for the full source.

notebook_context = context("nbs/14_pyskill.ipynb", view="summary", verbose=False)
assert notebook_context["selection"]["matches"]
notebook_context

Load the Pyskill

Install nbskill==0.0.21 from its GitHub release tag in the Python environment used by the agent. With uv, pin both the package version and its release source:

[project]
dependencies = ["nbskill==0.0.21"]

[tool.uv.sources]
nbskill = {git = "https://github.com/MorsCerta-crypto/nbskill.git", tag = "0.0.21"}

Authenticate private-repository access with gh auth login and gh auth setup-git, commit uv.lock, and install with uv sync --locked. For development inside this repository, use uv sync --locked and the checks in DEVELOPMENT.md. The package registers nbskill.skill in the pyskills entry-point group. Discovery lists its scope without importing every problem area. Inspect the module and then the selected operation:

assert "nbskill.skill" in list_pyskills()
doc(skill.context)

Use with aai-coding

aai-coding owns the persistent session and ordinary Python files. nbskill.skill owns notebook source, generated modules, focused execution, and notebook review. generated_owner chooses the route for each Python file; a repository marker alone does not make every file generated.

install_nbskill --target codex installs the local notebook routing skill. The Python Pyskill works independently of that host-specific installation.

Trace notebook relationships

The local graph links notebooks, cells, headings, symbols, and imports. Definition and call evidence helps a maintainer find related source before changing a symbol. Similarity edges are hints rather than runtime dependency guarantees. This example displays a small summary of the real source tree. Run it manually because building the graph scans all source notebooks:

graph = notebook_knowledge_graph_data("nbs")
dict(nodes=len(graph["nodes"]), edges=len(graph["edges"]), node_types=sorted({node["type"] for node in graph["nodes"]}), edge_types=sorted({edge["type"] for edge in graph["edges"]}))

Development

Use the development guide for checks and releases, and WORKFLOW.md for the shared branch and review policy.

Metadata

Release files for nbskill 0.0.21

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nbskill 0.0.21
File Size Uploaded Provenance Actions
nbskill-0.0.21.tar.gz 156.0 kB Without provenance Details for nbskill-0.0.21.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nbskill 0.0.21
File Interpreter ABI Platform Actions
nbskill-0.0.21-py3-none-any.whl Python 3 none any Details for nbskill-0.0.21-py3-none-any.whl

Total release size: 320.1 kB

Release files / nbskill-0.0.21.tar.gz

Download URL nbskill-0.0.21.tar.gz
Size 156.0 kB
Tags Source
SHA-256 checksum
How to use checksums
533b8f4472703319e096dc83b691e11fc76a1027f27219b9d22021b6a2c1051d
BLAKE2b-256 checksum
How to use checksums
d1356233e4b99019c6ecb017d07dfc7191c081b7fcb76638dfd8847367058c98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / nbskill-0.0.21-py3-none-any.whl

Download URL nbskill-0.0.21-py3-none-any.whl
Size 164.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef1ff919393b6686ca648eb52d1a5f63da7e82a9339c9ed842712c3c5d1a3ade
BLAKE2b-256 checksum
How to use checksums
7090fd8d8878002ba8a7578897673d7fb251df0ff1deafa0e530b589c94661a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for nbskill 0.0.21

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.21 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page