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 64 notebooks in English and Spanish.

ON AN IPAD

Juno: Python on the iPad itself

Native Juno and a browser’s Pyodide kernel are different runtimes. Installation depends on the app’s Python version and available packages; browser evidence does not establish native-iPad compatibility. Tablet use remains best effort, with a local workstation as the supported target.

  • 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 runtime. Start with runtime.report() to inspect the current environment, then run a small example on the device. Native Juno and browser kernels can differ in package availability and file access.
  • Browser evidence. The Pyodide gate installs the wheel using the playground’s dependency rules and exercises selected workflows. This is evidence for that browser runtime and test set, not native-Juno or every-tablet validation. See the runtime guide for supported paths and limits.
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