Skip to main content

CRayGraph

A toolkit for defining dataflow-based frameworks. Intended for use in CRayNN (network definitions) and CRayFlow (dataflow definitions).

Installation

via PyPi

pip install craygraph

via git

CRayGraph can be installed directly from gitlab.com:

pip install git+https://gitlab.com/craynn/craygraph.git

however, as repository updates quite often, it is recommend to clone the repository and install the package in development mode:

git clone git@gitlab.com:craynn/craygraph.git
cd craygraph/
pip install -e .

Usage

This package provides three main functions:

  • cragraph.graph : utilities for constructing easily readable definitions of directed acyclic graphs (DAGs);
  • cragraph.meta : functions that help quickly adopt custom classes to work with cragraph.graph.

DAG definition language

The main feature of craygraph is intuitive and readable DAG definition language.

Quick introduction

Below, functions like a, b, c, d represent node (subgraph) constructors, i.e. (*Node) -> Node or (*Node) -> list[Nodes], x, y, z represent input nodes.

Tuple of functions = composition

achain(a, b, c, d)(x)

is equivalent to:

d(c(b(a(x))))

and produces:

linear graph

List of functions = independent application:

result = achain(a, [b, c], d)(x)

is equivalent to:

a_x = a(x)
result = d(b(a_x), c(a_x))

and results in the following graph:

linear graph

craygraph.graph contains some helper functions. select[items](body) selects inputs according to items and applies body

select[item](f)(*args) == f(args[item]) 

for example:

result = achain(
  select[0, -1](a, b),
  c
)(x, y, z)

is equivalent to:

result = c(b(a(x, z)))

which results in (node y is omitted since it is not used):

linear graph

with_inputs[items](body) is similar to select, but it takes inputs and replaces selected inputs with the result of body:

result = achain(
  with_inputs[0, -1](a, b),
  c
)(x, y, z)

is equivalent to:

result = c(b(a(x, z)))

which results in:

linear graph

Metadata

Release files for craygraph 0.3.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 craygraph 0.3.0
File Size Uploaded Provenance Actions
craygraph-0.3.0.tar.gz 15.0 kB Without provenance Details for craygraph-0.3.0.tar.gz

Release files / craygraph-0.3.0.tar.gz

Download URL craygraph-0.3.0.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d7bfae14f17899d4c8fd52432f7a2327d8d2d04bfa9aabf5f4d1971f671a2bb8
BLAKE2b-256 checksum
How to use checksums
a304fe5a2d9a9d11ad4fb5b902cf1bdbb8329a9cd78094c3f8b04b12a1a797d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

Security for craygraph 0.3.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.

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file No provenance

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