Skip to main content

A library for running shell pipelines using shell-like syntax

Project description

This is an alpha release. The library may be changed completely or even may be thrown away. Comments are welcome.

Facts

  • Enables piping infinite streams through shell pipelines in Python
  • Uses standard modules subprocess, threading
  • Allows doing things marked as red warning boxes at the subprocess help page
  • 0.2 KLOC, tests included

Basic Usage

Pipe 100 000 lines through wc -l and join the resulting iterable into a single string:

>>> from iterpipes import pipe, runpipe
>>> wc = pipe('wc -l')
>>> ''.join(wc('%d\n' % i for i in xrange(100000)))
'100000\n'

Total lines in *.py files under the directory /path/to/dir, use safe shell parameters formatting:

>>> g = runpipe(
...     'find {} -name {} -print0 | xargs -0 wc -l | tail -1 | awk {}',
...     '/path/to/dir', '\*.py', '{print $1}'))
>>> ''.join(g)
'147\n'

Download

This is not really a release. Clone the iterpipes repository if you are interested in following the library.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for iterpipes, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size iterpipes-0.1.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page