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

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

Built distribution (wheel)

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

Total release size: 2.3 MB

Release files / dag_modelling-0.17.0.tar.gz

Download URL dag_modelling-0.17.0.tar.gz
Size 2.1 MB
Tags Source
SHA-256 checksum
How to use checksums
bf281436e8333bd73c48414170fb14f869b2ac2e5f20a37170bd7b1ea7a1560d
BLAKE2b-256 checksum
How to use checksums
c15f306277b311f14305d929f24ba5888c9d9f04241b10e2b4ebf3bccebf610a
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.17.0-py3-none-any.whl

Download URL dag_modelling-0.17.0-py3-none-any.whl
Size 231.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09145640c4f8861b987c51d2a03491e216640081cdd16f3cc1aa8fdf98cde48a
BLAKE2b-256 checksum
How to use checksums
6887f82f13229d20461bbbff67a6bf27a82fc30b6c2d04452954f92980a109e2
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.17.0

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