Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python.announce > #971

ANN: Version 0.1.1 of sarge (a subprocess wrapper library) has been released.

Path csiph.com!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <news@google.com>
X-Original-To python-announce@python.org
Delivered-To python-announce-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'patterns': 0.04; 'syntax': 0.04; 'output': 0.05; 'url:bitbucket': 0.05; 'linux,': 0.07; 'memory.': 0.07; 'subject:ANN': 0.07; 'tries': 0.07; 'variables': 0.07; 'arguments': 0.09; 'parsed': 0.09; 'subset': 0.09; 'windows,': 0.09; 'wrapped': 0.09; 'api': 0.11; 'python': 0.11; 'useful,': 0.14; 'windows': 0.15; '0.1.1': 0.16; 'bitbucket': 0.16; 'pipelines': 0.16; 'quoted': 0.16; 'safely.': 0.16; 'simple.': 0.16; 'stderr': 0.16; 'streams.': 0.16; 'subject:library': 0.16; 'syntax,': 0.16; 'threads.': 0.16; 'wraps': 0.16; 'prevent': 0.16; '(not': 0.18; 'library': 0.18; 'module': 0.19; 'command': 0.22; '>>>': 0.22; 'import': 0.22; 'shell': 0.22; 'tests': 0.22; 'install': 0.23; 'header:User-Agent:1': 0.23; 'library,': 0.24; 'unicode': 0.24; 'versions': 0.24; 'tracker': 0.26; 'fixed': 0.29; 'skip:- 40': 0.29; 'external': 0.29; 'leave': 0.29; 'subject:) ': 0.29; 'compared': 0.30; 'gives': 0.31; 'easier': 0.31; 'lines': 0.31; 'that.': 0.31; '3.2': 0.31; 'convenience': 0.31; 'exceptions': 0.31; 'pipe': 0.31; 'post.': 0.31; 'allows': 0.31; 'there.': 0.32; 'run': 0.32; 'up.': 0.33; 'mac': 0.33; 'style': 0.33; 'subject: (': 0.35; 'received:209.85': 0.35; 'skip:s 30': 0.35; 'operate': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'version': 0.36; '2.6': 0.36; 'leads': 0.36; 'url:org': 0.36; 'example,': 0.37; 'skip:- 20': 0.37; 'project': 0.37; 'received:209': 0.37; 'expected': 0.38; 'feedback': 0.38; 'problems': 0.38; 'desirable': 0.38; 'filled': 0.38; 'requiring': 0.38; 'rich': 0.38; 'issue': 0.38; 'skip:- 10': 0.38; 'ability': 0.39; 'does': 0.39; 'hosted': 0.39; 'quote': 0.39; 'reported': 0.39; 'enough': 0.39; 'read': 0.60; 'commands': 0.60; 'improved': 0.60; 'hope': 0.61; 'entire': 0.61; 'information,': 0.61; 'simple': 0.61; 'such': 0.63; 'more': 0.64; 'occur': 0.65; 'advantages': 0.68; 'to:addr:comp-lang-python-announce': 0.70; 'to:addr:moderators.isc.org': 0.77; 'alone.': 0.84; 'attacks.': 0.84; 'cygwin': 0.84; 'features:': 0.84; 'streams': 0.84; 'useful!': 0.84; 'capture': 0.91; 'numerous': 0.93
Delivered-To comp-lang-python-announce@moderators.isc.org
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=path:newsgroups:date:complaints-to:injection-info:nntp-posting-host :user-agent:mime-version:message-id:subject:from:injection-date:to :content-type; bh=g0xMugDbJOeT+xTTkSqPKxUiPvmIrz9xu4U1SOLOv4E=; b=EJ8+XJE5TyRfTh051EwYPePbT/eJBFHRyO9PcVP4zrKrX1Zs7I84gdMB7e5qISmPh4 5N4Zygc3CnOlfYHk8C6K6q2QvsnqETjxtPmDxDVHftTSLVQA946Qtgk7zfQv1PrM+mLR Q7RmsJVELaQBTHIcQWnUb/O4/Xl5QU+cp2aq7VkdyBUnJbY2Q+nIcKZPLISErOzdBLmA /bbcvU4+xRI2IMMwDF67qCaCGZMLgkk6SqWhfZgpu+SMwoWlQOGKG2sfzNTS8So9p24N 7Sstrb9FmdBmlySF8PuyWneSn5nra3LbbqfpD9cneXwwDG6DOzaIXo6Zy4jTxb6vXLF8 K0/w==
X-Received by 10.224.205.138 with SMTP id fq10mr16320028qab.1.1370347607971; Tue, 04 Jun 2013 05:06:47 -0700 (PDT)
X-Received by 10.49.104.8 with SMTP id ga8mr1412619qeb.18.1370347607886; Tue, 04 Jun 2013 05:06:47 -0700 (PDT)
Newsgroups comp.lang.python.announce
Date Tue, 4 Jun 2013 05:06:47 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=82.152.15.113; posting-account=3PSTgxAAAACRZBfTFqcrp20l4rsi4Aaz
User-Agent G2/1.0
MIME-Version 1.0
Subject ANN: Version 0.1.1 of sarge (a subprocess wrapper library) has been released.
From Vinay Sajip <vinay_sajip@yahoo.co.uk>
Injection-Date Tue, 04 Jun 2013 12:06:47 +0000
To comp-lang-python-announce@moderators.isc.org
Content-Type text/plain; charset=ISO-8859-1
X-Mailman-Approved-At Wed, 05 Jun 2013 13:38:32 +0200
X-BeenThere python-announce-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To python-list@python.org
List-Id Announcement-only list for the Python programming language <python-announce-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-announce-list/>
List-Post <mailto:python-announce-list@python.org>
List-Help <mailto:python-announce-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=subscribe>
Approved python-announce-list@python.org
Message-ID <mailman.2724.1370432315.3114.python-announce-list@python.org> (permalink)
Lines 108
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1370432315 news.xs4all.nl 15928 [2001:888:2000:d::a6]:58403
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python.announce:971

