Metadata-Version: 2.4
Name: neorepl
Version: 0.1.0
Summary: A small toolkit for building custom Python shells
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"

# neorepl

A small toolkit for building custom Python shells. Zero dependencies, Python 3.9+.

```python
from neorepl import Shell

shell = Shell({"answer": 42}, prompt="my> ", history_file="~/.my_history")

@shell.command("greet", help="Say hello")
def greet(sh, name="world"):
    sh.print(f"Hello, {name}!")

@shell.on("pre_run")                 # rewrite input before it executes
def rewrite(sh, source):
    if source.strip() == "ll":
        return "print(sorted(globals()))"

shell.run()
```

## Features
- **Commands**: `%name args` lines handled by `@shell.command` (prefix configurable). Built-ins: `%help %exit %vars %reset %run %history`.
- **Hooks**: `start`, `exit`, `pre_run` (can rewrite input), `post_run`, `error`, `command`.
- **Prompts**: static strings or `callable(shell, more) -> str`.
- **Display**: swap `formatter=` to pretty-print results (e.g. `pprint.pformat`, rich).
- **Tab completion** for names, dotted attributes, and commands (via readline).
- **Persistent history** with `history_file=`.
- **Embedding**: `neorepl.embed()` opens a shell with the caller's variables.

## Develop
```
pip install -e ".[dev]"
pytest
python examples/demo.py
```
