Skip to main content

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]$ 

Starship

For starship users, the xontrib also updates $PYRTN_HISTNUM after each command so it can be displayed with starship modules.

Example starship.toml snippet:

format = "...${env_var.PYRTN_HISTNUM}..."

[env_var.PYRTN_HISTNUM]
format = "[\\[]($style)[$env_value](bold)[\\] ]($style)"
style = "blue"

Credits

This package was created with xontrib cookiecutter template.

Metadata

Release files for xontrib-pyrtn 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for xontrib-pyrtn 0.3.0
File Interpreter ABI Platform
xontrib_pyrtn-0.3.0-py3-none-any.whl Python 3 none any Details

Release files / xontrib_pyrtn-0.3.0-py3-none-any.whl

Download URL xontrib_pyrtn-0.3.0-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9a42f786d5e4a1c170d1e0f0ddbcde70476429425d345b9b6446557c853174f
BLAKE2b-256 checksum
How to use checksums
747809e9756ea87d1e9f1e2c2ae5e3b0f00ad921066a60282262938aa57f2911
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page