Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Lispyn — Lisp-powered AI notebooks

Write machine-learning experiments in Hy (Lisp for Python), then run them as scripts or turn them into Jupyter notebooks with ordinary Python code and real execution outputs.

Lispyn is a small experiment authoring and notebook workflow layer, not a replacement for PyTorch, NumPy, pandas, or Matplotlib. You keep the same models, data, optimizers and Python ecosystem; Hy macros make repeated experiment steps easier to express, review and reuse.

PyPI version CI on main Apache-2.0

Why use Lispyn for AI notebooks?

One source, three useful artifacts. Develop a `.hy` experiment once. Execute it as a script (`run`), compile a reviewable but unexecuted notebook (`build`), or produce a notebook with saved outputs (`execute`). Unlike a notebook-only workflow, you can version-control readable source while sharing standard `.ipynb` files.

Less repeated experiment wiring, without a new tensor API. The real PyTorch quickstart splits a dataset into train, validation and held-out test subsets:

(setv [training validation held-out]
  (train-val-test dataset :validation-fraction 0.25
    :test-fraction 0.25 :seed seed))

Lispyn's training macros also support early stopping, metrics, gradient accumulation, checkpoints and learning-rate schedules; their results are ordinary PyTorch-backed objects.

Explicit diagnostics before and after training. The input validation example rejects unexpected shapes and nonfinite values:

(require lispyn.macros [assert-finite assert-shape])
(import numpy :as np)
(import pandas :as pd)

(setv features (np.array [[1.0 2.0] [3.0 4.0]]))
(assert-shape features [2 2] :name "features")
(assert-finite features :name "features")

Check class imbalance using the runnable example:

(require lispyn.macros [label-balance plot-label-balance])
(setv labels ["cat" "cat" "cat" "dog" "dog" "bird"])
(setv report (label-balance labels :title "Training label distribution"))

For classification, `class-weights` derives inverse-frequency loss weights, and `threshold-report` compares binary probability cutoffs on validation data, not the held-out test set.

Readable, evidence-linked notebooks. Generate metric tables, plots, comparisons and Markdown from recorded runs rather than manually pasting numbers. The quickstart reports PyTorch results directly:

(require lispyn.macros [report-run narrate metric-table])
(import lispyn.training [evaluate-metrics])
(report-run run :title "PyTorch baseline · recorded metrics")

See its executed notebook, or use parameterized experiments, sweeps, notebook auditing and export to Markdown.

Native PyTorch controls when you write your own loop. The CPU-only example demonstrates `with-no-grad`, `with-autocast`, `clip-gradients`, `freeze-module`, `unfreeze-module`, `parameter-count`, `move-to-device`, `save-model` and `load-model`. These are focused helpers, not a hidden training engine.

Install

pip install lispyn

The base package includes Hy, notebook compilation/execution and Matplotlib. NumPy is available through Matplotlib; add pandas with `pip install "lispyn[data]"`. PyTorch is installed separately: select the appropriate CPU/GPU build from PyTorch's installer. A cloned repository provides a broader optional development setup:

pip install -r requirements.txt

Python 3.10+ is required. Lispyn is experimental alpha software; macros and APIs may change.

Quickstart: run, build, execute

Clone the repo for the sample (no dataset or PyTorch required):

git clone https://github.com/edujbarrios/lispyn.git
cd lispyn

1. Run directly in a terminal. No notebook is written.

lispyn run examples/hello.hy

2. Build an ordinary Jupyter notebook. Nothing is executed; `hello.ipynb` contains compiled Python and Markdown cells.

lispyn build examples/hello.hy -o hello.ipynb

3. Build and execute a notebook. Jupyter runs the cells; `hello-executed.ipynb` saves the executed cells and their outputs.

lispyn execute examples/hello.hy -o hello-executed.ipynb

The hello example prints `2 + 3 + 5 = 10` and `Lispyn checks passed!`. For real but tiny offline PyTorch training, try `lispyn execute examples/quickstart.hy` after installing torch.

When should you use it?

Choose Lispyn when you like Lisp/Hy macros, want plain Python notebook outputs, and repeatedly build comparable ML experiments with dataset checks, structured reporting and reusable workflows. Stay with regular Python notebooks when you do not need macros, or prefer editing cells interactively as your primary source. Lispyn does not make models more accurate, guarantee bitwise determinism, or prevent data leakage unless the experiment is designed correctly.

Security: Only compile and execute trusted Hy code: Hy macros can execute arbitrary Python at compile time. Build does not run notebook cells, but compilation itself is not sandboxed. Load checkpoints only from trusted sources.

Documentation

Complete reference: 65 supported macros — arguments, dependencies and runnable Hy examples for PyTorch, NumPy, pandas, Matplotlib, Jupyter authoring and experiment analysis. Also see generated notebook examples, changelog and citation.

Created by Eduardo J. Barrios · Apache-2.0 licensed · experimental alpha software.

Metadata

Release files for lispyn 0.37.0a1

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

Source distribution (sdist)

Source distribution for lispyn 0.37.0a1
File Size Uploaded Provenance Actions
lispyn-0.37.0a1.tar.gz 157.2 kB With provenance Details for lispyn-0.37.0a1.tar.gz

Built distribution (wheel)

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

Total release size: 256.8 kB

Release files / lispyn-0.37.0a1.tar.gz

Download URL lispyn-0.37.0a1.tar.gz
Size 157.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b4102dab2d0cca819b9ce8bb5c61905f99d2b7443ae9650f2f787ce13dc3ec19
BLAKE2b-256 checksum
How to use checksums
0b993990b44fa137fddc374554b8fc75fcb2c92127ae841d0fcb7c60040806d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 18, 2026.

Transparency log

Release files / lispyn-0.37.0a1-py3-none-any.whl

Download URL lispyn-0.37.0a1-py3-none-any.whl
Size 99.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc17342ab457d63d3ae9aa2bc78b82639b25768f6cbb78322ff43334dae1a67f
BLAKE2b-256 checksum
How to use checksums
4cdb3981196e678c3c4ccf468aa87cfc8c156100f1f6fc2e0fa2ba66d6b44c62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 18, 2026.

Transparency log

Security for lispyn 0.37.0a1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lispyn-0.37.0a1.tar.gz

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 Nov 18, 2026.

Transparency log

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
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