aspice-eval 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.
Files changed (41) hide show
  1. aspice_eval-0.1.0/MANIFEST.in +2 -0
  2. aspice_eval-0.1.0/PKG-INFO +234 -0
  3. aspice_eval-0.1.0/README.md +199 -0
  4. aspice_eval-0.1.0/knowledge_base/aspice/_metadata.yaml +62 -0
  5. aspice_eval-0.1.0/knowledge_base/aspice/man.yaml +306 -0
  6. aspice_eval-0.1.0/knowledge_base/aspice/sup.yaml +483 -0
  7. aspice_eval-0.1.0/knowledge_base/aspice/swe.yaml +1197 -0
  8. aspice_eval-0.1.0/knowledge_base/aspice/sys.yaml +432 -0
  9. aspice_eval-0.1.0/knowledge_base/schema/criteria_schema.json +168 -0
  10. aspice_eval-0.1.0/pyproject.toml +65 -0
  11. aspice_eval-0.1.0/setup.cfg +4 -0
  12. aspice_eval-0.1.0/src/aspice_eval/__init__.py +71 -0
  13. aspice_eval-0.1.0/src/aspice_eval/cli.py +343 -0
  14. aspice_eval-0.1.0/src/aspice_eval/convenience.py +218 -0
  15. aspice_eval-0.1.0/src/aspice_eval/evaluator.py +737 -0
  16. aspice_eval-0.1.0/src/aspice_eval/exceptions.py +113 -0
  17. aspice_eval-0.1.0/src/aspice_eval/kb_validator.py +239 -0
  18. aspice_eval-0.1.0/src/aspice_eval/knowledge_base/aspice/_metadata.yaml +62 -0
  19. aspice_eval-0.1.0/src/aspice_eval/knowledge_base/aspice/man.yaml +306 -0
  20. aspice_eval-0.1.0/src/aspice_eval/knowledge_base/aspice/sup.yaml +483 -0
  21. aspice_eval-0.1.0/src/aspice_eval/knowledge_base/aspice/swe.yaml +1197 -0
  22. aspice_eval-0.1.0/src/aspice_eval/knowledge_base/aspice/sys.yaml +432 -0
  23. aspice_eval-0.1.0/src/aspice_eval/knowledge_base/schema/criteria_schema.json +168 -0
  24. aspice_eval-0.1.0/src/aspice_eval/knowledge_base.py +564 -0
  25. aspice_eval-0.1.0/src/aspice_eval/level_calculator.py +231 -0
  26. aspice_eval-0.1.0/src/aspice_eval/models.py +198 -0
  27. aspice_eval-0.1.0/src/aspice_eval/providers/__init__.py +134 -0
  28. aspice_eval-0.1.0/src/aspice_eval/providers/anthropic_provider.py +86 -0
  29. aspice_eval-0.1.0/src/aspice_eval/providers/bedrock.py +96 -0
  30. aspice_eval-0.1.0/src/aspice_eval/providers/openai_provider.py +87 -0
  31. aspice_eval-0.1.0/src/aspice_eval/py.typed +1 -0
  32. aspice_eval-0.1.0/src/aspice_eval/report_generator.py +547 -0
  33. aspice_eval-0.1.0/src/aspice_eval/report_renderer.py +113 -0
  34. aspice_eval-0.1.0/src/aspice_eval/sdp_ingester.py +72 -0
  35. aspice_eval-0.1.0/src/aspice_eval.egg-info/PKG-INFO +234 -0
  36. aspice_eval-0.1.0/src/aspice_eval.egg-info/SOURCES.txt +39 -0
  37. aspice_eval-0.1.0/src/aspice_eval.egg-info/dependency_links.txt +1 -0
  38. aspice_eval-0.1.0/src/aspice_eval.egg-info/entry_points.txt +2 -0
  39. aspice_eval-0.1.0/src/aspice_eval.egg-info/not-zip-safe +1 -0
  40. aspice_eval-0.1.0/src/aspice_eval.egg-info/requires.txt +21 -0
  41. aspice_eval-0.1.0/src/aspice_eval.egg-info/top_level.txt +1 -0
