Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-announce@python.org Delivered-To: python-announce-list@mail.python.org X-Spam-Status: OK 0.002 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; 'from:addr:vinay_sajip': 0.16; 'parsed': 0.16; 'pipelines': 0.16; 'released.': 0.16; 'sajip': 0.16; 'shells': 0.16; 'stderr': 0.16; 'subject:subprocess': 0.16; 'subset': 0.16; 'vinay': 0.16; '||,': 0.16; 'syntax': 0.16; '>>>': 0.18; '3.2': 0.18; 'arguments': 0.18; 'linux,': 0.21; 'tracker': 0.21; 'versions': 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; 'lines': 0.30; 'syntax,': 0.30; 'threads.': 0.30; 'wraps': 0.30; 'version': 0.32; 'capture': 0.32; 'filled': 0.32; 'does': 0.32; 'hosted': 0.32; 'header:User-Agent:1': 0.33; 'object': 0.33; 'header:X-Complaints-To:1': 0.34; 'from:addr:yahoo.co.uk': 0.34; 'header:Received:8': 0.34; 'sometimes,': 0.34; '(not': 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; 'received:google.com': 0.37; 'using': 0.37; 'skip:- 40': 0.38; 'received:209.85': 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; 'received:209': 0.39; 'expected': 0.40; 'put': 0.40; 'received:prod.google.com': 0.40; 'received:10.192': 0.40; 'more': 0.61; 'simple': 0.61; 'your': 0.61; 'hope': 0.61; 'offers': 0.62; 'received:130': 0.68; 'information,': 0.69; 'features:': 0.73; 'to:addr:moderators.isc.org': 0.73; 'received:130.133': 0.73; 'received:130.133.4': 0.73; 'received:130.133.4.7': 0.73; 'received:individual.net': 0.73; 'received:moderators.individual.net': 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-Authentication-Warning: yws13.prod.google.com: news set sender to news@google.com using -f To: comp-lang-python-announce@moderators.isc.org From: Vinay Sajip Newsgroups: comp.lang.python,comp.lang.python.announce Subject: ANN: Sarge, a library wrapping the subprocess module, has been released. Date: Fri, 10 Feb 2012 11:28:52 -0800 (PST) Organization: http://groups.google.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Complaints-To: groups-abuse@google.com Injection-Info: t15g2000yqi.googlegroups.com; posting-host=82.152.15.113; posting-account=3PSTgxAAAACRZBfTFqcrp20l4rsi4Aaz User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALENKRC X-HTTP-UserAgent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0,gzip(gfe) X-Gm-Message-State: ALoCoQk5F7Kb2rGituNR4LXKC3RuicyaJ6W+oF+/Lw4Bh1NQkuZJNdQbWrp+1XuP3Rp832FMjwAL8FpM+TdsE466lRQY212rvYlR4qHKn5+NxJ8dETCr/6pM7jSAQYLFczAa3FKzMpIfNQmdL3PCCq6EUSkfD0KPJJ+4H38fH3g1QWPlOnSajsU= X-Mailman-Approved-At: Sat, 11 Feb 2012 16:31:36 +0100 X-BeenThere: python-announce-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: python-list@python.org List-Id: Announcement-only list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Approved: python-announce-list@python.org Message-ID: Lines: 87 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1328974297 news.xs4all.nl 6849 [2001:888:2000:d::a6]:41257 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20222 comp.lang.python.announce:509 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