Metadata-Version: 2.4
Name: throughline-history
Version: 0.1.0
Summary: How a throughline graph came to be, read from git: who created each item, who signed it and when, how it changed. Also compares independent signings of the same items against what was finally kept. Pure functions that run in a browser tab under Pyodide, and a tl-history command over a local checkout.
Author-email: Henry J Grech-Cini <henry.grechcini@gmail.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/rhodium-org/throughline-history
Keywords: requirements,throughline,idd,history,ratification,traceability,git
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: throughline>=4.0.1
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Dynamic: license-file

# throughline-history

How a [throughline](https://github.com/rhodium-org/throughline) graph came to be,
read from git: who created each item, who signed it and when, how it changed and
how the graph grew. And, for training, how several people's independent signings
of the same items compare with each other and with what was finally kept.

It is the reader behind **history.iddn.uk** and **learn.iddn.uk**. Those pages run
it in your own browser tab, under Pyodide, so no server ever sees your token or
your graph. The same functions run on your machine through `tl-history`.

```bash
pipx install throughline-history
tl-history -C idd                    # every event, oldest first
tl-history -C idd summary            # per person: created, amended, signed
tl-history -C idd compare --base main~3 --final main junior=review/junior senior=review/senior
```

Add `--format json` to any of them for the data the pages use.

## As a library

```python
from throughline_history import Commit, derive, summarise, compare

history = derive([(Commit(sha, author, at, message), {path: text_or_None, ...}), ...], root="idd")
history.to_json()     # {"schemaVersion": 1, "events": [...], "commits": [...]}
summarise(history)    # per item and per person
compare(base_files, {"junior": files, "senior": files}, final_files, root="idd")
```

`derive`, `summarise` and `compare` read only what they are given: no git, no
network, no process. The caller fetches the commits; `tl-history` does that from
a local checkout, a page does it from GitHub.

## What it reads, and what it does not

- Items are read through throughline's own reader, so every format the graph was
  ever written in reads as one history. A migration rewrites a signature; it does
  not make one.
- A signature is dated by the time it recorded (format 4) or, before that, by the
  commit that carried it, and each event says which. It carries the role it was
  given in and what it supersedes.
- Every item is judged at every commit by the rules the graph's `throughline.toml`
  declared then (`[ratify.roles]`, `[ratify.requires.<type>]`), through throughline's
  own `standing`: the history says when an item's signatures came to meet what its
  kind requires and when they stopped, when an amendment left a signature covering
  wording that is no longer there, and when the rules changed. A graph that declares
  no rules needs one signature of anyone.
- A comparison says, for each attempt, whether its signatures would meet those
  rules: a junior's can be the right decision and still not be enough.
- Roles come only from the signatures in the graph. Nothing is inferred from
  GitHub, and nothing is ever written.

Its own requirements are in [`idd/`](idd); `tl -C idd context` explains them.
