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

2013-06-05 Thread Vinay Sajip
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
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Eventlet 0.13 is going to have minor incompatible change in subprocess API

2013-06-05 Thread Sergey Shepelev
Hello.

I'm trying to reach out for as many Eventlet users as possible. This message 
contains specific actions to be taken by project owners to ensure compatibility 
with future versions of eventlet.

1. We're going to have a minor backward incompatible change. It will *only* 
affect you if you use Eventlet specific `check_interval` positional argument, 
e.g. subprocess.Popen(...).wait(0.1). Which is very unlikely, but I have to 
make sure. Checking will take less than minute best case.

2. Please run the following search against your code base:

grep -lr -E 'import.+subprocess' . |xargs grep -nE '\.wait\([^)]' |fgrep -v 
'check_interval='

3. If you have any results on step 3, please check that either you imported 
subprocess from eventlet.green or used monkey_patch and matched lines 
correspond to eventlet.green.subprocess.Popen objects

4. If you have any results on step 4, that is, you pass check_interval as first 
positional argument to .wait() method of Popen object, please change it to 
keyword argument `check_interval=...`

5. Please, spread this message to your coworkers, friends or other people who 
uses Eventlet in their projects.

Thank you very much.


If you are curious what's going on, here's the full story:
Python 3.3 introduced `timeout` kwarg to lots of methods of subprocess module. 
The RHEL guys backported it to their Python 2.6 package. At some point, the 
code they used started to use subprocess from Eventlet which does not have the 
`timeout` kwarg.
https://bitbucket.org/eventlet/eventlet/issue/89
https://bitbucket.org/eventlet/eventlet/pull-request/30
Now in Eventlet, I am going to introduce the `timeout` argument and to make it 
forward compatible with Python3, it's going to get first place, like in stdlib.
To interested people, you may leave a comment in this discussion or in this 
Github thread: https://github.com/eventlet/eventlet/pull/34
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


ANN: A new version (0.3.4) of the Python module which wraps GnuPG has been released.

2013-06-05 Thread Vinay Sajip
A new version of the Python module which wraps GnuPG has been released.

What Changed?
=
This is a minor enhancement and bug-fix release. See the project website ( 
http://code.google.com/p/python-gnupg/ ) for more information. Summary:

An encoding bug which caused an exception when getting the GPG version has been 
fixed.
Recipients can be passed in a set or frozenset as well as in a list or tuple.
The keyring argument now accepts a list of public keyring filenames as well as 
a single filename.
A secret_keyring argument has been added which accepts either a single filename 
or a list of filenames for secret keyrings.

The current version passes all tests on Windows (CPython 2.4, 2.5, 2.6, 2.7, 
3.1 and Jython 2.5.1), Mac OS X (Python 2.5) and Ubuntu (CPython 2.4, 2.5, 2.6, 
2.7, 3.0, 3.1, 3.2). On Windows, GnuPG 1.4.11 has been used for the tests.

What Does It Do?

The gnupg module allows Python programs to make use of the functionality 
provided by the Gnu Privacy Guard (abbreviated GPG or GnuPG). Using this 
module, Python programs can encrypt and decrypt data, digitally sign documents 
and verify digital signatures, manage (generate, list and delete) encryption 
keys, using proven Public Key Infrastructure (PKI) encryption technology based 
on OpenPGP.

This module is expected to be used with Python versions = 2.4, as it makes use 
of the subprocess module which appeared in that version of Python. This module 
is a newer version derived from earlier work by Andrew Kuchling, Richard Jones 
and Steve Traugott.

A test suite using unittest is included with the source distribution.

Simple usage:

 import gnupg
 gpg = gnupg.GPG(gnupghome='/path/to/keyring/directory')
 gpg.list_keys()
[{
  ...
  'fingerprint': 'F819EE7705497D73E3CCEE65197D5DAC68F1AAB2',
  'keyid': '197D5DAC68F1AAB2',
  'length': '1024',
  'type': 'pub',
  'uids': ['', 'Gary Gross (A test user) gary.gr...@gamma.com']},
 {
  ...
  'fingerprint': '37F24DD4B918CC264D4F31D60C5FEFA7A921FC4A',
  'keyid': '0C5FEFA7A921FC4A',
  'length': '1024',
  ...
  'uids': ['', 'Danny Davis (A test user) danny.da...@delta.com']}]
 encrypted = gpg.encrypt(Hello, world!, ['0C5FEFA7A921FC4A'])
 str(encrypted)
'-BEGIN PGP MESSAGE-\nVersion: GnuPG v1.4.9 
(GNU/Linux)\n\nhQIOA/6NHMDTXUwcEAf
...
-END PGP MESSAGE-\n'
 decrypted = gpg.decrypt(str(encrypted), passphrase='secret')
 str(decrypted)
'Hello, world!'
 signed = gpg.sign(Goodbye, world!, passphrase='secret')
 verified = gpg.verify(str(signed))
 print Verified if verified else Not verified
'Verified'

For more information, visit http://code.google.com/p/python-gnupg/ - as always, 
your feedback is most welcome (especially bug reports, patches and suggestions 
for improvement). Enjoy!

Cheers

Vinay Sajip
Red Dove Consultants Ltd.
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/