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.
Source Distribution
File details
Details for the file iterpipes-0.1.tar.gz
.
File metadata
- Download URL: iterpipes-0.1.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 772577ca95692c70947093b86e49576f68e2b3d8f82c75c4dd7ffdc322ff08e0 |
|
MD5 | 65f7e29bd51bf3dbcc06ab9da2cb7fb5 |
|
BLAKE2b-256 | f313c4f98617742471ec9b9774b1d4be5190aa8292f77b642e32f97f8fa650cc |