Skip to main content

Library of xonsh subprocess specification modifiers.

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

Installation

To install use pip:

xpip install xontrib-spec-mod
xpip install 'xontrib-spec-mod[dict,yaml]'  # Extra decorators.

Load:

xontrib load spec_mod

Usage

Transform output to object

Default decorators:

  • @lines - return list of lines.
  • @json - json to Python dict.
  • @path - string to pathlib.Path.

Extra decorators:

xpip install 'xontrib-spec-mod[dict,yaml]'
  • @dict - dict-like object (json, JavaScript object, Python dict) to Python dict.
  • @yaml - YAML to Python dict.

Examples

$(@lines ls /)
# ['/bin', '/etc', '/home']

$(@json echo '{"a":1}')  # Try with `curl` ;)
# dict({"a":1})

docker inspect @($(@json docker ps --format json)['ID'])
# Container info

$(@path which xonsh)
# Path('/path/to/xonsh')

$(@path which xonsh).parent
# Path('/path/to')


aliases['ydig'] = '@yaml dig +yaml'  # Update `dig` via `brew install bind` to have `+yaml`.
y = $(ydig google.com)
y[0]['type']
# 'MESSAGE'

Error handling

Default decorators:

  • @err - set $RAISE_SUBPROC_ERROR=True for the command.
  • @noerr - set $RAISE_SUBPROC_ERROR=False for the command.

Examples:

$RAISE_SUBPROC_ERROR = True  # General environment.
if ![@noerr ls nononofile]:  # Do not raise exception in case of error.
    echo file 

Credits

This package was created with xontrib template.

Metadata

Release files for xontrib-spec-mod 0.0.5

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

Source distribution (sdist)

Source distribution for xontrib-spec-mod 0.0.5
File Size Uploaded Provenance Actions
xontrib_spec_mod-0.0.5.tar.gz 4.7 kB Without provenance Details for xontrib_spec_mod-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xontrib-spec-mod 0.0.5
File Interpreter ABI Platform Actions
xontrib_spec_mod-0.0.5-py3-none-any.whl Python 3 none any Details for xontrib_spec_mod-0.0.5-py3-none-any.whl

Total release size: 9.8 kB

Release files / xontrib_spec_mod-0.0.5.tar.gz

Download URL xontrib_spec_mod-0.0.5.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8a76b3a2433df4c6bc97d35a84d278ab55eba2e42f11970b6929a4e753882b47
BLAKE2b-256 checksum
How to use checksums
85a0d0f9f69fac317ed2643e63a42b4993153054cf4ca30175b1b56de5e1459d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / xontrib_spec_mod-0.0.5-py3-none-any.whl

Download URL xontrib_spec_mod-0.0.5-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2038f4b4217d4f3c634104879ca8b6ae5a7a4068e1b20fd0bf55623f73110601
BLAKE2b-256 checksum
How to use checksums
1a58770d70cd1e5d223425ca07bf9786c08dbf8e21a1f9df897db0bc0b5f8702
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Security for xontrib-spec-mod 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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