Skip to main content

Object-oriented subprocess

Project description

Subprocesslib

subprocesslib is a Python library that aims to be like pathlib but for the subprocess module.

Usage

Here's a simple example of how to use SubprocessLib:

from subprocesslib import Command

command = Command('tail', '-n', 5, '/var/log/syslog')
print(command)  # Command('tail', '-n', '5', '/var/log/syslog')
print(isinstance(command, tuple))  # True
print(str(command))  # "tail -n 5 /var/log/syslog" (using `shlex.join`)

# sync methods
command.spawn()  # same as `subprocess.Popen(...)`
command.run()  # same as `subprocess.run(...)`
command.output()  # same as `subprocess.check_output(...)`

# async methods
await command.spawn_async()  # Same as `asyncio.create_subprocess_exec(...)`

Todo

  • await command.run_async()
  • await command.output_async()

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

subprocesslib-0.1.0.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

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

subprocesslib-0.1.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file subprocesslib-0.1.0.tar.gz.

File metadata

  • Download URL: subprocesslib-0.1.0.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for subprocesslib-0.1.0.tar.gz
Algorithm Hash digest
SHA256 20ade6ec52b31f0b7fd4d022d70d652529fcb0a7e7f4140d0e2b2eefcb792914
MD5 b20b7378f1b016a5c33fc54bb5d7aba1
BLAKE2b-256 d36c280cf9fed9c09a5364681ba02b5e55808480d2a300d2137e7703332ba400

See more details on using hashes here.

File details

Details for the file subprocesslib-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for subprocesslib-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6bfcb65a45ce27f97b0c9f186be373eb505418905d280a6d3abd9604a100afe9
MD5 a1d04a69c0021989ce51cf630f677ffe
BLAKE2b-256 a672315d6aa00085573e9dde47df399a97201b31332baf0fd0738f11c456d344

See more details on using hashes here.

Supported by

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