Skip to main content

Initializes mise (polyglot asdf-like runtime manager)

Project description

Initialize mise (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 mise 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-mise
# or: xpip install -U git+https://github.com/eugenesvk/xontrib-mise

Usage

This xontrib requires mise 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 = [ "mise", # Initializes mise (polyglot asdf-like runtime manager)
 # your other xontribs
]
# ↓ optional configuration variables
if 'mise' in xontribs: # Configure mise only if you're actually loading
  # config var                        	  value             	  |default|alt_cmd¦ comment
  envx['XONTRIB_MISE_CHUNK_LIST']     	= ['.tool-versions']	# |['.tool-versions']|False¦ (feeble attempts to track edits to `.tool-versions` in the command line) update mise status if command contains any of the string chunks in this list; False to disable this listener completely
  envx['XONTRIB_MISE_NEWLINE_REFRESH']	= True              	# |True|False¦ update mise 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_MISE_FORCE_COLOR']    	= True              	# |True|False¦ preserve colored mise output
  envx['XONTRIB_MISE_LOGLEVEL']       	= 1                 	# |1|0¦ print xontrib log messages: 0 none, 1 error; 'mise' stderr is always passed through
# (old variables with _RTX_ in the name continue to work)
xontribs_load(xontribs) # actually load all xontribs in the list
  1. Or just add this to your xonsh run control file
xontrib load mise # Initializes mise (polyglot asdf-like runtime manager)
# configure like in the example above, but replace envx['VAR'] with $VAR
$XONTRIB_MISE_LOGLEVEL = 1

Known issues

  • In the future xontrib-mise will be autoloaded, but this is currently blocked due to a xonsh bug: too early autoload prevents 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_mise-0.0.6.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

xontrib_mise-0.0.6-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file xontrib_mise-0.0.6.tar.gz.

File metadata

  • Download URL: xontrib_mise-0.0.6.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for xontrib_mise-0.0.6.tar.gz
Algorithm Hash digest
SHA256 073fdebf3d33c2034b397f2917426614a4a771caad04c41491670088e6eaf5aa
MD5 4c0ab720ffa9614c0fb1ab6e38fb6441
BLAKE2b-256 80b2f97c4706535d31d26d8b075ed95eef51c1af71200a34162aa7d8fdf87b1b

See more details on using hashes here.

File details

Details for the file xontrib_mise-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: xontrib_mise-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for xontrib_mise-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b646b43f348fc27535d11886e614352f46a6e29bcbd97065ad897f383b1172f8
MD5 25af1baa28a601c7e2cccae4a110c168
BLAKE2b-256 f884719012a8f08cdad9ba4340aa16b1b7eeb3d2556d761264a677ee4c7ddff9

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