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 namedhttp.py. As an installed package it isplumb_line_provenance.httpand is harmless, but if you copy it flat onto a directory that lands onsys.path, a top-levelimport httpwould shadow the standard library'shttppackage and breakrequests/httpx(which importhttp.clientinternally). When copying it flat, import it under a package/private name rather than as barehttp, 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file plumb_line_provenance-0.9.0.tar.gz.
File metadata
- Download URL: plumb_line_provenance-0.9.0.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f93e1a87437dc6f3bbde20262af64e21419be79a810d8d03bf5b6daeb5d25fb2
|
|
| MD5 |
ef8d895b147fd98d39dbbb90f7b66aa4
|
|
| BLAKE2b-256 |
a23fb3ac2235cf4edc972097955883f085e2030a359247a05bc9e3556f47394c
|
Provenance
The following attestation bundles were made for plumb_line_provenance-0.9.0.tar.gz:
Publisher:
release.yml on slopstopper/plumb-line
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
plumb_line_provenance-0.9.0.tar.gz -
Subject digest:
f93e1a87437dc6f3bbde20262af64e21419be79a810d8d03bf5b6daeb5d25fb2 - Sigstore transparency entry: 2476316536
- Sigstore integration time:
-
Permalink:
slopstopper/plumb-line@b32c18e66c1d4957755c5af9ba0cb7cb73ca59ae -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/slopstopper
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b32c18e66c1d4957755c5af9ba0cb7cb73ca59ae -
Trigger Event:
push
-
Statement type:
File details
Details for the file plumb_line_provenance-0.9.0-py3-none-any.whl.
File metadata
- Download URL: plumb_line_provenance-0.9.0-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
749dbc161ddfdd8d0d2384bb34b7a1ecd99760e6916a668816315fc0f0fe13e6
|
|
| MD5 |
55e2401689064274eaf54af83fe49f5a
|
|
| BLAKE2b-256 |
52c2cc8f92f71e7c7860aba19edaa0ac978fc00a48739801839680c9c442182e
|
Provenance
The following attestation bundles were made for plumb_line_provenance-0.9.0-py3-none-any.whl:
Publisher:
release.yml on slopstopper/plumb-line
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
plumb_line_provenance-0.9.0-py3-none-any.whl -
Subject digest:
749dbc161ddfdd8d0d2384bb34b7a1ecd99760e6916a668816315fc0f0fe13e6 - Sigstore transparency entry: 2476316557
- Sigstore integration time:
-
Permalink:
slopstopper/plumb-line@b32c18e66c1d4957755c5af9ba0cb7cb73ca59ae -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/slopstopper
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b32c18e66c1d4957755c5af9ba0cb7cb73ca59ae -
Trigger Event:
push
-
Statement type: