neorepl
A small toolkit for building custom Python shells. Zero dependencies, Python 3.9+.
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 argslines 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
Metadata
Release files for neorepl 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| neorepl-0.1.0.tar.gz | 7.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| neorepl-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.4 kB
Release files / neorepl-0.1.0.tar.gz
| Download URL | neorepl-0.1.0.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
189123d30f6e2a5e6b5b50088c4e540f4a131ed991f244e86e03fcdb60a5ae8f
|
|
BLAKE2b-256 checksum How to use checksums |
3baea9bb99553d2895a4188d1e1b04a19894c3902e1def1d1595dc96d2102d42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Release files / neorepl-0.1.0-py3-none-any.whl
| Download URL | neorepl-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba1a760be3a90ef462d8aebe5304e22a6adf73d4767955201d34fb43014b454f
|
|
BLAKE2b-256 checksum How to use checksums |
22673481a4d59ca892a1c5df1965535340d02bf7aea6ce5bd6fba78d311d43dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Security for neorepl 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.