xontrib-rtx


Namexontrib-rtx JSON
Version 0.0.1 PyPI version JSON
download
home_pagehttps://github.com/eugenesvk/xontrib-rtx
SummaryInitializes rtx (polyglot asdf-like runtime manager)
upload_time2023-02-07 11:01:43
maintainer
docs_urlNone
authorEvgeny
requires_python>=3.8
licenseMIT
keywords xontrib xonsh
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
Initialize <a href="https://github.com/jdxcode/rtx" target="_blank">rtx</a> (polyglot asdf-like runtime manager in Rust)</br>
in a more performant and flexible way
</p>

<p align="center">  
If you like the idea click ⭐ on the repo and <a href="https://twitter.com/intent/tweet?text=Nice%20xontrib%20for%20the%20xonsh%20shell!&url=https://github.com/eugenesvk/xontrib-rtx" target="_blank">tweet</a>.
</p>

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</br>
      useful to refresh shell status when you edit `.tool-versions` _outside_ of shell (optional)
    - commands that containt custom text chunks</br>
      useful to refresh shell status when you edit `.tool-versions`  _in_ a shell (optional)

## Installation

To install use pip:

```bash
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`):
```py
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
```

2. Or just add this to your xonsh run control file
```xsh
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](https://github.com/xonsh/xonsh/issues/5020): too early autoload prevens reading user config; also, autoloading can't be disabled

## Credits

This package was created with [xontrib template](https://github.com/xonsh/xontrib-template)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/eugenesvk/xontrib-rtx",
    "name": "xontrib-rtx",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "xontrib,xonsh",
    "author": "Evgeny",
    "author_email": "es.bugzilla@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/37/b7/208cfa06046ad735591336dd0784af7b33f186e450cc3dd1fa6f29768908/xontrib_rtx-0.0.1.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\nInitialize <a href=\"https://github.com/jdxcode/rtx\" target=\"_blank\">rtx</a> (polyglot asdf-like runtime manager in Rust)</br>\nin a more performant and flexible way\n</p>\n\n<p align=\"center\">  \nIf you like the idea click \u2b50 on the repo and <a href=\"https://twitter.com/intent/tweet?text=Nice%20xontrib%20for%20the%20xonsh%20shell!&url=https://github.com/eugenesvk/xontrib-rtx\" target=\"_blank\">tweet</a>.\n</p>\n\nThis xontrib adds a couple of (maybe too tiny to notice) improvements:\n\n  - (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`)\n  - (less convenient) replaces a hook on every prompt paint with hooks on\n    - shell launch\n    - changing dirs\n    - empty commands</br>\n      useful to refresh shell status when you edit `.tool-versions` _outside_ of shell (optional)\n    - commands that containt custom text chunks</br>\n      useful to refresh shell status when you edit `.tool-versions`  _in_ a shell (optional)\n\n## Installation\n\nTo install use pip:\n\n```bash\nxpip install xontrib-rtx\n# or: xpip install -U git+https://github.com/eugenesvk/xontrib-rtx\n```\n\n## Usage\n\nThis 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`\n\n1. Add the following to your `.py` xontrib loading config and `import` it in your xonsh run control file (`~/.xonshrc` or `~/.config/rc.xsh`):\n```py\nfrom xonsh.xontribs \timport xontribs_load\nfrom xonsh.built_ins\timport XSH\nenvx = XSH.env\n\nxontribs = [ \"rtx\", # Initializes rtx (polyglot asdf-like runtime manager)\n # your other xontribs\n]\n# \u2193 optional configuration variables\nif 'rtx' in xontribs: # Configure rtx only if you're actually loading\n  # config var                       \t  value             \t  |default|alt_cmd\u00a6 comment\n  envx['XONTRIB_RTX_CHUNK_LIST']     \t= ['.tool-versions']\t# |['.tool-versions']|False\u00a6 (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\n  envx['XONTRIB_RTX_NEWLINE_REFRESH']\t= True              \t# |True|False\u00a6 update rtx status if command is empty (e.g, \u23ce on a blank line to refresh after editing `.tool-versions` in a text editor); False to disable this listener completely\n  envx['XONTRIB_RTX_FORCE_COLOR']    \t= True              \t# |True|False\u00a6 preserve colored rtx output\n  envx['XONTRIB_RTX_LOGLEVEL']       \t= 1                 \t# |1|0\u00a6 print xontrib log messages: 0 none, 1 error; 'rtx' stderr is always passed through\n\nxontribs_load(xontribs_manual) # actually load all xontribs in the list\n```\n\n2. Or just add this to your xonsh run control file\n```xsh\nxontrib load rtx # Initializes rtx (polyglot asdf-like runtime manager)\n# configure like in the example above, but replace envx['VAR'] with $VAR\n$XONTRIB_RTX_LOGLEVEL = 1\n```\n\n## Known issues\n\n- In the future xontrib-rtx will be autoloaded, but this is currently blocked due to a [xonsh bug](https://github.com/xonsh/xonsh/issues/5020): too early autoload prevens reading user config; also, autoloading can't be disabled\n\n## Credits\n\nThis package was created with [xontrib template](https://github.com/xonsh/xontrib-template)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Initializes rtx (polyglot asdf-like runtime manager)",
    "version": "0.0.1",
    "split_keywords": [
        "xontrib",
        "xonsh"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ec1ee9f7b2c3811445b2d23c890d5f18c077442cf7fd6ed5aebb175774341d4e",
                "md5": "4c9ecaabfeab4ff5d49423c4a13caef1",
                "sha256": "337e5c5c65b20df15ea92dffa7485da5f4b5f88e58b1dbc402104c9117308a96"
            },
            "downloads": -1,
            "filename": "xontrib_rtx-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4c9ecaabfeab4ff5d49423c4a13caef1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5131,
            "upload_time": "2023-02-07T11:01:41",
            "upload_time_iso_8601": "2023-02-07T11:01:41.424771Z",
            "url": "https://files.pythonhosted.org/packages/ec/1e/e9f7b2c3811445b2d23c890d5f18c077442cf7fd6ed5aebb175774341d4e/xontrib_rtx-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "37b7208cfa06046ad735591336dd0784af7b33f186e450cc3dd1fa6f29768908",
                "md5": "e354381a9168834b5da20a3a361ddb56",
                "sha256": "fbadd593b0c9e81b6030cc05e5a0830af690fae175a007bd15ad61c8010fe6b5"
            },
            "downloads": -1,
            "filename": "xontrib_rtx-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e354381a9168834b5da20a3a361ddb56",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 5377,
            "upload_time": "2023-02-07T11:01:43",
            "upload_time_iso_8601": "2023-02-07T11:01:43.869213Z",
            "url": "https://files.pythonhosted.org/packages/37/b7/208cfa06046ad735591336dd0784af7b33f186e450cc3dd1fa6f29768908/xontrib_rtx-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-07 11:01:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "eugenesvk",
    "github_project": "xontrib-rtx",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "xontrib-rtx"
}
        
Elapsed time: 0.11131s