diplomat
diplomat is the arbiter between shell scripts and commands. You give it
commands, and it gives you back diplomats that you can inquire about the
state of those commands, their output, and files containing their complete
output thus far.
Installation
pip install diplomat
Usage
A Diplomat is a high level, yet simple interface to commands and scripts.
You can give it shell commands as variable arguments, and it will execute
them asynchronously using subprocesses, writing the output into files.
from diplomat import Diplomat
diplo = Diplomat("ls", "-l", "example")
assert diplo.is_running()
# we can register asynchronous exit functions, can also be provided to
# constructor as on_exit, along with pre_start and post_start
diplo.register_exit_fn(lambda x: print("Diplomat is done"))
diplo.wait()
output = diplo.output()
file_name = diplo.output_file_name()
diplo.has_finished()
Output files can also be reused by providing the out and err keyword
arguments to the constructor of Diplomat.
An Attachee is an unprivileged grunt worker. It’s a read-only copy of a
Diplomat, or an interface to the files that a Diplomat created.
from diplomat import Attachee, Diplomat
diplo = Diplomat("ls", "-l", "example")
diplo.wait()
# we can create an attachee either from the diplomat directly
att = diplo.to_attachee()
# or from the file names; this is useful if we saved those
# references somewhere, for instance in a database
out = diplo.output_file_name()
err = diplo.error_file_name()
att = Attachee(out, err)
Have fun!
Metadata
Release files for diplomat 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| diplomat-0.1.2.tar.gz | 3.2 kB | Without provenance | Details for diplomat-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| diplomat-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for diplomat-0.1.2-py3-none-any.whl |
Total release size: 19.0 kB
Release files / diplomat-0.1.2.tar.gz
| Download URL | diplomat-0.1.2.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1cd733758874240f4efc7b9ce099891d8b3b51bdd9d5a383f5a6c4c7475783f5
|
|
BLAKE2b-256 checksum How to use checksums |
af60b18d7742370393127d9c0bcb76567a7a7721651d68b2c45f79fab5e02553
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
|
Release files / diplomat-0.1.2-py3-none-any.whl
| Download URL | diplomat-0.1.2-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b57e7bf7199288e005774f50e4e53de9282627b7f57764a17e03aff766a4b4dd
|
|
BLAKE2b-256 checksum How to use checksums |
f509d88f5c1d1dac3aa74535f09e96cda448356b848dbe043867c9cece6bab31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
|
Security for diplomat 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.