Skip to main content

Versatile utility function to run external processes

Project description

ProcRunner

PyPI release Conda Version Build status Build status Documentation Status Updates Supported Python versions Code style: black

Versatile utility function to run external processes

Features

  • runs an external process and waits for it to finish

  • does not deadlock, no matter the process stdout/stderr output behaviour

  • returns the exit code, stdout, stderr (separately, both as bytestrings), and the total process runtime as a dictionary

  • process can run in a custom environment, either as a modification of the current environment or in a new environment from scratch

  • stdin can be fed to the process, the returned dictionary contains information how much was read by the process

  • stdout and stderr is printed by default, can be disabled

  • stdout and stderr can be passed to any arbitrary function for live processing (separately, both as unicode strings)

  • optionally enforces a time limit on the process

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

1.1.0 (2019-11-04)

  • Add Python 3.8 support, drop Python 3.4 support

1.0.2 (2019-05-20)

  • Stop environment override variables leaking into the process environment

1.0.1 (2019-04-16)

  • Minor fixes on the return object (implement equality, mark as unhashable)

1.0.0 (2019-03-25)

  • Support file system path objects (PEP-519) in arguments

  • Change the return object to make it similar to subprocess.CompletedProcess, introduced with Python 3.5+

0.9.1 (2019-02-22)

  • Have deprecation warnings point to correct code locations

0.9.0 (2018-12-07)

  • Trap UnicodeEncodeError when printing output. Offending characters are replaced and a warning is logged once. Hints at incorrectly set PYTHONIOENCODING.

0.8.1 (2018-12-04)

  • Fix a few deprecation warnings

0.8.0 (2018-10-09)

  • Add parameter working_directory to set the working directory of the subprocess

0.7.2 (2018-10-05)

  • Officially support Python 3.7

0.7.1 (2018-09-03)

  • Accept environment variable overriding with numeric values.

0.7.0 (2018-05-13)

  • Unicode fixes. Fix crash on invalid UTF-8 input.

  • Clarify that stdout/stderr values are returned as bytestrings.

  • Callbacks receive the data decoded as UTF-8 unicode strings with unknown characters replaced by ufffd (unicode replacement character). Same applies to printing of output.

  • Mark stdin broken on Windows.

0.6.1 (2018-05-02)

  • Maintenance release to add some tests for executable resolution.

0.6.0 (2018-05-02)

  • Fix Win32 API executable resolution for commands containing a dot (‘.’) in addition to a file extension (say ‘.bat’).

0.5.1 (2018-04-27)

  • Fix Win32API dependency installation on Windows.

0.5.0 (2018-04-26)

  • New keyword ‘win32resolve’ which only takes effect on Windows and is enabled by default. This causes procrunner to call the Win32 API FindExecutable() function to try and lookup non-.exe files with the corresponding name. This means .bat/.cmd/etc.. files can now be run without explicitly specifying their extension. Only supported on Python 2.7 and 3.5+.

0.4.0 (2018-04-23)

  • Python 2.7 support on Windows. Python3 not yet supported on Windows.

0.3.0 (2018-04-17)

  • run_process() renamed to run()

  • Python3 compatibility fixes

0.2.0 (2018-03-12)

  • Procrunner is now Python3 3.3-3.6 compatible.

0.1.0 (2018-03-12)

  • First release on PyPI.

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

procrunner-1.1.0.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

procrunner-1.1.0-py2.py3-none-any.whl (10.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file procrunner-1.1.0.tar.gz.

File metadata

  • Download URL: procrunner-1.1.0.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.8.0

File hashes

Hashes for procrunner-1.1.0.tar.gz
Algorithm Hash digest
SHA256 d40da5e03e8749947def46854030eef63384cd563cb661435ea81500a4910db7
MD5 8765591aca9ed31ce5844d7289f4cb8f
BLAKE2b-256 42f499df4651c8b0dc775c310d7bd77b8835b2c2a7447f352f873cdac5bb92d3

See more details on using hashes here.

File details

Details for the file procrunner-1.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: procrunner-1.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.8.0

File hashes

Hashes for procrunner-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 82085030faba70efa205c4e7b6ee2b045a50b83bb642188cb1deaa213cedfcaa
MD5 5b51dd0dcbf9a8953a2060a4b2aed740
BLAKE2b-256 f806a43cd91daec9585abbbcd25511f29235a16e375f4d1115c50d9fd6bdb2cd

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