Shell helper utilities for python
Project description
gripe | |
Shell-util library for python. Includes helpers for subprocess invocation, shell-formatters / pretty-printers, and more. |
Overview
The gripe
library provides various shell-utilities for python.
Features
Shell-formatters / pretty-printers
- A somewhat usable parser / grammar for bash
- Console support for rich & rich protocols
Subprocess Invocation
There's a lot of shell-related libraries out there, especially for invocation (see for example this list).
The interface for gripe
is hopefully unsurprising, and something that's convenient but not fancy. It's a utility, and not a huge framework.
The main goal is to provide an API that is simple and stable, without a ton of dependencies.
>>> import gripe
>>> proc = gripe.invoke('echo hello world')
>>> assert proc.succeeded
>>> assert proc.stdout.strip()=='hello world'
>>>
Beyond such basics, gripe includes support for rich output and uses pydantic for datastructures.
See the API docs for more detailed information.
Installation
See pypi for available releases.
$ pip install gripe
Usage (CLI)
The gripe library publishes a small CLI tool, mostly just for testing & demoing the API behaviour. See the CLI docs for the latest (autogenerated) help.
Usage (API)
See also:
- the unit-tests for some examples of library usage
- the smoke-tests for example usage of stand-alone scripts
OOP-style Dispatch
This uses gripe.Invocation
and returns gripe.InvocationResponse
.
>>> import gripe
Loading data when command-output is JSON
>>> import gripe
>>>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for gripe-2024.2.12.22.43-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7d1cf95b0a933873ba542d9cf96cc016f8a8f280b6c1db540d2b0967171c411 |
|
MD5 | 7c135e60fb94fee25f7f1c3255daf860 |
|
BLAKE2b-256 | 34ca13a77ee03b6d8c89f845c7108a780e13d9f7abad2a9aa6293902a26abb9b |