Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:ANN': 0.02; 'subject:module': 0.04; 'library,': 0.05; 'memory.': 0.05; 'url:bitbucket': 0.07; 'python': 0.08; 'buffers': 0.09; 'foo': 0.09; 'subject:library': 0.09; 'subprocess': 0.09; 'api': 0.09; 'output': 0.10; 'library': 0.13; 'useful,': 0.13; 'tries': 0.15; '&&,': 0.16; '2.6,': 0.16; 'bitbucket': 0.16; 'buffering': 0.16; 'parsed': 0.16; 'pipelines': 0.16; 'released.': 0.16; 'sajip': 0.16; 'sharing,': 0.16; 'shells': 0.16; 'stderr': 0.16; 'subject: \n ': 0.16; 'subject:subprocess': 0.16; 'subset': 0.16; 'vinay': 0.16; '||,': 0.16; 'syntax': 0.16; 'wrote:': 0.18; '>>>': 0.18; '3.2': 0.18; 'arguments': 0.18; 'possibly': 0.19; 'linux,': 0.21; 'tracker': 0.21; 'header:In-Reply-To:1': 0.22; 'versions': 0.23; 'module,': 0.23; "one's": 0.23; 'command': 0.24; 'shell': 0.24; 'windows': 0.26; 'module': 0.26; 'up.': 0.26; 'there.': 0.27; 'import': 0.27; 'compared': 0.28; "i'm": 0.28; 'lines': 0.30; 'syntax,': 0.30; 'threads.': 0.30; 'wraps': 0.30; 'version': 0.32; 'capture': 0.32; 'filled': 0.32; 'thanks': 0.32; 'does': 0.32; 'hosted': 0.32; "can't": 0.33; 'header:User-Agent:1': 0.33; 'object': 0.33; 'hi,': 0.34; 'sometimes,': 0.34; '(not': 0.35; 'to:addr:python-list': 0.35; '...': 0.35; 'project': 0.35; 'external': 0.35; 'install': 0.35; 'issue': 0.37; 'example,': 0.37; 'desirable': 0.37; 'do?': 0.37; 'platforms,': 0.37; 'variables': 0.37; 'run': 0.37; 'but': 0.37; 'using': 0.37; 'skip:- 40': 0.38; 'enough': 0.38; 'allows': 0.38; 'some': 0.38; 'format': 0.38; 'problems': 0.38; 'easier': 0.38; 'correctly': 0.39; 'url:org': 0.39; 'that.': 0.39; 'expected': 0.40; 'put': 0.40; 'to:addr:python.org': 0.40; 'more': 0.61; 'simple': 0.61; 'your': 0.61; 'hope': 0.61; 'offers': 0.62; 'integrated': 0.63; 'information,': 0.69; 'features:': 0.73; 'advantages': 0.80; '3.1,': 0.84; 'injection': 0.84; 'streams': 0.84; 'useful!': 0.84; '3.3': 0.91; 'alone.': 0.93 X-IronPort-AV: E=Sophos;i="4.73,438,1325458800"; d="scan'208";a="169196" X-Virus-Scanned: amavisd-new at zimbra.sequans.com Date: Fri, 17 Feb 2012 14:49:37 +0100 From: Jean-Michel Pichavant User-Agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100328) MIME-Version: 1.0 To: python-list@python.org Subject: Re: ANN: Sarge, a library wrapping the subprocess module, has been released. References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 96 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1329486648 news.xs4all.nl 6955 [2001:888:2000:d::a6]:44179 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20554 Vinay Sajip wrote: > Sarge, a cross-platform library which wraps the subprocess module in > the standard library, has been released. > > What does it 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 > Hi, Thanks for sharing, I hope this one will be as successful as the logging module, possibly integrated into a next version of subprocess. I can't use it though, I'm still using a vintage 2.5 version :-/ JM