Skip to main content

A better way to run shell commands in Python.

Project description

“””A better way to run shell commands in Python.”””

Built because every time I go to use subprocess, I spend more time in the docs & futzing around than actually implementing what I’m trying to get done.

Full docs are at https://shell.readthedocs.org/en/latest/.

Requirements

  • Python 2.6+ or Python 3.3+

Usage

If you just need to quickly run a command, you can use the shell shortcut function:

>>> from shell import shell
>>> ls = shell('ls')
>>> for file in ls.output():
...     print file
'another.txt'

If you need to extend the behavior, you can also use the Shell object:

>>> from shell import Shell
>>> sh = Shell(has_input=True)
>>> cat = sh.run('cat -u')
>>> cat.write('Hello, world!')
>>> cat.output()
['Hello, world!']

You can even chain calls if you’d like:

>>> from shell import shell
>>> shell('cat -u', has_input=True).write('Hello, world!').output()
['Hello, world!']

Installation

Using pip, simply run:

pip install shell

License

New BSD

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shell-1.0.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

shell-1.0.1-py2.py3-none-any.whl (5.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file shell-1.0.1.tar.gz.

File metadata

  • Download URL: shell-1.0.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for shell-1.0.1.tar.gz
Algorithm Hash digest
SHA256 6fbaa88f85de228ddecef33cb1e9037f4959f6f76942b01769e4139a038f6513
MD5 ca7b2c85eb443c907668c8870876e0a6
BLAKE2b-256 710cd6270ed3bf86d036c37929443d7f4a7a8af77dbbce11cec7ddce8d8599c5

See more details on using hashes here.

File details

Details for the file shell-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for shell-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 64e3347d1dd2c8f3c3f3df5e6ebe9084d768ae20985aef6793854b9f47d4045a
MD5 95bac7901f7a9646a1a39e1b413345aa
BLAKE2b-256 c1195fc161e830b08bf2b419a04b0105f2dbf095759148d38cd1e99feadc4146

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page