Skip to main content

plumb-line-provenance (Python)

A conservative provenance / confidence / lineage envelope with a taint-propagation combination law: once any input is mock or low-confidence, every value derived from it inherits that taint automatically — there is no escape hatch that silently clears the flag.

from plumb_line_provenance import mark, derive, meta_of, audit_meta

base = mark(1000, source='real', confidence='high')
rate = mark(1.25, source='mock', confidence='low')
total = derive([base, rate], lambda a, r: a * r)

total['meta']['derived_from_mock']  # True  — inherited from rate, cannot be cleared
total['meta']['confidence']         # 'low' — only as certain as the weakest input
audit_meta(meta_of(total))          # []    — internally consistent

You can also copy the module files directly into a project and import them flat (from marked import mark); both styles work.

Flat-copy caveat for http.py: the HTTP adapter file is named http.py. As an installed package it is plumb_line_provenance.http and is harmless, but if you copy it flat onto a directory that lands on sys.path, a top-level import http would shadow the standard library's http package and break requests/httpx (which import http.client internally). When copying it flat, import it under a package/private name rather than as bare http, or prefer the installed package.

HTTP ingestion adapters (optional)

Auto-tag HTTP responses at ingestion. Install the extra for your client:

pip install "plumb-line-provenance[requests]"
pip install "plumb-line-provenance[httpx]"
from plumb_line_provenance.http import tag_requests, tagged_get
from plumb_line_provenance import derive
import requests

resp = requests.get(url)
data = tag_requests(resp)                     # marked by status/cache
body = derive([data], lambda r: r.json())     # extract; taint propagates

data = tagged_get(url, timeout=5)             # fetch + tag in one call

Mapping (source = origin, confidence = freshness):

HTTP condition source confidence
2xx, fresh real high
2xx cached / 304 real medium
4xx / 5xx (no data) unavailable none

Cache is detected best-effort from response headers (Age > 0, X-Cache: HIT, 304) and only lowers confidence, never source. (A from_cache attribute is also honored if present — set by caching wrappers such as requests-cache — but stock requests/httpx responses don't carry one, so header detection is the path that fires for them.) The tagger never emits fallback — that's for a value you substitute on error. The core (classify_response) is dependency-free; the taggers guard-import their library and raise a clear ImportError if the extra isn't installed.

Dataframe adapters (optional)

Provenance-carrying wrappers for pandas / numpy, with explicit combinators that propagate taint. Install the extra:

pip install "plumb-line-provenance[pandas]"
pip install "plumb-line-provenance[numpy]"
from plumb_line_provenance.frames import PlumbDataFrame, plumb_concat, plumb_merge

base = PlumbDataFrame(df_a, source="real", confidence="high")
rate = PlumbDataFrame(df_b, source="mock", confidence="low")

total = plumb_concat([base, rate])          # runs pd.concat, propagates taint
joined = plumb_merge(base, rate, on="id")   # runs .merge, propagates taint

total.meta["derived_from_mock"]  # True — mock taint propagated, cannot be cleared
total.meta["confidence"]         # 'low' — only as certain as the weakest input
total.value                      # the underlying DataFrame

plumb_derive([a, b], fn) is the general combinator (any transform). numpy is the same pattern: from plumb_line_provenance.arrays import PlumbArray, plumb_concatenate, plumb_stack.

You declare the source when you wrap (a raw frame carries no intrinsic provenance — there is no auto-classification). Pass a real source= for a leaf: the default ("derived") is meant for combinator outputs, and a "derived" leaf with no lineage will show up as unreproducible under .audit(). Operations outside the combinators work on .value and drop provenance until you re-wrap via plumb_derive — the combination point stays visible in your code (see ADR-0013). The core is dependency-free; the wrappers guard-import their library and raise a clear ImportError if the extra isn't installed.

  • Specification: SPEC.md (envelope schema version 2)
  • Model, law, examples: README.md
  • License: Apache-2.0

JavaScript parity package: plumb-line-provenance on npm.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plumb_line_provenance-0.7.3.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plumb_line_provenance-0.7.3-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file plumb_line_provenance-0.7.3.tar.gz.

File metadata

  • Download URL: plumb_line_provenance-0.7.3.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for plumb_line_provenance-0.7.3.tar.gz
Algorithm Hash digest
SHA256 a473aab4871b4194fc0a61e3bb256d2bea61aedfc38830b0dfe3d24dbfa7d619
MD5 3feaf30b62f90a52d8ed3e6f1d146e9c
BLAKE2b-256 6e5d81222add68cb30e0b099b12a4484fa1547953210bcbb724ec14d4a46e24e

See more details on using hashes here.

Provenance

The following attestation bundles were made for plumb_line_provenance-0.7.3.tar.gz:

Publisher: release.yml on slopstopper/plumb-line

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file plumb_line_provenance-0.7.3-py3-none-any.whl.

File metadata

File hashes

Hashes for plumb_line_provenance-0.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 96b9ae0e1f48bde9c8af25907bfaa7851323cf0f410cce6ea636454450951274
MD5 f6ebb4f3f4e209a03a6950ffbdf84eb5
BLAKE2b-256 421c3ed456fd4a7ff0570ce9087e891b10cf961c37b50143f7b3fdabdb837b67

See more details on using hashes here.

Provenance

The following attestation bundles were made for plumb_line_provenance-0.7.3-py3-none-any.whl:

Publisher: release.yml on slopstopper/plumb-line

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.10.0

2 files

0.9.0

2 files

0.8.1

2 files

0.8.0

2 files

This release

0.7.3 This release

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

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