Skip to main content
Pre-release

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

Lispyn

Write experiments in Hy (Lisp for Python). Run them directly or turn them into Jupyter notebooks—with or without executed outputs.

Lispyn adds concise research macros to native Python, PyTorch and Jupyter; it does not replace those tools.

PyPI version CI on main Apache-2.0

Why Lispyn for research?

  • Write once, choose how to run: terminal script, unexecuted notebook or notebook with saved outputs.
  • Reduce boilerplate: macros for experiment parameters, PyTorch training, dataset splits, cross-validation, plots and comparisons.
  • Share inspectable results: standard Python notebook cells, source provenance, metric reports and optional integrity-checked experiment archives.

You still control your models, datasets and evaluation methods. Lispyn cannot guarantee reproducibility or scientific validity.

Install

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

Hy, Jupyter execution and Matplotlib are included. PyTorch is installed separately for your CPU/GPU setup (official instructions). From a clone, pip install -r requirements.txt provides an optional research environment.

Quick start: the same hello.hy in three modes

examples/hello.hy runs without PyTorch or a dataset:

(require lispyn.macros [md])
(md "# Hello Lispyn"
    "A tiny Hy program you can run directly or as a Jupyter notebook.")

(require lispyn.macros [assert-close with-timing])
(print "Hello from Lispyn!")
(with-timing "Summing a few numbers"
  (setv numbers [2 3 5])
  (setv answer (sum numbers)))
(assert-close answer 10)
(print "2 + 3 + 5 =" answer)
(print "Lispyn checks passed!")

Run these commands from the repository root:

1. Run Hy directly — prints to the terminal; creates no notebook.

lispyn run examples/hello.hy

2. Generate a Jupyter notebook (not executed) — writes hello.ipynb with Markdown and Python code cells. Nothing is executed; no outputs are saved.

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

3. Generate and execute a Jupyter notebook — writes hello-executed.ipynb and saves the executed cells with their outputs.

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

Check for 2 + 3 + 5 = 10 and Lispyn checks passed! in terminal output (mode 1) or notebook outputs (mode 3). The timing value varies. The md macro produces a real Markdown cell in notebooks. Macros are not sandboxed: use trusted Hy sources.

Real research workflow: native PyTorch

The runnable quickstart trains on a small synthetic dataset, records metrics and generates an actual training plot. It is a workflow example, not a benchmark.

Hy syntax — an excerpt from the full runnable experiment (native PyTorch; tiny synthetic dataset):

(require lispyn.macros [train-until])
(setv model (torch.nn.Linear 2 2))
(setv run
  (train-until model training 3
    :validation validation :loss-fn (torch.nn.CrossEntropyLoss)
    :epochs epochs :batch-size 4 :lr 0.05 :seed seed :device "cpu"))
(print "Completed epochs:" (len (get run.history "train_loss")))

(require lispyn.macros [curve])
(curve run :metric "loss" :theme "paper"
  :title "Quickstart · real PyTorch training"
  :subtitle "Train versus validation loss · synthetic dataset"
  :figsize [8 4.5]
  :save "../example_generated_notebooks/assets/quickstart_training_curves.png")

Real recorded output:

Samples: 8 train, 4 validation, 4 held-out test · Completed epochs: 10

Held-out test accuracy: 50.0%

Actual training and validation loss from the Hy quickstart

View every executed Jupyter cell · Full Hy source

Toy data for workflow demonstration only; not a scientific benchmark.

To run the example yourself (after installing PyTorch):

lispyn execute examples/quickstart.hy

Use lispyn build examples/quickstart.hy to generate the notebook without training.

More tools and sharing

Lispyn includes 47 documented Hy macros. Browse the macro reference, Hy examples and notebook gallery.

Optional dependencies can be declared as an execution-time notebook cell, never installed during build:

(require lispyn.macros [pip-install])
(pip-install "scikit-learn>=1.5")

Package and verify a completed experiment without rerunning it:

lispyn capsule examples/quickstart.hy example_generated_notebooks/quickstart_executed.ipynb -o study.zip
lispyn verify-capsule study.zip

Capsules omit raw datasets and weights by default; review saved notebook outputs before sharing. Checksums verify integrity, not authorship.

How to cite Lispyn · Apache-2.0 · Created by Eduardo J. Barrios; experimental alpha software.

Metadata

Release files for lispyn 0.31.0a2

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.31.0a2
File Size Uploaded Provenance Actions
lispyn-0.31.0a2.tar.gz 135.5 kB With provenance Details for lispyn-0.31.0a2.tar.gz

Built distribution (wheel)

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

Total release size: 222.5 kB

Release files / lispyn-0.31.0a2.tar.gz

Download URL lispyn-0.31.0a2.tar.gz
Size 135.5 kB
Tags Source
SHA-256 checksum
How to use checksums
442bebc588e34af897c141c49d2a2ed2fea5079b02c5113215858a02fef0aaca
BLAKE2b-256 checksum
How to use checksums
e94c439971879dae496f8daf9aceb6e91a63f6095171c550186f6b2f2aa1f740
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 16, 2026.

Transparency log

Release files / lispyn-0.31.0a2-py3-none-any.whl

Download URL lispyn-0.31.0a2-py3-none-any.whl
Size 87.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f4536adca89c95d83b9eb74cae78fd8bdaa1eb510a17659057fd14e2b7bd482
BLAKE2b-256 checksum
How to use checksums
d79e874419cdef5209e1465d1bfaab46c5616dc7bee9518a77131b62b8bb2896
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 16, 2026.

Transparency log

Security for lispyn 0.31.0a2

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.31.0a2.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 16, 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