config¶
Project configuration — loading, path-containment validation, and the Project model.
config
¶
Load and validate a verification project file (YAML).
Project(analysis_name, data_path, base_dir, seed=None, python_module=None, r_script=None, checks=dict(), group_checks=list(), spot_checks=list(), transform_checks=list(), tolerance=dict(), metadata=dict(), reproducibility=dict(), allow_external_paths=False)
dataclass
¶
Hold a parsed and resolvable verification project specification.
Built by :meth:load from a YAML project file; paths are resolved relative to the
file's directory (base_dir). Use :meth:validate to check the resolved project
for problems before running it.
Attributes:
| Name | Type | Description |
|---|---|---|
analysis_name |
str
|
Human-readable analysis name; defaults to the project file stem. |
data_path |
Path
|
Resolved path to the dataset to verify. |
base_dir |
Path
|
Directory containing the project file; the root for relative paths and the external-path containment check. |
seed |
int | None
|
Optional random seed passed to adapter steps that accept one. |
python_module |
Path | None
|
Resolved path to the Python analysis module to verify, if declared. |
r_script |
Path | None
|
Resolved path to the independent R script, if declared. |
checks |
dict
|
Mapping of declared value checks. |
group_checks |
list
|
List of declared group-wise check specifications. |
spot_checks |
list
|
List of declared spot-check specifications. |
transform_checks |
list
|
List of declared Phase 2 transformation-check specifications. |
tolerance |
dict
|
Tolerance configuration, with |
metadata |
dict
|
Free-form project metadata mapping. |
reproducibility |
dict
|
Reproducibility configuration mapping. |
allow_external_paths |
bool
|
When |
load(path)
classmethod
¶
Load a project from a YAML file, resolving its paths relative to that file.
Relative data, python.module, and r.script paths are resolved against
the project file's directory; absolute paths are kept as-is. Tolerance defaults
(default_atol, default_rtol) are filled in when not specified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path to the YAML project file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
A |
Project
|
class: |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
ValueError
|
If the file omits the required |
Source code in crossverify/config.py
validate(*, force_contain=False)
¶
Check the resolved project and return human-readable problems.
Verifies that the dataset and declared Python module exist, that any declared R
script exists, and — unless allow_external_paths is set — that data,
python.module, and r.script all resolve inside base_dir.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force_contain
|
bool
|
When |
False
|
Returns:
| Type | Description |
|---|---|
list
|
A list of human-readable problem strings; an empty list means the project is |
list
|
valid. |
Source code in crossverify/config.py
_within_base(path, base)
¶
Report whether path resolves to a location inside base.
Used to keep a project file from pointing its data/scripts at arbitrary
locations on disk (absolute paths or .. traversal).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Candidate path to test, resolved before comparison. |
required | |
base
|
Base directory the path must resolve inside, resolved before comparison. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|