goeieDAG
/ɣu.jə.ˈdɑx/: hello, good day (Dutch greeting used during daytime)
goeieDAG provides a unified Python API to Ninja and Make (TODO) build systems, aiming to make it extremely easy to benefit from parallel processing in any graph-like workflow.
Installation
pip install goeieDAG==0.0.2
Usage
from pathlib import Path
import goeiedag
from goeiedag import ALL_INPUTS, INPUT, OUTPUT
workdir = Path("output")
graph = goeiedag.Graph()
# Extract OS name from /etc/os-release
graph.add(["grep", "^NAME=", INPUT, ">", OUTPUT],
inputs=["/etc/os-release"],
outputs=["os-name.txt"])
# Get username
graph.add(["whoami", ">", OUTPUT],
inputs=[],
outputs=["username.txt"])
# Glue together to produce output
graph.add(["cat", ALL_INPUTS, ">", OUTPUT.result],
inputs=["os-name.txt", "username.txt"],
outputs=dict(result="result.txt")) # can also use a dictionary and refer to inputs/outputs by name
goeiedag.build_all(graph, workdir)
# Print output
print((workdir / "result.txt").read_text())
Q&A
Why use the files and commands model rather than Python objects and functions?
- It is a tested and proven paradigm (
maketraces back to 1976!) - It provides an obvious way of evaluating which products need rebuilding (subject to an accurate dependency graph)
- It naturally isolates and parallelizes individual build tasks
- It is agnostic as to how data objects are serialized (convenient for the library author...)
- Graph edges are implicitly defined by input/output file names
- A high-quality executor (Ninja) is available and installable via a Python package
How is this different from using the Ninja package directly?
- Simpler mental model & usage: no need to separately define build rules or think about implicit/explicit inputs and outputs
- API accepts Paths; no need to cast everything to
str! - Higher-level API in general (for example, the output directory is created automatically)
Similar projects
- Ninja (Python package) -- provides a lower-level API, used by goeieDAG as back-end
- TaskGraph -- similar project, but centered around Python functions and in-process parallelism
- Snakemake -- similar goals, but a stand-alone tool rather than a library
- Dask -- different execution model; caching of intermediate results is left up to the user
- doit
Metadata
Release files for goeieDAG 0.0.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 | |
|---|---|---|---|
| goeiedag-0.0.2.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| goeieDAG-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.0 kB
Release files / goeiedag-0.0.2.tar.gz
| Download URL | goeiedag-0.0.2.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
103a025a64d2ccc2946865be45304b104d3fb4efcd016693bdc1747b9b111bd9
|
|
BLAKE2b-256 checksum How to use checksums |
c8701e6c7cb8bbe4d65178e70cdf23eda6a034d48c93a36212c929796e5cd54c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.13
|
Release files / goeieDAG-0.0.2-py3-none-any.whl
| Download URL | goeieDAG-0.0.2-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33d12315959fc0fe78252d890eb05181111288a3541daa6166f78ca980a52baf
|
|
BLAKE2b-256 checksum How to use checksums |
96ddf3d6c1a772800ca6e53b3649337751a37d07d37d9c2c0636842f4a40cd9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.13
|