Skip to main content

Summary

python pipeline coverage report github gitlab pypi-release License: MIT

The DAGModelling software is a python implementation of the dataflow programming with the lazy graph evaluation approach.

Main goals:

  • Lazy evaluated directed acyclic graph;
  • Concise connection syntax;
  • Plotting with graphviz;
  • Flexibility. The goal of DAG-Modelling is not to be efficient, but rather flexible.

The framework is intended to be used for the statistical analysis of the data of JUNO and Daya Bay neutrino oscillation experiments.

Installation

For regular use, it's best to install the latest version of the project that's available on PyPi:

pip install dag-modelling

For developers

We recommend that developers install the package locally in editable mode:

git clone https://github.com/dagflow-team/dag-modelling.git
cd dag-modelling
pip install -e .

This way, the system will track all the changes made to the source files. This means that developers won't need to reinstall the package or set environment variables, even when a branch is changed.

Cython acceleration (optional)

Building

Compilation is opt-in: pip install dag-modelling (and pip install .) gives pure Python. To build the .so extensions, install Cython first and disable build isolation, otherwise the build does not see it:

pip install cython
pip install --no-build-isolation ".[cython]"                              # from a checkout
pip install --no-build-isolation --no-binary dag-modelling dag-modelling  # from PyPI

The cython extra alone does not compile anything. From PyPI, --no-binary is needed too, since the published wheel is pure Python.

When editing .pyx sources, rebuild in place:

python setup.py build_ext --inplace

Three files per compiled class

File Role
x.pxd C-level field/signature declarations, for cimport
x.pyx cdef class, hot path only (cpdef/cdef)
x.py pure-Python fallback, same interface
x_methods.py shared cold-path mixin _XMethods (__slots__ = ())

At import time Python prefers the compiled x.<abi>.so over x.py, so from dag_modelling.core.node import Node works either way.

Switching to pure Python

Set DGM_DISABLE_CYTHON=1 to use the .py core even when .so files are built, e.g. to run tests in both modes:

pytest                         # compiled core (if built)
DGM_DISABLE_CYTHON=1 pytest    # pure-Python core

The variable is read on the first import dag_modelling, so a running process cannot switch. To check which core is loaded, look at dag_modelling.core.node_eval.__file__ (.so or .py).

Example

For example, let's consider a sum of three input nodes and then a product of the result with another array.

from numpy import arange

from dag_modelling.core.graph import Graph
from dag_modelling.plot.graphviz import savegraph
from dag_modelling.lib.common import Array
from dag_modelling.lib.arithmetic import Sum, Product

# Define a source data
array = arange(3, dtype="d")

# Check predefined Array, Sum and Product
with Graph(debug=debug) as graph:
    # Define nodes
    (in1, in2, in3, in4) = (Array(name, array) for name in ("n1", "n2", "n3", "n4"))
    s = Sum("sum")
    m = Product("product")

    # Connect nodes
    (in1, in2, in3) >> s
    (in4, s) >> m
    graph.close()

    print("Result:", m.outputs["result"].data) # must print [0. 3. 12.]
    savegraph(graph, "dag_modelling_example_1a.png")

The printed result must be [0. 3. 12.], and the created image looks as

graph example

For more examples see example/example.py or tests.

Please, note, that examples are using pygraphviz package, which is optional and not requested by default.

Additional modules

Supplementary python modules:

Metadata

Release files for dag-modelling 0.16.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dag-modelling 0.16.2
File Size Uploaded Provenance Actions
dag_modelling-0.16.2.tar.gz 2.1 MB Without provenance Details for dag_modelling-0.16.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dag-modelling 0.16.2
File Interpreter ABI Platform Actions
dag_modelling-0.16.2-py3-none-any.whl Python 3 none any Details for dag_modelling-0.16.2-py3-none-any.whl

Total release size: 2.3 MB

Release files / dag_modelling-0.16.2.tar.gz

Download URL dag_modelling-0.16.2.tar.gz
Size 2.1 MB
Tags Source
SHA-256 checksum
How to use checksums
716cae2b21a9c30bbf3d69efbd6827274ee7783651fa8058db2cf33f0b6ba091
BLAKE2b-256 checksum
How to use checksums
308dabee6a441e7e1013e91a41a5e0a5a8ed5a57f44f23c0eed23078029b59b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / dag_modelling-0.16.2-py3-none-any.whl

Download URL dag_modelling-0.16.2-py3-none-any.whl
Size 219.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
acbf504026ba20568c74549ef98dd2c37d30b17e8e3ed02343f1b6bc6c38013e
BLAKE2b-256 checksum
How to use checksums
e47174a18c8b2bb5ee4d09a3c58d139285bc078017e259602e9f6959c253d9a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Security for dag-modelling 0.16.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page