Skip to main content

artigraph

pypi changelog downloads versions license CI codecov OpenSSF Best Practices

Declarative Data Production

Artigraph is a tool to improve the authorship, management, and quality of data. It emphasizes that the core deliverable of a data pipeline or workflow is the data, not the tasks.

Artigraph is hosted by the LF AI and Data Foundation as a Sandbox project.

Installation

Artigraph can be installed from PyPI on python 3.9+ with pip install arti.

Example

This sample from the spend example highlights computing the total amount spent from a series of purchase transactions:

from pathlib import Path
from typing import Annotated

from arti import Annotation, Artifact, Graph, producer
from arti.formats.json import JSON
from arti.storage.local import LocalFile
from arti.types import Collection, Date, Float64, Int64, Struct
from arti.versions import SemVer

DIR = Path(__file__).parent


class Vendor(Annotation):
    name: str


class Transactions(Artifact):
    """Transactions partitioned by day."""

    type = Collection(
        element=Struct(fields={"id": Int64(), "date": Date(), "amount": Float64()}),
        partition_by=("date",),
    )


class TotalSpend(Artifact):
    """Aggregate spend over all time."""

    type = Float64()
    format = JSON()
    storage = LocalFile()


@producer(version=SemVer(major=1, minor=0, patch=0))
def aggregate_transactions(
    transactions: Annotated[list[dict], Transactions]
) -> Annotated[float, TotalSpend]:
    return sum(txn["amount"] for txn in transactions)


with Graph(name="test-graph") as g:
    g.artifacts.vendor.transactions = Transactions(
        annotations=[Vendor(name="Acme")],
        format=JSON(),
        storage=LocalFile(path=str(DIR / "transactions" / "{date.iso}.json")),
    )
    g.artifacts.spend = aggregate_transactions(
        transactions=g.artifacts.vendor.transactions
    )

The full example can be run easily with docker run --rm artigraph/example-spend:

INFO:root:Writing mock Transactions data:
INFO:root:      /usr/src/app/transactions/2021-10-01.json: [{'id': 1, 'amount': 9.95}, {'id': 2, 'amount': 7.5}]
INFO:root:      /usr/src/app/transactions/2021-10-02.json: [{'id': 3, 'amount': 5.0}, {'id': 4, 'amount': 12.0}, {'id': 4, 'amount': 7.55}]
INFO:root:Building aggregate_transactions(transactions=Transactions(format=JSON(), storage=LocalFile(path='/usr/src/app/transactions/{date.iso}.json'), annotations=(Vendor(name='Acme'),)))...
INFO:root:Build finished.
INFO:root:Final Spend data:
INFO:root:      /tmp/test-graph/spend/7564053533177891797/spend.json: 42.0

Community

Everyone is welcome to join the community - learn more in out support and contributing pages!

Presentations

Metadata

Release files for arti 0.0.4

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

Source distribution (sdist)

Source distribution for arti 0.0.4
File Size Uploaded Provenance Actions
arti-0.0.4.tar.gz 62.2 kB Without provenance Details for arti-0.0.4.tar.gz

Built distribution (wheel)

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

Total release size: 142.5 kB

Release files / arti-0.0.4.tar.gz

Download URL arti-0.0.4.tar.gz
Size 62.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6376159e99e69f55234eab7334a440fef42defac89b7e193625f1be5fb43a3c6
BLAKE2b-256 checksum
How to use checksums
f8da6619cbc475d254348a85e4f96a7bd59dd496d8994c338e6602f5890d69bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.1 CPython/3.10.6 Linux/5.15.0-1034-azure

Release files / arti-0.0.4-py3-none-any.whl

Download URL arti-0.0.4-py3-none-any.whl
Size 80.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2547853707c7530d4484851b4a71d85fff117cfc499db1b3ac0c3ff0b789075c
BLAKE2b-256 checksum
How to use checksums
29d66e156d2166317f46dfda2fb0eb6d09c1f5244d78b4708f6bebed5d93b239
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.1 CPython/3.10.6 Linux/5.15.0-1034-azure

Security for arti 0.0.4

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