Skip to main content

ASTScribe

Evidence-backed scientific explanations for ML notebooks, without LLMs.

PyPI Python CI Downloads License Release Stars Issues Last commit Repo size

ASTScribe statically analyzes Python and Jupyter notebooks and turns supported ML operations into deterministic, traceable explanations.

No LLMs. No API keys. No code execution. No telemetry.

Install

python -m pip install astscribe

For Jupyter/IPython:

python -m pip install "astscribe[ipython]"

Python

from astscribe import explain

print(explain("import torch\nwith torch.no_grad():\n    output = model(inputs)"))

ASTScribe analyzes the source without executing it.

Jupyter / IPython

Load the extension once, then explain any executed input by its In[n] number:

%load_ext astscribe.ipython
%scribe 4
%scribe 7 concise

%scribe N rebuilds forward-only static context from earlier Python inputs and explains In[N]. IPython-only syntax acts as a conservative context boundary because ASTScribe does not execute or infer its runtime side effects.

To explain the cell you are writing:

%%scribe concise
with torch.no_grad():
    output = model(inputs)

The %%scribe body is analyzed, not executed.

Notebook files

from astscribe import NotebookAnalyzer

notebook = NotebookAnalyzer.from_ipynb("experiment.ipynb")
print(notebook.render_methodology())

Other notebook reports include dependencies, diagnostics, impact, impact ranking, experiment pipelines, and composite techniques.

CLI

astscribe training.py --style concise
astscribe experiment.ipynb --report methodology
astscribe experiment.ipynb --report diagnostics --json
astscribe experiment.ipynb --report impact --cell 3

The same CLI is available as python -m astscribe. Use --strict to reject notebook code cells that are not valid Python and --fail-on-warning to return status 1 when dependency diagnostics contain warnings.

Supported semantics

ASTScribe has first-class static semantics for PyTorch, Hugging Face Transformers, Hugging Face Datasets, and PEFT. It can reconstruct notebook methodology, experiment pipelines, cross-cell dependencies, diagnostics, impact, and conservative composite techniques such as QLoRA.

Generated claims retain source provenance and an evidence level. Detailed contracts and limitations live in docs.

Development

python -m pip install -e ".[dev]"
pytest
ruff check .
mypy src/astscribe

See CONTRIBUTING.md and docs/releasing.md.

License

Apache License 2.0. See LICENSE.

Metadata

Release files for astscribe 0.9.0

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

Source distribution (sdist)

Source distribution for astscribe 0.9.0
File Size Uploaded
astscribe-0.9.0.tar.gz 78.5 kB Details

Built distribution (wheel)

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

Total release size: 140.1 kB

Release files / astscribe-0.9.0.tar.gz

Download URL astscribe-0.9.0.tar.gz
Size 78.5 kB
Tags Source
SHA-256 checksum
How to use checksums
87832c7c6bb99ed1430bd27a037164e327c5f9fcd44f0ddb0376714f054a103f
BLAKE2b-256 checksum
How to use checksums
cdabd7cebb1c8d37c78e5f098e714337adf8563f8255217a5c587dac2821277c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release files / astscribe-0.9.0-py3-none-any.whl

Download URL astscribe-0.9.0-py3-none-any.whl
Size 61.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f12e982bcf1616707508906bd5155cb37aac0bd743d2655e0824a02379507c4
BLAKE2b-256 checksum
How to use checksums
cfd4a43cb687a4fdb414c0101999cb7d99329ef495febd4b020f524af871768a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release history Release notifications | RSS feed

0.9.1

2 release files

This release

0.9.0 This release

2 release files

0.8.8

2 release files

0.8.7

2 release files

0.8.6

2 release files

0.8.5

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

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