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
Release history Release notifications | RSS feed
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20ade6ec52b31f0b7fd4d022d70d652529fcb0a7e7f4140d0e2b2eefcb792914
|
|
| MD5 |
b20b7378f1b016a5c33fc54bb5d7aba1
|
|
| BLAKE2b-256 |
d36c280cf9fed9c09a5364681ba02b5e55808480d2a300d2137e7703332ba400
|
File details
Details for the file subprocesslib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: subprocesslib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bfcb65a45ce27f97b0c9f186be373eb505418905d280a6d3abd9604a100afe9
|
|
| MD5 |
a1d04a69c0021989ce51cf630f677ffe
|
|
| BLAKE2b-256 |
a672315d6aa00085573e9dde47df399a97201b31332baf0fd0738f11c456d344
|