Skip to main content

Heaton Life

heaton-life

PyPI version Python versions Python tests Python coverage License Open in Colab

heaton-life is a Python library for exploring emergence: simple rules that give rise to complex, organic-looking behavior. It brings together cellular automata (MergeLife, Life-like with its History and Super variants, Generations, Larger than Life, rule tables from any .rule file, HashLife on an unbounded plane for two-state and multi-state rules, Elementary, Cyclic, and Wireworld), three flavors of Lenia, fractals (Newton's basins, and Mandelbrot, Julia, and Burning Ship with deep zoom, to 10⁹⁰⁰⁰ for Mandelbrot and Julia), Reynolds boids, and Gray-Scott reaction-diffusion under one consistent API. Every system steps and renders the same way, so a few lines of NumPy-backed code give you a still image, an animated GIF, or an MP4. A genetic evolver can search for new MergeLife rules, and an optional PyQt6 playground lets you explore everything interactively.

Results are reproducible by design. Each system follows a written specification and a set of conformance vectors, so the same parameters and seed always give the same run, and the library's .NET implementation is held to the same vectors. The specifications, the vectors, and the .NET port live in the heaton-life repository.

Here is every system in the library, each rendered by the library itself. The bottom-right tile is the Mandelbrot set at a zoom of 10¹⁴, far beyond what plain floating point can resolve:

heaton-life gallery: one tile per system

Install

Install from PyPI.

pip install heaton-life

heaton-life requires Python 3.11 or newer and depends only on NumPy (2.0.2 or newer) and Pillow. Extras: heaton-life[playground] (the PyQt6 app), [precision] (gmpy2 for faster deep-zoom reference orbits; plain Python integers give the same orbit otherwise), [video] (MP4 export).

Sample Code

import heaton_life as hl

# A Life-like automaton from a random soup, rendered to an animated GIF.
sim = hl.ca.LifeLike("B3/S23", size=(256, 256), init="soup", seed=42)
hl.render.animate(sim, steps=500, cmap="phosphor").save("life.gif")

# Deep zoom: float64 pixelates near 1e13; this renders via perturbation + rebasing.
frac = hl.fractal.Mandelbrot(max_iter=5000)
field = frac.render((1920, 1080), hl.Viewport(
    center_re="-0.743643887037158704752191506114774",
    center_im="0.131825904205311970493132056385139",
    zoom_log10=14.0,
))
hl.render.to_image(field, cmap="fire").save("deep.png")

# HashLife: the Gosper glider gun on an unbounded plane. One step can jump any number
# of generations, and populations and coordinates are exact integers. Any pattern file
# loads the same way (hl.ca.HashLife.from_file reads RLE, Macrocell, plaintext, Life
# 1.05/1.06, PNG, and BMP, gzip-compressed or not).
gun = hl.ca.HashLife.from_rle(
    "x = 36, y = 9, rule = B3/S23\n24bo$22bobo$12b2o6b2o12b2o$11bo3bo4b2o12b2o$"
    "2o8bo5bo3b2o$2o8bo3bob2o4bobo$10bo5bo7bo$11bo3bo$12b2o!"
)
gun.step(10**12)
print(gun.generation, gun.population)   # 1000000000000 166666666713, in a fraction of a second

# Zoom movie: each frame's iteration budget measured down the descent, colors that
# hold still, frames streamed to disk (an .mp4 needs the video extra; any other path
# is a folder of PNG frames):
hl.fractal.render_zoom_movie(
    lambda max_iter: hl.fractal.Mandelbrot(max_iter=max_iter),
    (640, 360),
    hl.Viewport(center_re="-0.7435", center_im="0.1314"),
    hl.fractal.ZoomPlan(start_zoom=0.0, end_zoom=4.0, frames=240, fps=30),
    "zoom.mp4",
)

# Evolve MergeLife rules with the paper's objective — reproducible from a seed
# (slow: a few minutes at these settings):
from heaton_life.evolve import Evolver
best = Evolver(size=(64, 64), population_size=20, seed=42).run(max_evals=200)
print(best.genome, best.score)

Checking the runtime

The identical results rest on IEEE-754 double arithmetic with no fused multiply-add contraction and no flush-to-zero, and on NumPy fusing its complex multiply the way the specifications assume. To confirm that your own installation keeps that contract (an unusual NumPy build, or a process that has loaded a library compiled with -ffast-math), run the platform self-check: 22 checks against answers embedded in the package, in well under a second.

from heaton_life import self_check

ok, report = self_check.run()   # report: one PASS/FAIL line per check
print(report)

Playground

pip install "heaton-life[playground]"
heaton-life                        # or: python -m heaton_life.playground

Space plays and pauses, N steps once, R resets, and Ctrl+S saves a PNG. Every system's parameters can be changed while it runs.

Helpful Links

Development

To work on the library itself, see the development guide. It covers setting up, running the checks, adding a new system, and making a release.

Metadata

Release files for heaton-life 1.2.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 heaton-life 1.2.0
File Size Uploaded Provenance Actions
heaton_life-1.2.0.tar.gz 779.7 kB With provenance Details for heaton_life-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for heaton-life 1.2.0
File Interpreter ABI Platform Actions
heaton_life-1.2.0-py3-none-any.whl Python 3 none any Details for heaton_life-1.2.0-py3-none-any.whl

Total release size: 1.2 MB

Release files / heaton_life-1.2.0.tar.gz

Download URL heaton_life-1.2.0.tar.gz
Size 779.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e4ddf8f7ae15faadb1555407336aaa2424d558977fabef551ffd8c3ef6736423
BLAKE2b-256 checksum
How to use checksums
49a558bcd41dac17a6f605ee8ebf276856ffe50d8e32ed9684c342046c918bea
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 24, 2026.

Transparency log

Release files / heaton_life-1.2.0-py3-none-any.whl

Download URL heaton_life-1.2.0-py3-none-any.whl
Size 389.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c047c587e1a3b7d7f4aa6f34b91068a12aea326b888a41c10a9957e02fa134e4
BLAKE2b-256 checksum
How to use checksums
b8b9f76d87e39f806b7ad82249d2937fcbf28db029671b625a068ee58e94b437
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 24, 2026.

Transparency log

Security for heaton-life 1.2.0

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 heaton_life-1.2.0.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 24, 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.

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