Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

shell

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shell

A better way to run shell commands in Python.

  • 1.0.1
  • PyPI
  • Socket score

Maintainers
1

===== shell

"""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.

.. _subprocess: http://docs.python.org/2.7/library/subprocess.html

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc