Skip to main content

An extensible, asyncio interface to subprocesses, plus a set of wrappers around common system tools that works well with yaclipy

Project description

yaclipy-tools

An extensible, asyncio interface to subprocesses, plus a set of wrappers around common system tools that works well with yaclipy

Tools

  • curl
  • docker
  • ffmpeg
  • firebase
  • gcloud
  • git
  • gpg
  • graphviz
  • grep
  • kubectl
  • md5
  • nginx
  • openssl
  • shasum

The set of tools can easily be extended by subclassing SysTool

ProcTask

This creates an asynchronous connection to a sub-process. It is based upon loop.subprocess_exec().

await ProcTask('diff', 'README.md', 'README.md') 0

For more complicated interactions, plugins are used.

await ProcTask.using(Lines(1))('ls', '-al') [...]

The Lines plugin captured stdout (1) and return a list of lines. If no plugins want to return a value then the default behavior is to return the returncode as seen in the above example. If multiple plugins want to return a value then they are returned as a tuple:

await ProcTask.using(Lines, Lines(2))('ls', '-al') ([...], [...])

The first value of the tuple contains the lines from stdout AND stderr, whereas the second list only contains stderr lines.

Echo

The Echo plugin prints to the print_ext Printer(). By setting the context you can create nice, grouped command output.

Lines

Capture the output and return a list of strings

OneLine

Capture the output but only return one of the lines

Input

Send data to stdin of the process

Log

Capture the output and send it to a file (or other io.Stream)

Watch

Ask for the output to be captured so that you can use it asynchronously.

SysTool

SysTool build upon ProcTask by integrating it with yaclipy and adding more user-facing features, such as:

  • configurable command location (no more environment variables)
  • Tool availability and version check.
  • Helpful info about how to install missing tools.

PyPI - Version PyPI - Python Version


Table of Contents

Installation

pip install yaclipy-tools

License

yaclipy-tools is distributed under the terms of the MIT license.

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

yaclipy_tools-0.10.1.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

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

yaclipy_tools-0.10.1-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

Details for the file yaclipy_tools-0.10.1.tar.gz.

File metadata

  • Download URL: yaclipy_tools-0.10.1.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.0

File hashes

Hashes for yaclipy_tools-0.10.1.tar.gz
Algorithm Hash digest
SHA256 93ab90cce22d0f35a09632b568c40b8631ac999f7a847618f93b16fbbf8e77f7
MD5 be30d89043a66f2fe8dda2b74f84e79d
BLAKE2b-256 e94d087163f37a42d18c4d93464c528258e5b49458161ec93ff8865c7e92d808

See more details on using hashes here.

File details

Details for the file yaclipy_tools-0.10.1-py3-none-any.whl.

File metadata

File hashes

Hashes for yaclipy_tools-0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5ced6fd76bb772e8c0f5ff41648b4baf4b899c6ffec4f47eb9668cc55350c62b
MD5 c412b9623a0594ab011189e545497114
BLAKE2b-256 253dbc4450d9dcdaf900b4f9931ee3bff21b4301cd96f9f94a74d2e1b122f5da

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