Show key headers only | View raw


Version 0.1.1 of Sarge, a cross-platform library which wraps the subprocess
module in the standard library, has been released.

What changed?
-------------

- Added the ability to scan for specific patterns in subprocess output streams.

- Added convenience methods to operate on wrapped subprocesses.

- Exceptions which occur while spawning subprocesses are now propagated.

- Fixed issues #2, #3, and #4.

- Improved shell_shlex resilience with Unicode on 2.x.

- Added get_stdout, get_stderr and get_both for when subprocess output is not
  expected to be voluminous.

- Added an internal lock to serialise access to shared data.

- Added tests to cover added functionality and reported issues.

- Added numerous documentation updates.

What does Sarge do?
-------------------

Sarge tries to make interfacing with external programs from your
Python applications easier than just using subprocess alone.

Sarge offers the following features:

* A simple way to run command lines which allows a rich subset of Bash-
style shell command syntax, but parsed and run by sarge so that you
can run on Windows without cygwin (subject to having those commands
available):

    >>> from sarge import capture_stdout
    >>> p = capture_stdout('echo foo | cat; echo bar')
    >>> for line in p.stdout: print(repr(line))
    ...
    'foo\n'
    'bar\n'

* The ability to format shell commands with placeholders, such that
variables are quoted to prevent shell injection attacks.

* The ability to capture output streams without requiring you to
program your own threads. You just use a Capture object and then you
can read from it as and when you want.

Advantages over subprocess
---------------------------

Sarge offers the following benefits compared to using subprocess:

* The API is very simple.

* It's easier to use command pipelines - using subprocess out of the
box often leads to deadlocks because pipe buffers get filled up.

* It would be nice to use Bash-style pipe syntax on Windows, but
Windows shells don't support some of the syntax which is useful, like
&&, ||, |& and so on. Sarge gives you that functionality on Windows,
without cygwin.

* Sometimes, subprocess.Popen.communicate() is not flexible enough for
one's needs - for example, when one needs to process output a line at
a time without buffering the entire output in memory.

* It's desirable to avoid shell injection problems by having the
ability to quote command arguments safely.

* subprocess allows you to let stderr be the same as stdout, but not
the other way around - and sometimes, you need to do that.

Python version and platform compatibility
-----------------------------------------

Sarge is intended to be used on any Python version >= 2.6 and is
tested on Python versions 2.6, 2.7, 3.1, 3.2 and 3.3 on Linux,
Windows, and Mac OS X (not all versions are tested on all platforms,
but sarge is expected to work correctly on all these versions on all
these platforms).

Finding out more
----------------

You can read the documentation at

http://sarge.readthedocs.org/

There's a lot more information, with examples, than I can put into
this post.

You can install Sarge using "pip install sarge" to try it out. The
project is hosted on BitBucket at

https://bitbucket.org/vinay.sajip/sarge/

And you can leave feedback on the issue tracker there.

I hope you find Sarge useful!

Regards,

Vinay Sajip

Back to comp.lang.python.announce | Previous | Next | Find similar | Unroll thread


Thread

ANN: Version 0.1.1 of sarge (a subprocess wrapper library) has been released. Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2013-06-04 05:06 -0700

csiph-web