Skip to main content
Glama
README.md
# ๐Ÿชฆ Lazarus โ€” resurrect dead Python code

> Old code doesn't die. The world moves on without it.

**Try it live: https://rambopig06.github.io/lazarus/** (no install, no account)

You find the perfect repo โ€” the paper's reference implementation, the scraper that does exactly what you
need, the library your old project depended on. Last commit: 2015. You run `pip install -r requirements.txt`
and today's packages pour in: `ImportError: cannot import name 'cached_property' from 'werkzeug'`.
The code isn't broken. It's from a different time.

**Lazarus travels back to the day a repository last breathed.** It finds the repo's *time of death*, the
Python and every package version that existed on PyPI that day, and hands you a **resurrection kit** โ€” a
Dockerfile and a date-locked `requirements.lock.txt` โ€” plus an honest **death certificate** of what may still
break.

Built for **Kiroween 2026 ยท Resurrection** with [Kiro](https://kiro.dev), spec-first.

## What it does

| Stage | What happens |
|---|---|
| 1. Time of death | GitHub API โ†’ last commit date of the branch, tag or commit you choose (or a date you override) |
| 2. Relics | Reads `requirements.txt`, `setup.py`, `setup.cfg`, `pyproject.toml` (PEP 621 + Poetry), `Pipfile`, `environment.yml` โ€” including `-e .[extras]` self-references. No dependency files? It scans the imports and maps them to PyPI names (`yaml` โ†’ `PyYAML`, `bs4` โ†’ `beautifulsoup4`) |
| 3. Time travel | For each package: the newest PyPI release uploaded on or before the time of death that satisfies the repo's own constraints and the era's Python (`requires_python` checked per release). Exact pins are kept. Yanked releases are skipped |
| 4. Resurrection kit | Python โ‰ฅ 3.8: a two-stage Dockerfile that compiles a full transitive lock with `uv pip compile --exclude-newer <date>`. Older Python: a single-stage pip Dockerfile, clearly marked. Plus `RESURRECTION.md` and a one-liner |
| 5. Death certificate | Every package that did not exist yet, was yanked, isn't on PyPI or conflicts with the era's Python โ€” as *blockers* or *warnings*, with an overall confidence |

Example โ€” [`jmcarp/robobrowser`](https://github.com/jmcarp/robobrowser) (3.7k โ˜…, last commit June 2015):

```
Time of death : 2015-06-07   Python : 3.4   Confidence : MEDIUM
beautifulsoup4==4.3.2
requests==2.7.0
six==1.9.0
Werkzeug==0.10.4      โ† from before the release that broke it
```

## Run it

```bash
npm install
npm run dev                                                    # web app
npm run demo -- https://github.com/jmcarp/robobrowser          # same pipeline in the terminal
npm run demo -- https://github.com/kennethreitz/records --override-date 2019-06-01
npm test                                                       # unit + property + offline integration tests
```

Everything runs client-side against the public GitHub and PyPI APIs โ€” no server, no account. GitHub allows
60 anonymous requests an hour (Lazarus uses roughly 3 + one per dependency file); add a token in
*Advanced* to raise that. The token stays in `sessionStorage` for the current tab only.

## Use it from your AI assistant (MCP)

The same pipeline is exposed as an MCP server with one tool, `resurrect_repo(url, ref?, overrideDate?, token?)`,
so an agent can set up a working environment before touching an old repo.

```bash
npm run mcp     # stdio server
```

Register it in Kiro (`.kiro/settings/mcp.json`) or any MCP client:

```json
{
  "mcpServers": {
    "lazarus": {
      "command": "npx",
      "args": ["tsx", "mcp/server.ts"],
      "cwd": "/path/to/lazarus",
      "env": { "GITHUB_TOKEN": "optional" }
    }
  }
}
```

## Examples (offline)

`/examples` holds two fixture repos that the integration tests run end-to-end with GitHub and PyPI served from
local files:

- **`with-requirements/`** โ€” a 2018 Flask app. Lazarus must keep `Flask==0.12.2`, pick `requests 2.18.4`
  (not 2.19, released three months after death) and skip a yanked `python-dateutil`.
- **`import-scan-only/`** โ€” no dependency files at all; dependencies are inferred from imports, stdlib is ignored.

## How Kiro built this

- **Steering** (`.kiro/steering/`): product principles ("honesty over magic", Python-only, WCAG AA under the
  graveyard theme), the tech stack, and the repo structure โ€” loaded into every Kiro session.
- **Spec** (`.kiro/specs/time-travel-resurrection/`): requirements in EARS form โ†’ a design with five
  correctness properties โ†’ 12 implementation tasks. Kiro executed Tasks 1โ€“6 (scaffold, GitHub client, six
  parsers, PyPI client, the resolver, kit generators and CLI) and fixed the bugs the first demo exposed.
- **Property-based tests** come straight from the design's correctness properties (fast-check, 100 runs each).
- **Agent hooks** (`.kiro/hooks/`): *Test on save* runs the affected tests and explains any failure; *Spec sync*
  checks every change in `src/lib/` and `mcp/` against the requirements and tasks.

## Limits

Python only for now. Lazarus reads the dependency files at the commit you choose; with `--override-date`
it travels back in time for packages, not for the repository's own files. Native/system libraries (CUDA,
libxml2โ€ฆ) are outside what a lock file can pin.

## License

MIT