/xontrib-pyrtn

Xontrib to store the python return value of commands for the session, mimicking ipython's In/Out.

Primary LanguagePythonMIT LicenseMIT

Store the python return value of commands for the session.

If you like the idea click ⭐ on the repo and tweet.

Installation

To install use pip:

xpip install xontrib-pyrtn
# or: xpip install -U git+https://github.com/dyuri/xontrib-pyrtn

Usage

xontrib load xontrib_pyrtn

The xontrib adds two functions to the global namespace - In[] and Out[]. They are similar to ipython's In[] and Out[]. (In() and Out() is also available and does the same thing, except they can be called w/o argument and will show the list of input/output.)

A new PROMPT_FIELD pyhistnum is also added, to be able to include the number of the upcoming command (like in ipython).

Example

$ xontrib load pyrtn
$ $PROMPT = "[{pyhistnum}]$ "
[2]$ [12 * 3 + 6]
[42]
[3]$ In[2]
"[12 * 3 + 6]\n"
[4]$ Out[2] + [1]
[42, 1]
[5]$ 

Credits

This package was created with xontrib cookiecutter template.