Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
PyPI

delegator.py 0.1.1

pip install delegator.py

Latest version

Released:

Subprocesses for Humans 2.0.

Verified details

These details have beenverified by PyPI
Maintainers
Avatar for kennethreitz from gravatar.comkennethreitzAvatar for nateprewitt from gravatar.comnateprewittAvatar for tuxtimo from gravatar.comtuxtimo

Project description


Delegator.py — Subprocesses for Humans 2.0
=======================================


.. image:: https://img.shields.io/pypi/v/delegator.py.svg
:target: https://pypi.python.org/pypi/delegator.py

.. image:: https://img.shields.io/pypi/l/delegator.py.svg
:target: https://pypi.python.org/pypi/delegator.py

.. image:: https://img.shields.io/pypi/wheel/delegator.py.svg
:target: https://pypi.python.org/pypi/delegator.py

.. image:: https://img.shields.io/pypi/pyversions/delegator.py.svg
:target: https://pypi.python.org/pypi/delegator.py

.. image:: https://img.shields.io/badge/SayThanks.io-☼-1EAEDB.svg
:target: https://saythanks.io/to/kennethreitz


**Delegator.py** is a simple library for dealing with subprocesses, inspired
by both `envoy <https://github.com/kennethreitz/envoy>`_ and `pexpect <http://pexpect.readthedocs.io>`_ (in fact, it depends on it!).

This module features two main functions ``delegator.run()`` and ``delegator.chain()``. One runs commands, blocking or non-blocking, and the other runs a chain of commands, separated by the standard unix pipe operator: ``|``.

If you're interested in financially supporting Kenneth Reitz open source, consider `visiting this link <https://cash.me/$KennethReitz>`_. Your support helps tremendously with sustainability of motivation, as Open Source is no longer part of my day job.

Basic Usage
-----------

Basic run functionality:

.. code:: pycon

>>> c = delegator.run('ls')
>>> print c.out
README.rst delegator.py

>>> c = delegator.run('long-running-process', block=False)
>>> c.pid
35199
>>> c.block()
>>> c.return_code
0

Commands can be passed in as lists as well (e.g. ``['ls', '-lrt']``), for parameterization.

Basic chain functionality:

.. code:: pycon

# Can also be called with ([['fortune'], ['cowsay']]).
# or, delegator.run('fortune').pipe('cowsay')

>>> c = delegator.chain('fortune | cowsay')
>>> print c.out
_______________________________________
/ Our swords shall play the orators for \
| us. |
| |
\ -- Christopher Marlowe /
---------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||


Expect functionality is built-in too, on non-blocking commands:

.. code:: pycon

>>> c.expect('Password:')
>>> c.send('PASSWORD')
>>> c.block()

Other functions:

.. code:: pycon

>>> c.kill()
>>> c.send('SIGTERM', signal=True)

# Only available when block=True, otherwise, use c.out.
>>> c.err
''

# Direct access to pipes.
>>> c.std_err
<open file '<fdopen>', mode 'rU' at 0x10a5351e0>

# Adjust environment variables for the command (existing will be overwritten).
>>> c = delegator.chain('env | grep NEWENV', env={'NEWENV': 'FOO_BAR'})
>>> c.out
NEWENV=FOO_BAR



Installation
------------

::

$ pip install delegator.py

✨🍰✨


Project details

Verified details

These details have beenverified by PyPI
Maintainers
Avatar for kennethreitz from gravatar.comkennethreitzAvatar for nateprewitt from gravatar.comnateprewittAvatar for tuxtimo from gravatar.comtuxtimo

Download files

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

Source Distribution

delegator.py-0.1.1.tar.gz (6.3 kBview details)

UploadedSource

Built Distribution

Filter files by name, interpreter, ABI, and platform.

If you're not sure about the file name format, learn more aboutwheel file names.

Copy a direct link to the current filters

delegator.py-0.1.1-py2.py3-none-any.whl (5.0 kBview details)

UploadedPython 2Python 3

File details

Details for the filedelegator.py-0.1.1.tar.gz.

File metadata

  • Download URL:delegator.py-0.1.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for delegator.py-0.1.1.tar.gz
AlgorithmHash digest
SHA256e6cc9cedab9ae59b169ee0422e17231adedadb144e63c0b5a60e6ff8adf8521b
MD5f7a1e8cf9cd78bddb4e6607d763b38a5
BLAKE2b-2560829199c7e8efd277eb00d842cb735c65f1d3d1c070e4903b0e44b30ca8e2604

See more details on using hashes here.

File details

Details for the filedelegator.py-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL:delegator.py-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for delegator.py-0.1.1-py2.py3-none-any.whl
AlgorithmHash digest
SHA256814657d96b98a244c479e3d5f6e9e850ac333e85f807d6bc846e72bbb2537806
MD5f34dd6b1611f180148f73512d6175781
BLAKE2b-256a7c22860c52ef858c4672b6cf637f473e9139342cdb281135db9b3c32cfb0a85

See more details on using hashes here.

Supported by

AWS Cloud computing and Security SponsorDatadog MonitoringDepot Continuous IntegrationFastly CDNGoogle Download AnalyticsPingdom MonitoringSentry Error loggingStatusPage Status page

[8]ページ先頭

©2009-2025 Movatter.jp