Jorge Jesus Alonso Ortiz

Jorge Jesus Alonso Ortiz

Research, teaching, coding… and dogs

Run it anywhere

Overview · Gallery · From Stata & Dynare · Run it anywhere

The same code on a laptop, in a browser and on an iPad

The estimator core imports only NumPy, SciPy, pandas and Matplotlib, so the same code runs on a workstation, in a browser tab and on an iPad. A local install is the supported target; the browser and tablet paths are best-effort.

ON YOUR COMPUTER

One pip install

The base install is the four-package numerical core, NumPy, SciPy, pandas and Matplotlib, plus requests; every one of them ships with Pyodide. It covers the estimators and the data fetchers, and the first check runs offline, with no data and no API key.

pip install puremacro
python -m puremacro.examples.sign_restrictions_uhlig

Optional extras: [io] (parquet and Excel files), [backend] (numba, Apple-Silicon mlx), [cuda], [data], [narrative], [local-llm], [notebooks].

IN YOUR BROWSER

A playground with nothing to install

The JupyterLite playground runs puremacro on a Pyodide kernel inside the browser tab, with 68 notebooks in English and Spanish, including the new 4.3 showcases.

ON AN IPAD

Juno: Python on the iPad itself

Juno, free on the App Store, runs Python 3.13 natively on the iPad, offline, with NumPy, SciPy, pandas and Matplotlib preinstalled. puremacro is a pure-Python package built on exactly those, so Juno’s package manager can add it directly.

  • Install. Add puremacro with Juno’s package manager. Parquet support is optional (the [io] extra, which needs pyarrow); without it, move data with pocket cartridges.
  • Check the device. runtime.report() says what this iPad can do. puremacro recognises both Juno’s built-in Python and its in-browser Pyodide kernel, and works inside the iPad’s sandboxed file system.
  • Tested. The Pyodide gate installs the wheel the way the playground does, resolving dependencies with none from PyPI, and runs 31 tests green under Pyodide 0.28.3, covering data cartridges, resumable jobs and a DSGE solve.
from puremacro import runtime
print(runtime.report())

# In a Pyodide kernel (juno.sh or the playground), install with micropip instead:
import micropip
await micropip.install("puremacro")

WHEN THE TABLET IS NOT ENOUGH

Offload to Google Colab

Package a heavy job, such as a 10,000-draw MCMC or a large bootstrap, as a self-contained notebook, run it on Colab and load the result back as a portable cartridge.

from puremacro.runtime.colab import generate_colab_notebook, load_colab_result

generate_colab_notebook(
    """
import puremacro as pm
result = pm.dsge.estimate_sw07(n_draws=10000, n_chains=4)
""",
    mount_drive=True,
    save_path="sw07_offload.ipynb",
    output_filename="sw07_posterior.pmz",
)
# posterior = load_colab_result("sw07_posterior.pmz")

DATA THAT TRAVELS

Pocket cartridges

Pack a panel where the network is, open it where it is not: one self-verifying file that carries its own provenance.

from puremacro import pocket

pocket.pack(panel, "g7.pmz",
            source="OECD QNA", vintage="2026-08-19")

cart = pocket.load("g7.pmz")   # sha256-checked on read
panel = cart.frame()

JOBS THAT SURVIVE

Resumable long runs

iPadOS suspends background apps. Long jobs compute in chunks, save after each and resume later with bit-identical results.

from puremacro import longrun

job = longrun.bootstrap(one_draw, 2000,
                        checkpoint="irf.ckpt")
job.run(seconds=30)   # 240/2000 · 12%
job.run(seconds=30)   # ...after the app resumes