Skip to main content

DataJet

A Data Dependency Graph Framework and Executor

DataJet abstracts over function calls by mapping inputs through a graph of functions to desired outputs. As a programmer, you declare your data transformations (functions of inputs to outputs) once, and datajet will handle mapping any input to any output reachable by the graph of functions.

Key Features

  • Lazy: Only Evaluate and return the data you need
  • Declarative: Declare Data and functions on the data explicitly, using plain python
  • Dependency-Free: Just Python.

Installation

Requirements:

  • Python >=3.8

To Get Started, Install DataJet From pypi:

pip install datajet

Why would I use this?

  • DataJet simplifies the codebase of dynamic systems with mutliple ways to calculate a datapoints from different inputs.
  • DataJet de-couples downstream calculations from the mechanics of calculating upstream dependencies.

Quickstart

from datajet import execute

dollars = [7.98, 20.94, 37.9, 30.31]
units =  [1, 3, 5, 4,]

def prices(dollars, units):
    return [d/u for d, u in zip(dollars, units)]

def average_price(prices):
    return sum(prices) / len(prices) 

def average_price_rounded_down(average_price):
    return average_price * 1000 // 10 / 100


datajet_map = {
    "prices": prices,
    "average_price": average_price,
    "average_price_rounded_down": average_price_rounded_down,
}
execute(
        datajet_map,
        context={
            "dollars": dollars,
            "units": units,
        }, 
        fields=['average_price_rounded_down']
)
{'average_price_rounded_down': 7.52}

And, if you have prices, you can directly get what you need:

prices = [3.99, 4.49, 2.89, 2.79, 2.99]

execute(datajet_map,context={"prices": prices,}, fields=['average_price', 'average_price_rounded_down'])
{'average_price': 3.4299999999999997, 'average_price_rounded_down': 3.42}

Important Details

Keys can be any hashable. The value corresponding to each key can be a function or an object. The functions can have 0 or more parameters. The parameter names must correspond to other keys in the dict if no explicitly defined inputs to the callable are declared in the map. See Datamap reference for how to explicitly define inputs.

You can also define multiple ways of calculating a piece of data via defining a list of functions as the value to the key. Again, each function's parameters must correspond to other keys in the dict, or else you can define which other keys should be inputs to the function via explicitly defining inputs.

Full Documentation

https://bmritz.github.io/datajet/

Development

To create the development environment locally:

git clone
make install

This will start a poetry shell that has all the dev dependencies installed. You can run deactivate to exit the shell.

To run tests

make test

Development troubleshooting

If you see:

urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>

Go to /Applications/Python3.x and run 'Install Certificates.command'

Built on ideas inspired by

Metadata

Release files for datajet 0.2.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 datajet 0.2.0
File Size Uploaded Provenance
datajet-0.2.0.tar.gz 9.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for datajet 0.2.0
File Interpreter ABI Platform
datajet-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.7 kB

Release files / datajet-0.2.0.tar.gz

Download URL datajet-0.2.0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1c1e61b6610b20f6bcd574d067b408fa96148fa5d7f531473b84f3d035f328b3
BLAKE2b-256 checksum
How to use checksums
f8605423e70023b810bba206364837ef4b05992a2d7ee35785de5101051196b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.9.16 Linux/5.15.0-1034-azure

Release files / datajet-0.2.0-py3-none-any.whl

Download URL datajet-0.2.0-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b7d2e200a2e336a23f95ad383d6ddd35fc657cf892fd3dfbebc670d717fd2936
BLAKE2b-256 checksum
How to use checksums
6c0cea2cdca0f2b9bde3f203280b94f135b29459c8e06067c7514899f706846a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.9.16 Linux/5.15.0-1034-azure

Security for datajet 0.2.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