Skip to main content

Store the python return value of commands for the session.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xontrib_pyrtn-0.3.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file xontrib_pyrtn-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: xontrib_pyrtn-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for xontrib_pyrtn-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9a42f786d5e4a1c170d1e0f0ddbcde70476429425d345b9b6446557c853174f
MD5 c3303de3fd2acf3c5d5176a4065539c3
BLAKE2b-256 747809e9756ea87d1e9f1e2c2ae5e3b0f00ad921066a60282262938aa57f2911

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page