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.1

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.1
File Size Uploaded Provenance Actions
dag_modelling-0.16.1.tar.gz 2.1 MB Without provenance Details for dag_modelling-0.16.1.tar.gz

Built distribution (wheel)

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

Total release size: 2.3 MB

Release files / dag_modelling-0.16.1.tar.gz

Download URL dag_modelling-0.16.1.tar.gz
Size 2.1 MB
Tags Source
SHA-256 checksum
How to use checksums
84a939ce6121a4b32bc3ea098719c804116eae985ba4e273310bd4084d762272
BLAKE2b-256 checksum
How to use checksums
1544ffd76f8b578ecf124ea693cd8f23f72a3584dfdb0b2328b0e20aeb04a496
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.1-py3-none-any.whl

Download URL dag_modelling-0.16.1-py3-none-any.whl
Size 219.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a23fd405613597eeb224717c4e989771804609aed6ceffcd90bd262ee1b6e6c
BLAKE2b-256 checksum
How to use checksums
b3094d61cb727669813d169cb85de5a574da6ad5bd84c7d29401213609c80916
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.1

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