Metadata-Version: 2.5
Name: ineedvalidation
Version: 1.0.0
Summary: Declare which physical case, evidence tier and response quantity a test exercises; collect the declarations into an evidence ledger; lint and render a validation hierarchy from it.
Project-URL: Homepage, https://github.com/CoreySpohn/ineedvalidation
Project-URL: Issues, https://github.com/CoreySpohn/ineedvalidation/issues
Author-email: Corey Spohn <corey.a.spohn@nasa.gov>
License: MIT License
        
        Copyright (c) 2026 Corey Spohn
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.11
Requires-Dist: pytest>=8
Provides-Extra: dev
Requires-Dist: pre-commit; extra == 'dev'
Provides-Extra: docs
Requires-Dist: ipython; extra == 'docs'
Requires-Dist: myst-nb; extra == 'docs'
Requires-Dist: sphinx; extra == 'docs'
Requires-Dist: sphinx-autoapi; extra == 'docs'
Requires-Dist: sphinx-autodoc-typehints; extra == 'docs'
Requires-Dist: sphinx-book-theme; extra == 'docs'
Provides-Extra: render
Requires-Dist: pyyaml>=6; extra == 'render'
Provides-Extra: test
Requires-Dist: pytest-cov; extra == 'test'
Requires-Dist: pyyaml>=6; extra == 'test'
Description-Content-Type: text/markdown

# ineedvalidation

Declare which physical case, kind of evidence and response quantity a test exercises; collect the declarations across repositories into an evidence ledger; lint and render a validation hierarchy from node notes plus that ledger.

The vocabulary follows Oberkampf and Roy, *Verification and Validation in Scientific Computing* (2010): a validation hierarchy of unit, benchmark, subsystem and system cases, and a strict separation between verification (the code solves the equations correctly) and validation (the equations describe the measured world).

## Marking a test

```python
import ineedvalidation as vv

@vv.case("free-space-propagation", "code-verification", srq="on-axis intensity")
def test_matches_closed_form():
    ...

@vv.case("free-space-propagation", "solution-verification", refined_parameter="grid-spacing")
def test_second_order_in_the_step():
    ...

@vv.case("free-space-propagation", "cross-code-benchmark", reference_code="other-code")
def test_matches_independent_code():
    ...

@vv.case("detector-frame", "validation", referent="lab-flat-field-2026")
def test_matches_measured_frames():
    ...

@vv.seam("optics", "detector", case="detector-frame")
def test_photon_scale_anchor():
    ...

@vv.regression
def test_frozen_output():
    ...
```

Evidence kinds: `code-verification`, `solution-verification`, `cross-code-benchmark`, `validation` (measured data only) and `uncertainty-quantification`. They are spelled out rather than lettered so a marked test reads without a key. `reference_code=` belongs to a cross-code benchmark, `refined_parameter=` to solution verification and `referent=` to validation; each raises when used with another kind, so a mislabelled test fails at import. Regression tests claim no kind of evidence.

The markers register through a pytest plugin entry point, so installing the package is the only setup a repository needs.

## Tagging by path

A table in `pyproject.toml` assigns a case and evidence kind by test path, so the tagging cost is per file or directory rather than per test. The longest matching prefix wins, and an explicit marker overrides the table.

```toml
[tool.pytest.ini_options]
testpaths = ["tests"]

[tool.ineedvalidation]
library = "mylib"

[tool.ineedvalidation.defaults]
"tests/test_kernel.py" = { case = "free-space-propagation", evidence = "code-verification" }
"tests/benchmark/" = { case = "free-space-propagation", evidence = "cross-code-benchmark" }
```

Paths are matched relative to the pytest rootdir. A `[tool.pytest.ini_options]` table in the same `pyproject.toml` pins the rootdir to the repository; without one, pytest can settle on a directory above it and no default matches.

## Collecting the evidence

```console
$ pytest --vv-evidence evidence/mylib.json
```

One JSON file per repository lists every marked or defaulted test with its case, kind of evidence, response quantity, seam and the outcome it reached, stamped with the commit. The library name comes from `--vv-library NAME`, else `[tool.ineedvalidation] library`, else the rootdir name.

## Linting, scaffolding and rendering a hierarchy

```console
$ ineedvalidation lint hierarchy/ --library-map libraries.md
$ ineedvalidation scaffold hierarchy/
$ ineedvalidation render hierarchy/
```

The hierarchy is a directory holding `nodes/` (one Markdown note with YAML frontmatter per node, listing the cases it owns under `cases:`), `evidence/` (the ledgers) and optionally `views/`; `--nodes` and `--evidence` point elsewhere. The lint checks the notes for internal consistency and checks them against the collected tests in both directions: a case no node owns, a node with no tests, a response quantity a node does not list, or a validation level claimed without a passing test that supports it. `scaffold` writes a stub note for every case a test names that no node owns. The renderer draws the levelled figure through `d2`, with named views (`--view`, `--all-views`), a single branch (`--root`) and optional hand-edited overrides for figures that have to look right in a talk.

## Status

Pre-alpha. The markers, the evidence collector, the hierarchy lint, the scaffolder and the renderer work; the API is not yet stable.
