evalvcr 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- evalvcr-0.1.0/LICENSE +21 -0
- evalvcr-0.1.0/PKG-INFO +71 -0
- evalvcr-0.1.0/README.md +45 -0
- evalvcr-0.1.0/pyproject.toml +48 -0
- evalvcr-0.1.0/setup.cfg +4 -0
- evalvcr-0.1.0/src/evalvcr/__init__.py +135 -0
- evalvcr-0.1.0/src/evalvcr/__main__.py +11 -0
- evalvcr-0.1.0/src/evalvcr/cassette.py +819 -0
- evalvcr-0.1.0/src/evalvcr/cli.py +253 -0
- evalvcr-0.1.0/src/evalvcr/interceptors.py +343 -0
- evalvcr-0.1.0/src/evalvcr/pytest_plugin.py +98 -0
- evalvcr-0.1.0/src/evalvcr/report.py +320 -0
- evalvcr-0.1.0/src/evalvcr/runner.py +401 -0
- evalvcr-0.1.0/src/evalvcr/scorers.py +721 -0
- evalvcr-0.1.0/src/evalvcr/scrub.py +334 -0
- evalvcr-0.1.0/src/evalvcr.egg-info/PKG-INFO +71 -0
- evalvcr-0.1.0/src/evalvcr.egg-info/SOURCES.txt +28 -0
- evalvcr-0.1.0/src/evalvcr.egg-info/dependency_links.txt +1 -0
- evalvcr-0.1.0/src/evalvcr.egg-info/entry_points.txt +5 -0
- evalvcr-0.1.0/src/evalvcr.egg-info/requires.txt +6 -0
- evalvcr-0.1.0/src/evalvcr.egg-info/top_level.txt +1 -0
- evalvcr-0.1.0/tests/test_cassette.py +171 -0
- evalvcr-0.1.0/tests/test_challenger.py +58 -0
- evalvcr-0.1.0/tests/test_cli.py +155 -0
- evalvcr-0.1.0/tests/test_interceptors_and_runner.py +120 -0
- evalvcr-0.1.0/tests/test_interop.py +193 -0
- evalvcr-0.1.0/tests/test_pytest_integration.py +105 -0
- evalvcr-0.1.0/tests/test_pytest_plugin.py +126 -0
- evalvcr-0.1.0/tests/test_scorers.py +158 -0
- evalvcr-0.1.0/tests/test_scrub.py +136 -0
evalvcr-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 evalvcr contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
evalvcr-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: evalvcr
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local-first AI-agent & MCP evaluation and deterministic VCR cassette testing suite
|
|
5
|
+
Author: evalvcr contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/evalvcr/evalvcr
|
|
8
|
+
Project-URL: Repository, https://github.com/evalvcr/evalvcr
|
|
9
|
+
Project-URL: Issues, https://github.com/evalvcr/evalvcr/issues
|
|
10
|
+
Keywords: ai,eval,vcr,mcp,testing,agents,llm,pytest
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Framework :: Pytest
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Software Development :: Testing
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Provides-Extra: pytest
|
|
22
|
+
Requires-Dist: pytest>=7.0; extra == "pytest"
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# `evalvcr` (Python Companion)
|
|
28
|
+
|
|
29
|
+
Local-first AI-agent & MCP evaluation and deterministic VCR cassette testing suite — pure Python (`>= 3.10`, zero required external runtime dependencies) with a guarded `pytest11` plugin.
|
|
30
|
+
|
|
31
|
+
Shares exact byte-level `evalvcr.cassette.v1` and `evalvcr.report.v1` camelCase + JCS canonical JSON + SHA-256 parity with the TypeScript `evalvcr` packages so cassettes recorded in TypeScript replay strictly in Python and vice versa.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install evalvcr
|
|
37
|
+
# With optional pytest plugin support:
|
|
38
|
+
pip install "evalvcr[pytest]"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Quick Start (`pytest`)
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import pytest
|
|
45
|
+
from evalvcr import CassetteVCR, exact_match
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@pytest.mark.evalvcr(mode="auto", cassette="weather-agent")
|
|
49
|
+
def test_agent_replay(evalvcr_cassette: CassetteVCR) -> None:
|
|
50
|
+
interaction = evalvcr_cassette.interact(
|
|
51
|
+
kind="llm.chat",
|
|
52
|
+
provider="anthropic",
|
|
53
|
+
request={"method": "POST", "target": "/v1/messages", "body": {"prompt": "hi"}},
|
|
54
|
+
execute=lambda: {"response": {"status": 200, "sdk": {"text": "hello"}}},
|
|
55
|
+
)
|
|
56
|
+
res = exact_match()({"output": interaction["response"]["sdk"]["text"], "expected": "hello"})
|
|
57
|
+
assert res["score"] == 1.0
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## CLI
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
python -m evalvcr --help
|
|
64
|
+
python -m evalvcr run ./evals --mode replay
|
|
65
|
+
python -m evalvcr inspect .evalvcr/cassettes/demo.evalvcr.json
|
|
66
|
+
python -m evalvcr scrub .evalvcr/cassettes/demo.evalvcr.json --write
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
MIT — see https://github.com/evalvcr/evalvcr
|
evalvcr-0.1.0/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# `evalvcr` (Python Companion)
|
|
2
|
+
|
|
3
|
+
Local-first AI-agent & MCP evaluation and deterministic VCR cassette testing suite — pure Python (`>= 3.10`, zero required external runtime dependencies) with a guarded `pytest11` plugin.
|
|
4
|
+
|
|
5
|
+
Shares exact byte-level `evalvcr.cassette.v1` and `evalvcr.report.v1` camelCase + JCS canonical JSON + SHA-256 parity with the TypeScript `evalvcr` packages so cassettes recorded in TypeScript replay strictly in Python and vice versa.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install evalvcr
|
|
11
|
+
# With optional pytest plugin support:
|
|
12
|
+
pip install "evalvcr[pytest]"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick Start (`pytest`)
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
import pytest
|
|
19
|
+
from evalvcr import CassetteVCR, exact_match
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.mark.evalvcr(mode="auto", cassette="weather-agent")
|
|
23
|
+
def test_agent_replay(evalvcr_cassette: CassetteVCR) -> None:
|
|
24
|
+
interaction = evalvcr_cassette.interact(
|
|
25
|
+
kind="llm.chat",
|
|
26
|
+
provider="anthropic",
|
|
27
|
+
request={"method": "POST", "target": "/v1/messages", "body": {"prompt": "hi"}},
|
|
28
|
+
execute=lambda: {"response": {"status": 200, "sdk": {"text": "hello"}}},
|
|
29
|
+
)
|
|
30
|
+
res = exact_match()({"output": interaction["response"]["sdk"]["text"], "expected": "hello"})
|
|
31
|
+
assert res["score"] == 1.0
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## CLI
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
python -m evalvcr --help
|
|
38
|
+
python -m evalvcr run ./evals --mode replay
|
|
39
|
+
python -m evalvcr inspect .evalvcr/cassettes/demo.evalvcr.json
|
|
40
|
+
python -m evalvcr scrub .evalvcr/cassettes/demo.evalvcr.json --write
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
MIT — see https://github.com/evalvcr/evalvcr
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "evalvcr"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Local-first AI-agent & MCP evaluation and deterministic VCR cassette testing suite"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "evalvcr contributors" }
|
|
15
|
+
]
|
|
16
|
+
keywords = ["ai", "eval", "vcr", "mcp", "testing", "agents", "llm", "pytest"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 4 - Beta",
|
|
19
|
+
"Framework :: Pytest",
|
|
20
|
+
"Intended Audience :: Developers",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Topic :: Software Development :: Testing",
|
|
25
|
+
]
|
|
26
|
+
dependencies = []
|
|
27
|
+
|
|
28
|
+
[project.optional-dependencies]
|
|
29
|
+
pytest = ["pytest>=7.0"]
|
|
30
|
+
dev = ["pytest>=7.0"]
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://github.com/evalvcr/evalvcr"
|
|
34
|
+
Repository = "https://github.com/evalvcr/evalvcr"
|
|
35
|
+
Issues = "https://github.com/evalvcr/evalvcr/issues"
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
evalvcr = "evalvcr.cli:main"
|
|
39
|
+
|
|
40
|
+
[project.entry-points.pytest11]
|
|
41
|
+
evalvcr = "evalvcr.pytest_plugin"
|
|
42
|
+
|
|
43
|
+
[tool.setuptools]
|
|
44
|
+
package-dir = { "" = "src" }
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.packages.find]
|
|
47
|
+
where = ["src"]
|
|
48
|
+
include = ["evalvcr*"]
|
evalvcr-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# python/evalvcr/src/evalvcr/__init__.py
|
|
2
|
+
# language: Python >= 3.10 | zero external runtime dependencies | public exports for evalvcr
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from evalvcr.cassette import (
|
|
7
|
+
CassetteDriftError,
|
|
8
|
+
CassetteMissError,
|
|
9
|
+
CassetteVCR,
|
|
10
|
+
InvalidCassetteError,
|
|
11
|
+
VCREngine,
|
|
12
|
+
build_fingerprint_envelope,
|
|
13
|
+
canonical_json,
|
|
14
|
+
compute_fingerprint,
|
|
15
|
+
diff_values,
|
|
16
|
+
sanitize_cassette_name,
|
|
17
|
+
validate_cassette_v1,
|
|
18
|
+
validate_report_v1,
|
|
19
|
+
with_vcr,
|
|
20
|
+
)
|
|
21
|
+
from evalvcr.interceptors import (
|
|
22
|
+
wrap_client,
|
|
23
|
+
wrap_http_call,
|
|
24
|
+
wrap_mcp_http,
|
|
25
|
+
wrap_mcp_stdio,
|
|
26
|
+
)
|
|
27
|
+
from evalvcr.report import (
|
|
28
|
+
build_report,
|
|
29
|
+
format_pretty,
|
|
30
|
+
to_markdown,
|
|
31
|
+
to_sarif,
|
|
32
|
+
)
|
|
33
|
+
from evalvcr.runner import (
|
|
34
|
+
EvalContext,
|
|
35
|
+
clear_registered_suites,
|
|
36
|
+
define_eval,
|
|
37
|
+
get_registered_suites,
|
|
38
|
+
report_trace,
|
|
39
|
+
run_evals,
|
|
40
|
+
)
|
|
41
|
+
from evalvcr.scorers import (
|
|
42
|
+
Scorer,
|
|
43
|
+
clamp_score,
|
|
44
|
+
contains,
|
|
45
|
+
create_scorer,
|
|
46
|
+
exact_match,
|
|
47
|
+
json_schema,
|
|
48
|
+
latency_budget,
|
|
49
|
+
levenshtein_similarity,
|
|
50
|
+
llm_judge,
|
|
51
|
+
normalize_score,
|
|
52
|
+
pii_leak_guard,
|
|
53
|
+
prompt_injection_guard,
|
|
54
|
+
secret_leak_guard,
|
|
55
|
+
sql_destructive_guard,
|
|
56
|
+
test_integrity_guard,
|
|
57
|
+
token_cost_budget,
|
|
58
|
+
tool_call_accuracy,
|
|
59
|
+
tool_call_order,
|
|
60
|
+
)
|
|
61
|
+
from evalvcr.scrub import (
|
|
62
|
+
REDACTED_PII,
|
|
63
|
+
REDACTED_SECRET,
|
|
64
|
+
SENSITIVE_HEADER_NAMES,
|
|
65
|
+
passes_luhn,
|
|
66
|
+
scrub_cassette,
|
|
67
|
+
scrub_headers,
|
|
68
|
+
scrub_headers_detailed,
|
|
69
|
+
scrub_text,
|
|
70
|
+
scrub_text_detailed,
|
|
71
|
+
scrub_value,
|
|
72
|
+
scrub_value_detailed,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
__version__ = "0.1.0"
|
|
76
|
+
|
|
77
|
+
__all__ = [
|
|
78
|
+
"__version__",
|
|
79
|
+
"REDACTED_PII",
|
|
80
|
+
"REDACTED_SECRET",
|
|
81
|
+
"SENSITIVE_HEADER_NAMES",
|
|
82
|
+
"passes_luhn",
|
|
83
|
+
"scrub_text",
|
|
84
|
+
"scrub_text_detailed",
|
|
85
|
+
"scrub_headers",
|
|
86
|
+
"scrub_headers_detailed",
|
|
87
|
+
"scrub_value",
|
|
88
|
+
"scrub_value_detailed",
|
|
89
|
+
"scrub_cassette",
|
|
90
|
+
"canonical_json",
|
|
91
|
+
"build_fingerprint_envelope",
|
|
92
|
+
"compute_fingerprint",
|
|
93
|
+
"sanitize_cassette_name",
|
|
94
|
+
"diff_values",
|
|
95
|
+
"validate_cassette_v1",
|
|
96
|
+
"validate_report_v1",
|
|
97
|
+
"CassetteMissError",
|
|
98
|
+
"CassetteDriftError",
|
|
99
|
+
"InvalidCassetteError",
|
|
100
|
+
"CassetteVCR",
|
|
101
|
+
"VCREngine",
|
|
102
|
+
"with_vcr",
|
|
103
|
+
"build_report",
|
|
104
|
+
"to_sarif",
|
|
105
|
+
"to_markdown",
|
|
106
|
+
"format_pretty",
|
|
107
|
+
"EvalContext",
|
|
108
|
+
"define_eval",
|
|
109
|
+
"run_evals",
|
|
110
|
+
"report_trace",
|
|
111
|
+
"get_registered_suites",
|
|
112
|
+
"clear_registered_suites",
|
|
113
|
+
"Scorer",
|
|
114
|
+
"clamp_score",
|
|
115
|
+
"normalize_score",
|
|
116
|
+
"create_scorer",
|
|
117
|
+
"exact_match",
|
|
118
|
+
"contains",
|
|
119
|
+
"json_schema",
|
|
120
|
+
"tool_call_accuracy",
|
|
121
|
+
"tool_call_order",
|
|
122
|
+
"latency_budget",
|
|
123
|
+
"token_cost_budget",
|
|
124
|
+
"levenshtein_similarity",
|
|
125
|
+
"pii_leak_guard",
|
|
126
|
+
"prompt_injection_guard",
|
|
127
|
+
"sql_destructive_guard",
|
|
128
|
+
"secret_leak_guard",
|
|
129
|
+
"test_integrity_guard",
|
|
130
|
+
"llm_judge",
|
|
131
|
+
"wrap_client",
|
|
132
|
+
"wrap_http_call",
|
|
133
|
+
"wrap_mcp_stdio",
|
|
134
|
+
"wrap_mcp_http",
|
|
135
|
+
]
|