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.
The HTTP adapter is
http_adapter.py. Until 0.11.2 it washttp.py, which shadowed the standard library'shttppackage (and brokerequests/httpx) whenever the directory was onsys.path. Flat copies import it ashttp_adapter; the installed package keepsplumb_line_provenance.httpas an alias ofplumb_line_provenance.http_adapterthrough 0.x (1.0 decision: #429), so existing imports still work at run time. The alias is a runtime entry static type checkers cannot see; new code should importhttp_adapter.
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_adapter 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.
Release files for plumb-line-provenance 0.11.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| plumb_line_provenance-0.11.2.tar.gz | 40.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| plumb_line_provenance-0.11.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 66.7 kB
Release files / plumb_line_provenance-0.11.2.tar.gz
| Download URL | plumb_line_provenance-0.11.2.tar.gz |
|---|---|
| Size | 40.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b8399ac6f4655134d3b3fb4f45346460a99d9bdf2d41dc9f70b0b8e68f6e7d0
|
|
BLAKE2b-256 checksum How to use checksums |
920c91c6e0a5e2a68dfe021e4c09262428ddbc0f7ff00d9c5e79a9b4bdb5d44b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / plumb_line_provenance-0.11.2-py3-none-any.whl
| Download URL | plumb_line_provenance-0.11.2-py3-none-any.whl |
|---|---|
| Size | 26.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9bbcf76c35f421e159385dc19aaf9bb4adcbdd534dfc8ebd806f7a86aded1d0a
|
|
BLAKE2b-256 checksum How to use checksums |
f48ed482d6d94f1112071553e487f5d59926d0bc2473758109c7f41e5b15cfea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency log