npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-repl-py

v0.6.8

Published

A pi extension with a single tool: execute, running a TypeScript host with a persistent Python (ipykernel) evaluator and a user-configurable toolbox of functions.

Readme

pi-repl-py

A pi extension that gives the agent a single execute tool backed by a persistent Python evaluator: a real ipython kernel that keeps variables, functions, imports, and data alive across every call and turn.

There is no interactive shell. The agent sends batches of Python code to a workspace that stays alive for the session. Only the output comes back to the conversation. This keeps state in Python without requiring an interactive prompt.

✓ repl · data = load_json("records.json")       · done
✓ repl · avg = sum(v["score"] for v in data)/len(data)
✓ repl · print("mean score:", round(avg, 2))    · mean score: 41.7

data is still there in cell three. Nothing was re-read, nothing re-derived from output, because the kernel stayed alive.

Quick start

# from a clone, one-time setup
just setup            # npm install + a project-local .venv with ipykernel

# run a session
pi --repl

A plain pi session is untouched; the extension is dormant until --repl is passed (or PI_REPL_FORCE=1).

Installing as a pi package

Install the package from npm or directly from GitHub:

pi install npm:pi-repl-py
# or
pi install github:k3-2o/pi-repl-py

The install runs a postinstall that creates the Python venv the evaluator needs, at a stable per-user path (~/.pi/agent/pi-repl/venv). If python3 or the network is missing, it prints a clear notice. How the interpreter is resolved is in docs/ARCHITECTURE.md.

Termux / Android

On Termux (Android), the postinstall venv build can fail because ipykernel depends on psutil, and PyPI does not provide a compatible Android wheel. The Termux / Android setup guide shows how to build psutil from source and finish the installation.

What you get

  • A persistent namespace. Variables, functions, imports, and data survive across cells and turns; snapshots preserve them across a best-effort restart.
  • A real ipython kernel, not a hand-rolled exec loop.
  • Shell and file IO as plain Python. Use !cmd or %%bash for shell commands. Use subprocess.run(...) when you need the result in a variable, and use open() or pathlib for files. There is no extra wrapper API to learn.
  • Error survival. A cell that throws reports the traceback and the kernel keeps going.
  • Explicit recovery. If it restarts, pi-repl reports which state it restored and which state it lost.

Helpers

A helper is a .py file that gets exec'd into every kernel, so whatever it defines (like functions, classes, constants, imports, or a module that manages a tricky piece of complexity) is available in the workspace. Drop a file in a .pi/helpers/ directory in your project (or ~/.pi/agent/pi-repl/helpers/ for every project) and restart the session; e.g. helpers/double.py defining def double(x) becomes callable as double(...). Global helpers ship empty (shell and file IO are already plain Python), so a fresh install preloads nothing until you add one. Project helpers shadow same-named global ones. Each helper's helper_description is shown to the model verbatim; the full contract lives in docs/helpers.md.

The extension keeps its runtime under one folder in your home directory:

~/.pi/agent/pi-repl/
  venv/         the Python interpreter + ipykernel
  helpers/      global helpers (created empty on install; every *.py loads)
  state/        per-session namespace snapshots

Project helpers live in <project>/.pi/helpers/ instead; both tiers are scanned with the project one first. No config file.

Changing a helper (adding/removing a file, renaming one with a _ prefix) needs a session restart / /reload: the prompt list is built when execute is registered and the kernel execs helpers only at boot.

Configuration

There is deliberately no configuration file. Everything is arranged under ~/.pi/agent/pi-repl/: the venv, the fixed helpers dir, and the session state. The Python interpreter is auto-resolved (the venv, else $PYTHON/python3).

More

It is not

  • A sandbox. The kernel runs with your permissions; the toolbox trusts you.
  • A subagent framework. There is no repl.run API; spawn a process with subprocess.run.
  • A pi tool-rack. It is one execute tool with functions inside.

License

MIT. See LICENSE.