lagoon
Concise layer on top of subprocess, similar to sh project
Support
If you see an error along the lines of:
ImportError: cannot import name 'zyx' from 'lagoon'
This means the app requires command zyx to be available, and you don't have it on your system.
The solution is to install zyx in the usual way, e.g. via your package manager.
API
dkrcache
ABRUPT
Accept abrupt outcomes.
ALWAYS
Accept all outcomes.
ExpensiveTask Objects
class ExpensiveTask()
Arbitrary task accelerated by Docker cache.
__init__
def __init__(context, discriminator, task)
Create a task keyed by context directory and discriminator string.
run
def run(force=NEVER, cache=NORMAL)
Run the task, where force can be used to ignore a cached outcome, and cache can be used to deny caching an outcome.
NEVER
Do not accept any outcome.
NORMAL
Accept normal outcomes.
dkrcache.util
ContextStream Objects
class ContextStream()
Fully customisable docker build context.
mkdir
def mkdir(name)
Create a directory in the context.
open
@classmethod
@contextmanager
def open(cls, dockerstdin)
Attach to the given stdin of docker build, which should have been given - as context.
put
def put(name, path)
Add the given path as the given archive name.
putstream
def putstream(name, stream)
Add the given stream as the given archive name.
iidfile
@contextmanager
def iidfile()
Context manager yielding an object with args to pass to docker build, and a read function to get the image ID.
lagoon
Text mode instances of Program for every executable, with dash translated to underscore e.g. from lagoon import pkg_config for pkg-config.
lagoon.binary
Like lagoon module but Program objects are in binary mode.
lagoon.program
NOEOL Objects
@singleton
class NOEOL()
Style to strip trailing newlines from stdout, in the same way as shell does.
ONELINE
def ONELINE(text)
Style to assert exactly one line of output, using splitlines.
Program Objects
class Program()
Normally import an instance from lagoon or lagoon.binary module instead of instantiating manually.
__call__
def __call__(*args, **kwargs)
Run program in foreground with additional args. Accepts many subprocess kwargs. Use partial style to suppress execution, e.g. before running in background. Otherwise return CompletedProcess, or one of its fields if the rest are redirected, or None if all fields redirected.
__enter__
def __enter__()
Start program in background yielding the Popen object, or one of its fields if the rest are redirected.
__getattr__
def __getattr__(name)
Add argument, where underscore means dash.
__getitem__
def __getitem__(key)
Apply a style, e.g. partial to suppress execution or print to send stdout to console.
binary
@classmethod
def binary(cls, path)
Return binary mode Program for executable at given path.
text
@classmethod
def text(cls, path)
Return text mode Program for the executable at the given path.
lagoon.util
atomic
@contextmanager
def atomic(path)
Context manager yielding a temporary Path for atomic write to the given path. Parent directories are created automatically. Also suitable for making a symlink atomically. Leaves the given path unchanged if an exception happens.
mapcm
@contextmanager
def mapcm(f, obj)
Invoke obj as a context manager, apply f to its yielded value, and yield that. For example apply Path to the string yielded by TemporaryDirectory().
onerror
@contextmanager
def onerror(f)
Context manager that runs the given function if an exception happens, like finally excluding the happy path.
stripansi
def stripansi(text)
Remove ANSI control sequences from the given text, to make it black and white.
threadlocalproperty Objects
class threadlocalproperty()
Like property but each thread has its own per-object values.
__init__
def __init__(defaultfactory)
The defaultfactory should return the initial value per object (per thread).
unmangle
def unmangle(name)
Undo name mangling.
screen
GNU Screen interface, smoothing over its many gotchas.
Stuff Objects
class Stuff()
__call__
def __call__(text)
Send the given text so that it is received literally.
__init__
def __init__(session, window, doublequotekey)
Target the given screen session and window, using the given environment variable for double quote.
eof
def eof()
Send EOF, may have no effect if not at the start of a line.
stuffablescreen
def stuffablescreen(doublequotekey)
Return text mode Program for screen, with the given environment variable set to double quote.
Metadata
Release files for lagoon 43
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 |
|---|---|---|---|---|
| lagoon-43.tar.gz | 11.5 kB | Without provenance | Details for lagoon-43.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lagoon-43-py3-none-any.whl | Python 3 | none | any | Details for lagoon-43-py3-none-any.whl |
Total release size: 23.8 kB
Release files / lagoon-43.tar.gz
| Download URL | lagoon-43.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7943169454231d77565f32f38ed69bf260ad697f1ece34b398f0eaa9cfb60937
|
|
BLAKE2b-256 checksum How to use checksums |
a6ac7bd9efedc57a09aa1a3b311e87bd3c2869d6b2f0bbe168d2e99993fe53af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Release files / lagoon-43-py3-none-any.whl
| Download URL | lagoon-43-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2baeba16ba7d2fbd27279daa0bc0a1e6cd0281235aea76b6f4269cb2ebeb44f2
|
|
BLAKE2b-256 checksum How to use checksums |
d24fae99293b1e5eda3d38100717873cd9cbd47aa05709495c8f604e85c510f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Security for lagoon 43
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.