This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
Extern
=================

Extern is an opinionated version of Python's `subprocess`, making it just that little
bit more convenient to run shell commands from within Python code.

It is reasonably straightforward:
```
>>> import extern
>>> extern.run("echo it works") #=> returns 'it works\n'
>>> extern.run("echo 1 2 5 |cat") #=> returns '1 2 5\n'
```
When a command that fails is run e.g.
```
>>> extern.run("cat /not_a_file")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.linux-x86_64/egg/extern/__init__.py", line 29, in run
extern.ExternCalledProcessError: Command cat /not_a_file returned non-zero exit status 1.
STDERR was: cat: /not_a_file: No such file or directory
STDOUT was:
```
an exception is raised just like `subprocess`. However, the error message
generated includes STDERR and STDOUT, which is more convenient for debugging. For reference, the `subprocess` equivalent:
```
>>> subprocess.check_output(['bash','-c','cat /not_a_file'])
cat: /not_a_file: No such file or directory
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['bash', '-c', 'cat /not_a_file']' returned non-zero exit status 1
```
The useful thing is that `Extern` collects STDERR and only reports it when there is a non-zero exit status, discarding it otherwise.

**IMPORTANT**: use of this library with untrusted strings presents a security risk in the same way as [little bobby tables](http://xkcd.com/327/) and [shell=True](https://docs.python.org/2/library/subprocess.html#frequently-used-arguments) in `subprocess`.

Multiple commands
```
>>> extern.run_many(['echo once','echo twice','echo thrice'])
#=> ['once\n'','twice\n','thrice\n']
```
Progress can also be observed:
```
>>> extern.run_many(['echo once','echo twice','echo thrice'], progress_stream=sys.stderr)
Finished processing 3 of 3 (100.00%) items.
#=> ['once\n'','twice\n','thrice\n']
```

There is also a `which` function, useful for determing where (and if) a program
exists on the command line:
```
>>> import extern
>>> extern.which('cat') #=> '/bin/cat'
>>> extern.which('dog') #=> None
```


Installation
--------------
You can also install it directly from the Python Package Index with this command:
```
sudo pip install extern
```

Licence
--------
See file LICENCE.txt in this folder

Contribute
-----------
Extern is an open-source software. Everyone is welcome to contribute !
Release History

Release History

0.1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
extern-0.1.0.tar.gz (8.3 kB) Copy SHA256 Checksum SHA256 Source Aug 10, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting