Metadata-Version: 2.4
Name: vigil-bv
Version: 0.1.2
Summary: Behavioural verification of evolving systems under controlled variation.
Author: Leopold Lemmermann
License: MIT License
        
        Copyright (c) 2026 Leopold Lemmermann
        
        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.
Project-URL: Homepage, https://leolem.dev/portfolio/vigil
Project-URL: Repository, https://github.com/leo-lem/vigil
Project-URL: Issues, https://github.com/leo-lem/vigil/issues
Project-URL: Changelog, https://github.com/leo-lem/vigil/releases
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PyYAML>=6.0
Requires-Dist: python-dotenv>=1.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Dynamic: license-file

# Vigil

[![PyPi](https://img.shields.io/pypi/v/vigil-bv)](https://pypi.org/project/vigil-bv/)
[![CI](https://github.com/leo-lem/vigil/actions/workflows/ci.yml/badge.svg)](https://github.com/leo-lem/vigil/actions/workflows/ci.yml)


Vigil is a small framework for **behavioural verification under controlled variation**.

It executes a system across declared variations, evaluates the resulting behaviour with checks, and records everything in a single structured report.  
Vigil is system-agnostic and focuses on behavioural properties rather than performance benchmarks.

## Running Vigil

Run Vigil on a project directory:

```bash
vigil [project_dir] [--trace]
```

Vigil opens an interactive menu to:
- select a specification
- run all variations and checks
- inspect previous reports

Reports are written next to the specification file.

## Project layout

A project directory contains:
- exactly one backend
- one or more specifications
- optional local checks and variations

```
project/
  llm_backend.py
  language.yml
  prompts.yml
  checks/
    entity_types_agree.py
  variations/
    differ_language.py
```

Files ending in `*.report.yml` are treated as results, not specs.

## Specification

A specification defines **what behaviour is tested**.

At minimum it contains:
- hypothesis
- inputs
- variations
- checks

Optional metadata:
- title

```
title: Behavioural verification of DatsLlm with respect to language
hypothesis: Annotation behaviour remains stable across language routing

inputs:
  - text: "Hello world"

variations:
  - type: set_input
    language: de

checks:
  - matches_baseline
```

## Backend

A backend wraps the system under evaluation.

It combines:
- **function configuration** (what is executed)
- **environment configuration** (how and where it runs)

Backends implement:

```
update_environment(environment)
compute(input, function) -> output
```

The framework manages execution, isolation, and cleanup automatically.

## Variations

Variations introduce controlled changes.

Each variation targets exactly one domain:
- input
- function
- environment

Variations:
- transform inputs or patch configuration
- are applied explicitly and sequentially
- never inspect outputs

Baseline execution is represented explicitly with `none`.

Vigil also supports a small convenience expansion:

```variations: [{ type: repeat, times: N, do: [...] }]```

This expands into a flat list by repeating the entries in `do` `N` times.

### Syntactic sugar

The specification format provides light syntactic sugar for common patterns. This sugar expands into ordinary variations and does not add new semantics.

Supported forms include:
- repetition of a variation block

These constructs exist purely to reduce duplication in specs. After parsing, the engine operates only on plain variations.

## Checks

Checks evaluate observed behaviour.

Three intents exist:
- unary
- reference
- group

Checks may be:
- assertive (produce PASS / WARN / ERROR)
- diagnostic (INFO only)

Checks operate only on recorded slices and never trigger execution.

## Reports

Each run produces a single structured report containing:
- metadata (title, hypothesis, timestamps)
- backend configuration
- all inputs and variations
- all check results

Reports are YAML by default and meant for inspection, comparison, and archiving.

Vigil is intentionally small, explicit, and extensible.  
New backends, variations, and checks can be added without modifying the core.
