Skip to main content

Initializes rtx (polyglot asdf-like runtime manager)

Project description

Initialize rtx (polyglot asdf-like runtime manager in Rust)
in a more performant and flexible way

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

This xontrib adds a couple of (maybe too tiny to notice) improvements:

  • (no cost) replaces the subprocess syntax for the hook rtx function with a pure python syntax, which for some reason improves hook runtime by ~60% (but in absolute terms maybe just a dozen or two ms)
  • (less convenient) replaces a hook on every prompt paint with hooks on
    • shell launch
    • changing dirs
    • empty commands
      useful to refresh shell status when you edit .tool-versions outside of shell (optional)
    • commands that containt custom text chunks
      useful to refresh shell status when you edit .tool-versions in a shell (optional)

Installation

To install use pip:

xpip install xontrib-rtx
# or: xpip install -U git+https://github.com/eugenesvk/xontrib-rtx

Usage

This xontrib requires rtx to be in PATH or ~/bin; or if it's added to PATH via another xontrib (e.g, you installed it via Homebrew and use xontrib-homebrew), then you should load this xontrib after the one setting PATH

  1. Add the following to your .py xontrib loading config and import it in your xonsh run control file (~/.xonshrc or ~/.config/rc.xsh):
from xonsh.xontribs 	import xontribs_load
from xonsh.built_ins	import XSH
envx = XSH.env

xontribs = [ "rtx", # Initializes rtx (polyglot asdf-like runtime manager)
 # your other xontribs
]
# ↓ optional configuration variables
if 'rtx' in xontribs: # Configure rtx only if you're actually loading
  # config var                       	  value             	  |default|alt_cmd¦ comment
  envx['XONTRIB_RTX_CHUNK_LIST']     	= ['.tool-versions']	# |['.tool-versions']|False¦ (feeble attempts to track edits to `.tool-versions` in the command line) update rtx status if command contains any of the string chunks in this list; False to disable this listener completely
  envx['XONTRIB_RTX_NEWLINE_REFRESH']	= True              	# |True|False¦ update rtx status if command is empty (e.g, ⏎ on a blank line to refresh after editing `.tool-versions` in a text editor); False to disable this listener completely
  envx['XONTRIB_RTX_FORCE_COLOR']    	= True              	# |True|False¦ preserve colored rtx output
  envx['XONTRIB_RTX_LOGLEVEL']       	= 1                 	# |1|0¦ print xontrib log messages: 0 none, 1 error; 'rtx' stderr is always passed through

xontribs_load(xontribs_manual) # actually load all xontribs in the list
  1. Or just add this to your xonsh run control file
xontrib load rtx # Initializes rtx (polyglot asdf-like runtime manager)
# configure like in the example above, but replace envx['VAR'] with $VAR
$XONTRIB_RTX_LOGLEVEL = 1

Known issues

  • In the future xontrib-rtx will be autoloaded, but this is currently blocked due to a xonsh bug: too early autoload prevens reading user config; also, autoloading can't be disabled

Credits

This package was created with xontrib 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 Distribution

xontrib_rtx-0.0.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

xontrib_rtx-0.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file xontrib_rtx-0.0.1.tar.gz.

File metadata

  • Download URL: xontrib_rtx-0.0.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.1 Darwin/19.6.0

File hashes

Hashes for xontrib_rtx-0.0.1.tar.gz
Algorithm Hash digest
SHA256 fbadd593b0c9e81b6030cc05e5a0830af690fae175a007bd15ad61c8010fe6b5
MD5 e354381a9168834b5da20a3a361ddb56
BLAKE2b-256 37b7208cfa06046ad735591336dd0784af7b33f186e450cc3dd1fa6f29768908

See more details on using hashes here.

File details

Details for the file xontrib_rtx-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: xontrib_rtx-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.1 Darwin/19.6.0

File hashes

Hashes for xontrib_rtx-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 337e5c5c65b20df15ea92dffa7485da5f4b5f88e58b1dbc402104c9117308a96
MD5 4c9ecaabfeab4ff5d49423c4a13caef1
BLAKE2b-256 ec1ee9f7b2c3811445b2d23c890d5f18c077442cf7fd6ed5aebb175774341d4e

See more details on using hashes here.

Supported by

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