@@ -0,0 +1,2 @@
1
+ recursive-include src/aspice_eval/knowledge_base *.yaml *.json
2
+ recursive-include knowledge_base *.yaml *.json
@@ -0,0 +1,234 @@
1
+ Metadata-Version: 2.4
2
+ Name: aspice-eval
3
+ Version: 0.1.0
4
+ Summary: ASPICE Knowledge Base & Agent Workflow evaluation tool for SDP gap analysis
5
+ Author: ASPICE Eval Contributors
6
+ License: MIT
7
+ Keywords: aspice,automotive,compliance,gap-analysis,spice
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: Software Development :: Quality Assurance
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ Requires-Dist: pyyaml>=6.0
20
+ Requires-Dist: jsonschema>=4.20.0
21
+ Requires-Dist: click>=8.1.0
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
24
+ Requires-Dist: hypothesis>=6.90.0; extra == "dev"
25
+ Provides-Extra: bedrock
26
+ Requires-Dist: boto3>=1.34.0; extra == "bedrock"
27
+ Provides-Extra: openai
28
+ Requires-Dist: openai>=1.0.0; extra == "openai"
29
+ Provides-Extra: anthropic
30
+ Requires-Dist: anthropic>=0.30.0; extra == "anthropic"
31
+ Provides-Extra: all
32
+ Requires-Dist: boto3>=1.34.0; extra == "all"
33
+ Requires-Dist: openai>=1.0.0; extra == "all"
34
+ Requires-Dist: anthropic>=0.30.0; extra == "all"
35
+
36
+ # aspice-eval
37
+
38
+ ASPICE evaluation engine — knowledge base, gap analysis evaluator, and reports.
39
+
40
+ ## Library Usage
41
+
42
+ ### Evaluate an SDP
43
+
44
+ ```python
45
+ from aspice_eval import evaluate_sdp, ModelConfig
46
+
47
+ result = evaluate_sdp(
48
+ "docs/sdp.md",
49
+ ModelConfig(
50
+ provider="bedrock",
51
+ model_name="us.anthropic.claude-sonnet-4-20250514-v1:0",
52
+ region="us-east-1",
53
+ ),
54
+ target_level=3,
55
+ process_groups=["SWE", "SYS"],
56
+ )
57
+
58
+ print(f"Criteria assessed: {len(result.ratings)}")
59
+ print(f"Gaps found: {len([r for r in result.ratings if r.gaps])}")
60
+ print(f"Tokens used: {result.token_usage['total_tokens']}")
61
+ ```
62
+
63
+ ### Validate a Knowledge Base
64
+
65
+ ```python
66
+ from aspice_eval import validate_kb
67
+
68
+ result = validate_kb("knowledge_base")
69
+
70
+ if not result.is_valid:
71
+ for error in result.schema_errors:
72
+ print(f"Schema error: {error}")
73
+ for gap in result.completeness_gaps:
74
+ print(f"Completeness gap: {gap}")
75
+ else:
76
+ print("Knowledge base is valid")
77
+ ```
78
+
79
+ ## Extension Points
80
+
81
+ ### Custom Evaluator
82
+
83
+ Subclass `GapAnalysisEvaluator` to plug in a custom LLM provider or rule-based engine:
84
+
85
+ ```python
86
+ from aspice_eval import GapAnalysisEvaluator, ModelConfig, register_evaluator
87
+
88
+ class LocalLlamaEvaluator(GapAnalysisEvaluator):
89
+ """Evaluator using a local Llama model."""
90
+
91
+ def _call_model(self, prompt: str) -> str:
92
+ # Call your local model and return JSON response
93
+ ...
94
+
95
+ # Register the custom provider
96
+ register_evaluator("local-llama", LocalLlamaEvaluator)
97
+
98
+ # Use it via the standard factory
99
+ from aspice_eval import create_evaluator
100
+
101
+ evaluator = create_evaluator(ModelConfig(provider="local-llama"))
102
+ ```
103
+
104
+ ### Custom Knowledge Base Standards
105
+
106
+ Three levels of extensibility for non-ASPICE standards:
107
+
108
+ **Level 1 — Custom YAML files (no code required):**
109
+
110
+ Drop a new subdirectory under the KB root with YAML files conforming to the criteria schema:
111
+
112
+ ```
113
+ knowledge_base/
114
+ ├── aspice/ # Built-in ASPICE v4.0
115
+ └── iso26262/ # Your custom standard
116
+ ├── _metadata.yaml
117
+ └── functional_safety.yaml
118
+ ```
119
+
120
+ ```python
121
+ from aspice_eval import evaluate_sdp, ModelConfig
122
+
123
+ result = evaluate_sdp(
124
+ "docs/sdp.md",
125
+ ModelConfig(provider="bedrock", model_name="...", region="us-east-1"),
126
+ standard="iso26262",
127
+ )
128
+ ```
129
+
130
+ **Level 2 — In-memory construction via `from_dict`:**
131
+
132
+ ```python
133
+ from aspice_eval import KnowledgeBase
134
+
135
+ kb = KnowledgeBase.from_dict({
136
+ "processes": [
137
+ {
138
+ "process_id": "SWE.1",
139
+ "process_name": "Software Requirements Analysis",
140
+ "criteria": [...],
141
+ }
142
+ ]
143
+ })
144
+ criteria = kb.get_criteria(groups=["SWE"], max_level=3)
145
+ ```
146
+
147
+ **Level 3 — Custom KB loader (pluggable schema):**
148
+
149
+ For standards with fundamentally different structures, subclass `KnowledgeBase` and register a loader:
150
+
151
+ ```python
152
+ from aspice_eval import KnowledgeBase, register_kb_loader, CriteriaEntry
153
+
154
+ class NISTCSFKnowledgeBase(KnowledgeBase):
155
+ """Custom loader for NIST Cybersecurity Framework."""
156
+
157
+ def load(self, standard: str) -> None:
158
+ # Read NIST-shaped YAML/JSON, convert to CriteriaEntry list
159
+ ...
160
+
161
+ def get_criteria(self, groups, max_level) -> list[CriteriaEntry]:
162
+ # Return entries filtered by NIST "Functions" instead of ASPICE groups
163
+ ...
164
+
165
+ register_kb_loader("nist-csf", NISTCSFKnowledgeBase)
166
+ ```
167
+
168
+ ### Custom Report Renderer
169
+
170
+ Subclass `ReportRenderer` to output evaluation results in formats beyond Markdown and HTML:
171
+
172
+ ```python
173
+ from aspice_eval import ReportRenderer, register_renderer
174
+ from aspice_eval import EvaluationResult, CapabilityLevelResult, EvaluationConfig
175
+
176
+ class JSONReportRenderer(ReportRenderer):
177
+ """Render evaluation results as JSON."""
178
+
179
+ def render(self, evaluation, levels, config, kb_metadata) -> str:
180
+ import json
181
+ return json.dumps({
182
+ "ratings": [
183
+ {"criteria_id": r.criteria_id, "rating": r.rating, "gaps": r.gaps}
184
+ for r in evaluation.ratings
185
+ ],
186
+ }, indent=2)
187
+
188
+ # Register and use
189
+ register_renderer("json", JSONReportRenderer)
190
+ ```
191
+
192
+ ## CLI Usage
193
+
194
+ ### aspice-eval evaluate
195
+
196
+ ```bash
197
+ # Evaluate an SDP document
198
+ aspice-eval evaluate --sdp path/to/sdp.md --target-level 2 --groups SWE,MAN
199
+
200
+ # Write report to a file
201
+ aspice-eval evaluate --sdp path/to/sdp.md --output report.md
202
+
203
+ # Use a specific AI provider
204
+ aspice-eval evaluate --sdp path/to/sdp.md --provider bedrock \
205
+ --model us.anthropic.claude-sonnet-4-20250514-v1:0 --region us-east-1
206
+ ```
207
+
208
+ ### aspice-eval validate-kb
209
+
210
+ ```bash
211
+ # Validate the default knowledge base
212
+ aspice-eval validate-kb
213
+
214
+ # Validate a custom knowledge base
215
+ aspice-eval validate-kb --kb-path /path/to/knowledge_base
216
+ ```
217
+
218
+ ## Installation
219
+
220
+ ```bash
221
+ pip install aspice-eval
222
+
223
+ # With AI provider support
224
+ pip install "aspice-eval[bedrock]" # Amazon Bedrock (Claude)
225
+ pip install "aspice-eval[openai]" # OpenAI GPT-4o
226
+ pip install "aspice-eval[anthropic]" # Anthropic Claude (direct API)
227
+ pip install "aspice-eval[all]" # All providers
228
+ ```
229
+
230
+ Requires Python 3.10+.
231
+
232
+ ## License
233
+
234
+ MIT
@@ -0,0 +1,199 @@
1
+ # aspice-eval
2
+
3
+ ASPICE evaluation engine — knowledge base, gap analysis evaluator, and reports.
4
+
5
+ ## Library Usage
6
+
7
+ ### Evaluate an SDP
8
+
9
+ ```python
10
+ from aspice_eval import evaluate_sdp, ModelConfig
11
+
12
+ result = evaluate_sdp(
13
+ "docs/sdp.md",
14
+ ModelConfig(
15
+ provider="bedrock",
16
+ model_name="us.anthropic.claude-sonnet-4-20250514-v1:0",
17
+ region="us-east-1",
18
+ ),
19
+ target_level=3,
20
+ process_groups=["SWE", "SYS"],
21
+ )
22
+
23
+ print(f"Criteria assessed: {len(result.ratings)}")
24
+ print(f"Gaps found: {len([r for r in result.ratings if r.gaps])}")
25
+ print(f"Tokens used: {result.token_usage['total_tokens']}")
26
+ ```
27
+
28
+ ### Validate a Knowledge Base
29
+
30
+ ```python
31
+ from aspice_eval import validate_kb
32
+
33
+ result = validate_kb("knowledge_base")
34
+
35
+ if not result.is_valid:
36
+ for error in result.schema_errors:
37
+ print(f"Schema error: {error}")
38
+ for gap in result.completeness_gaps:
39
+ print(f"Completeness gap: {gap}")
40
+ else:
41
+ print("Knowledge base is valid")
42
+ ```
43
+
44
+ ## Extension Points
45
+
46
+ ### Custom Evaluator
47
+
48
+ Subclass `GapAnalysisEvaluator` to plug in a custom LLM provider or rule-based engine:
49
+
50
+ ```python
51
+ from aspice_eval import GapAnalysisEvaluator, ModelConfig, register_evaluator
52
+
53
+ class LocalLlamaEvaluator(GapAnalysisEvaluator):
54
+ """Evaluator using a local Llama model."""
55
+
56
+ def _call_model(self, prompt: str) -> str:
57
+ # Call your local model and return JSON response
58
+ ...
59
+
60
+ # Register the custom provider
61
+ register_evaluator("local-llama", LocalLlamaEvaluator)
62
+
63
+ # Use it via the standard factory
64
+ from aspice_eval import create_evaluator
65
+
66
+ evaluator = create_evaluator(ModelConfig(provider="local-llama"))
67
+ ```
68
+
69
+ ### Custom Knowledge Base Standards
70
+
71
+ Three levels of extensibility for non-ASPICE standards:
72
+
73
+ **Level 1 — Custom YAML files (no code required):**
74
+
75
+ Drop a new subdirectory under the KB root with YAML files conforming to the criteria schema:
76
+
77
+ ```
78
+ knowledge_base/
79
+ ├── aspice/ # Built-in ASPICE v4.0
80
+ └── iso26262/ # Your custom standard
81
+ ├── _metadata.yaml
82
+ └── functional_safety.yaml
83
+ ```
84
+
85
+ ```python
86
+ from aspice_eval import evaluate_sdp, ModelConfig
87
+
88
+ result = evaluate_sdp(
89
+ "docs/sdp.md",
90
+ ModelConfig(provider="bedrock", model_name="...", region="us-east-1"),
91
+ standard="iso26262",
92
+ )
93
+ ```
94
+
95
+ **Level 2 — In-memory construction via `from_dict`:**
96
+
97
+ ```python
98
+ from aspice_eval import KnowledgeBase
99
+
100
+ kb = KnowledgeBase.from_dict({
101
+ "processes": [
102
+ {
103
+ "process_id": "SWE.1",
104
+ "process_name": "Software Requirements Analysis",
105
+ "criteria": [...],
106
+ }
107
+ ]
108
+ })
109
+ criteria = kb.get_criteria(groups=["SWE"], max_level=3)
110
+ ```
111
+
112
+ **Level 3 — Custom KB loader (pluggable schema):**
113
+
114
+ For standards with fundamentally different structures, subclass `KnowledgeBase` and register a loader:
115
+
116
+ ```python
117
+ from aspice_eval import KnowledgeBase, register_kb_loader, CriteriaEntry
118
+
119
+ class NISTCSFKnowledgeBase(KnowledgeBase):
120
+ """Custom loader for NIST Cybersecurity Framework."""
121
+
122
+ def load(self, standard: str) -> None:
123
+ # Read NIST-shaped YAML/JSON, convert to CriteriaEntry list
124
+ ...
125
+
126
+ def get_criteria(self, groups, max_level) -> list[CriteriaEntry]:
127
+ # Return entries filtered by NIST "Functions" instead of ASPICE groups
128
+ ...
129
+
130
+ register_kb_loader("nist-csf", NISTCSFKnowledgeBase)
131
+ ```
132
+
133
+ ### Custom Report Renderer
134
+
135
+ Subclass `ReportRenderer` to output evaluation results in formats beyond Markdown and HTML:
136
+
137
+ ```python
138
+ from aspice_eval import ReportRenderer, register_renderer
139
+ from aspice_eval import EvaluationResult, CapabilityLevelResult, EvaluationConfig
140
+
141
+ class JSONReportRenderer(ReportRenderer):
142
+ """Render evaluation results as JSON."""
143
+
144
+ def render(self, evaluation, levels, config, kb_metadata) -> str:
145
+ import json
146
+ return json.dumps({
147
+ "ratings": [
148
+ {"criteria_id": r.criteria_id, "rating": r.rating, "gaps": r.gaps}
149
+ for r in evaluation.ratings
150
+ ],
151
+ }, indent=2)
152
+
153
+ # Register and use
154
+ register_renderer("json", JSONReportRenderer)
155
+ ```
156
+
157
+ ## CLI Usage
158
+
159
+ ### aspice-eval evaluate
160
+
161
+ ```bash
162
+ # Evaluate an SDP document
163
+ aspice-eval evaluate --sdp path/to/sdp.md --target-level 2 --groups SWE,MAN
164
+
165
+ # Write report to a file
166
+ aspice-eval evaluate --sdp path/to/sdp.md --output report.md
167
+
168
+ # Use a specific AI provider
169
+ aspice-eval evaluate --sdp path/to/sdp.md --provider bedrock \
170
+ --model us.anthropic.claude-sonnet-4-20250514-v1:0 --region us-east-1
171
+ ```
172
+
173
+ ### aspice-eval validate-kb
174
+
175
+ ```bash
176
+ # Validate the default knowledge base
177
+ aspice-eval validate-kb
178
+
179
+ # Validate a custom knowledge base
180
+ aspice-eval validate-kb --kb-path /path/to/knowledge_base
181
+ ```
182
+
183
+ ## Installation
184
+
185
+ ```bash
186
+ pip install aspice-eval
187
+
188
+ # With AI provider support
189
+ pip install "aspice-eval[bedrock]" # Amazon Bedrock (Claude)
190
+ pip install "aspice-eval[openai]" # OpenAI GPT-4o
191
+ pip install "aspice-eval[anthropic]" # Anthropic Claude (direct API)
192
+ pip install "aspice-eval[all]" # All providers
193
+ ```
194
+
195
+ Requires Python 3.10+.
196
+
197
+ ## License
198
+
199
+ MIT
@@ -0,0 +1,62 @@
1
+ standard:
2
+ name: "Automotive SPICE"
3
+ short_name: "ASPICE"
4
+ version: "4.0"
5
+ release_date: "2023-12"
6
+ source_references:
7
+ - title: "VDA Automotive SPICE Guidelines"
8
+ url: "https://www.automotivespice.com"
9
+ - title: "Wikipedia — Automotive SPICE"
10
+ url: "https://en.wikipedia.org/wiki/Automotive_SPICE"
11
+ license_note: >
12
+ Knowledge base content is derived from the Automotive SPICE PAM v4.0
13
+ (publicly available from vda-qmc.de). Base practice and generic practice
14
+ descriptions are reproduced under the PAM copyright release notice for
15
+ use in process assessment tooling.
16
+ kb_version: "2.0.0"
17
+ last_updated: "2026-05-01"
18
+ process_groups:
19
+ - code: "SWE"
20
+ name: "Software Engineering"
21
+ processes: ["SWE.1", "SWE.2", "SWE.3", "SWE.4", "SWE.5", "SWE.6"]
22
+ - code: "SYS"
23
+ name: "System Engineering"
24
+ processes: ["SYS.1", "SYS.2", "SYS.3", "SYS.4", "SYS.5"]
25
+ - code: "MAN"
26
+ name: "Management"
27
+ processes: ["MAN.3", "MAN.5", "MAN.6"]
28
+ - code: "SUP"
29
+ name: "Support"
30
+ processes: ["SUP.1", "SUP.8", "SUP.9", "SUP.10", "SUP.11"]
31
+ capability_levels:
32
+ - level: 0
33
+ name: "Incomplete"
34
+ process_attributes: []
35
+ - level: 1
36
+ name: "Performed"
37
+ process_attributes: ["PA 1.1"]
38
+ - level: 2
39
+ name: "Managed"
40
+ process_attributes: ["PA 2.1", "PA 2.2"]
41
+ - level: 3
42
+ name: "Established"
43
+ process_attributes: ["PA 3.1", "PA 3.2"]
44
+ - level: 4
45
+ name: "Predictable"
46
+ process_attributes: ["PA 4.1", "PA 4.2"]
47
+ - level: 5
48
+ name: "Innovating"
49
+ process_attributes: ["PA 5.1", "PA 5.2"]
50
+ rating_scale:
51
+ - rating: "Fully achieved"
52
+ abbreviation: "F"
53
+ range: "86-100%"
54
+ - rating: "Largely achieved"
55
+ abbreviation: "L"
56
+ range: "51-85%"
57
+ - rating: "Partially achieved"
58
+ abbreviation: "P"
59
+ range: "16-50%"
60
+ - rating: "Not achieved"
61
+ abbreviation: "N"
62
+ range: "0-15%"