[Python-ideas] Interest in seeing sh.py in the stdlib

Antoine Pitrou solipsis at pitrou.net
Sun Oct 21 12:18:20 CEST 2012


On Sat, 20 Oct 2012 21:02:58 -0400
Mike Graham <mikegraham at gmail.com> wrote:
> On Sat, Oct 20, 2012 at 8:33 PM, Andrew Moffat
> <andrew.robert.moffat at gmail.com> wrote:
> > Hi,
> >
> > I'm the author of sh.py, an intuitive interface for launching subprocesses
> > in Linux and OSX http://amoffat.github.com/sh/.  It has been maintained on
> > github https://github.com/amoffat/sh for about 10 months and currently has
> > about 25k installs, according to pythonpackages.com
> > (http://pythonpackages.com/package/sh,
> > http://pythonpackages.com/package/pbs)
> >
> > Andy Grover maintains the Fedora rpm for sh.py
> > http://arm.koji.fedoraproject.org/koji/buildinfo?buildID=94247  and Nick
> > Moffit has submitted an older version of sh.py (which was called pbs) to be
> > included in Debian distros
> > http://pkgs.org/debian-wheezy/debian-main-i386/python-pbs_0.95-1_all.deb.html
> >
> > I'm interested in making sh.py more accessible to help bring Python forward
> > in the area of shell scripting, so I'm interested in seeing if sh would be
> > suitable for the standard library.  Is there any other interest in something
> > like this?
> >
> > Thanks
> 
> sh.py strikes me as on the clever side for the stdlib and the lack of
> Windows support would be very unfortunate for a stdlib module (I don't
> know if this is relatively easily fixed, though it seems possible)

Ditto for me. The basic concept of the sh module looks like some fancy
wrapper around subprocess.check_output:

http://docs.python.org/dev/library/subprocess.html#subprocess.check_output

The "easy chaining of subprocesses" part does not look that useful to
me, or at least the examples aren't very convincing. If I want to sort
the results of a shell command, it makes much more sense to me to do so
using Python's text processing and sorting capabilities, than trying to
find the right invocation of Unix "sort" and other utilities.

That said, I do find the "fancy wrapper" part somewhat pretty.

Regards

Antoine.





More information about the Python-ideas mailing list