datadile 0.1.0__py3-none-any.whl
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.
- datadile/__init__.py +3 -0
- datadile/config.py +125 -0
- datadile/core.py +270 -0
- datadile/script_context.py +167 -0
- datadile/search.py +61 -0
- datadile/skill/SKILL.md +102 -0
- datadile/skill/__init__.py +0 -0
- datadile-0.1.0.dist-info/METADATA +340 -0
- datadile-0.1.0.dist-info/RECORD +12 -0
- datadile-0.1.0.dist-info/WHEEL +4 -0
- datadile-0.1.0.dist-info/entry_points.txt +2 -0
- datadile-0.1.0.dist-info/licenses/LICENSE +201 -0
datadile/__init__.py
ADDED
datadile/config.py
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
import yaml
|
|
6
|
+
|
|
7
|
+
CONFIG_FILENAME = "datadile.yaml"
|
|
8
|
+
USER_CONFIG_PATH = Path.home() / ".datadile" / CONFIG_FILENAME
|
|
9
|
+
DEFAULT_API_KEY_ENV = "DATADILE_API_KEY"
|
|
10
|
+
DEFAULT_DATA_SOURCE_PASSWORD_ENV = "DATADILE_DATA_SOURCE_PASSWORD"
|
|
11
|
+
|
|
12
|
+
CONFIG_TEMPLATE = """\
|
|
13
|
+
# Optional. Only required for premium server-backed features.
|
|
14
|
+
api_key_env: DATADILE_API_KEY
|
|
15
|
+
|
|
16
|
+
# Optional. Used by tests that do not set data_source.
|
|
17
|
+
default_data_source: main
|
|
18
|
+
|
|
19
|
+
data_sources:
|
|
20
|
+
main:
|
|
21
|
+
type: postgresql
|
|
22
|
+
host: localhost
|
|
23
|
+
port: 5432
|
|
24
|
+
user: myuser
|
|
25
|
+
database: mydb
|
|
26
|
+
password_env: DATADILE_DATA_SOURCE_PASSWORD
|
|
27
|
+
|
|
28
|
+
# Premium server-backed data source example:
|
|
29
|
+
# data_sources:
|
|
30
|
+
# main:
|
|
31
|
+
# id: ds_abc123
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _find_config_file() -> Path | None:
|
|
36
|
+
local = Path(CONFIG_FILENAME)
|
|
37
|
+
if local.exists():
|
|
38
|
+
return local
|
|
39
|
+
if USER_CONFIG_PATH.exists():
|
|
40
|
+
return USER_CONFIG_PATH
|
|
41
|
+
return None
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def load_config(required: bool = True) -> dict[str, Any]:
|
|
45
|
+
config_path = _find_config_file()
|
|
46
|
+
if config_path is None:
|
|
47
|
+
if not required:
|
|
48
|
+
return {}
|
|
49
|
+
raise FileNotFoundError(
|
|
50
|
+
f"No config file found. Create one at:\n"
|
|
51
|
+
f" ./{CONFIG_FILENAME}\n"
|
|
52
|
+
f" {USER_CONFIG_PATH}\n\n"
|
|
53
|
+
f"Template:\n{CONFIG_TEMPLATE}"
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
with config_path.open() as f:
|
|
57
|
+
config = yaml.safe_load(f) or {}
|
|
58
|
+
|
|
59
|
+
if not isinstance(config, dict):
|
|
60
|
+
raise ValueError(f"Config file {config_path} must contain a YAML mapping.")
|
|
61
|
+
return config
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def get_api_key() -> str | None:
|
|
65
|
+
config = load_config(required=False)
|
|
66
|
+
if config.get("api_key"):
|
|
67
|
+
raise ValueError("Do not put API keys in datadile.yaml. Use api_key_env instead.")
|
|
68
|
+
|
|
69
|
+
api_key_env = str(config.get("api_key_env", DEFAULT_API_KEY_ENV))
|
|
70
|
+
return os.environ.get(api_key_env)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def get_api_host() -> str:
|
|
74
|
+
config = load_config(required=False)
|
|
75
|
+
return str(config.get("api_host", "datadile.io"))
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _resolve_data_source_config(data_source: Any, label: str) -> dict[str, Any]:
|
|
79
|
+
if not isinstance(data_source, dict):
|
|
80
|
+
raise KeyError(f"Missing {label} mapping in config file.")
|
|
81
|
+
|
|
82
|
+
if data_source.get("id"):
|
|
83
|
+
api_key = get_api_key()
|
|
84
|
+
if not api_key:
|
|
85
|
+
api_key_env = str(load_config(required=False).get("api_key_env", DEFAULT_API_KEY_ENV))
|
|
86
|
+
raise ValueError(
|
|
87
|
+
f"{label}.id requires an API key for server-backed data source access. "
|
|
88
|
+
f"Set the {api_key_env} environment variable."
|
|
89
|
+
)
|
|
90
|
+
return {"id": str(data_source["id"]), "api_key": api_key, "api_host": get_api_host()}
|
|
91
|
+
|
|
92
|
+
if data_source.get("password"):
|
|
93
|
+
raise ValueError(f"Do not put data source passwords in datadile.yaml. Use password_env instead.")
|
|
94
|
+
|
|
95
|
+
password_env = str(data_source.get("password_env", DEFAULT_DATA_SOURCE_PASSWORD_ENV))
|
|
96
|
+
password = os.environ.get(password_env)
|
|
97
|
+
if not password:
|
|
98
|
+
raise ValueError(f"Missing data source password. Set the {password_env} environment variable.")
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
"type": data_source.get("type", "postgresql"),
|
|
102
|
+
"host": data_source.get("host", "localhost"),
|
|
103
|
+
"port": int(data_source.get("port", 5432)),
|
|
104
|
+
"user": data_source.get("user"),
|
|
105
|
+
"password": password,
|
|
106
|
+
"database": data_source.get("database"),
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def get_data_source_config(name: str | None = None) -> dict[str, Any]:
|
|
111
|
+
config = load_config()
|
|
112
|
+
|
|
113
|
+
data_sources = config.get("data_sources")
|
|
114
|
+
if not isinstance(data_sources, dict):
|
|
115
|
+
raise KeyError("Missing data_sources mapping in config file.")
|
|
116
|
+
|
|
117
|
+
data_source_name = name or config.get("default_data_source")
|
|
118
|
+
if not data_source_name:
|
|
119
|
+
raise ValueError("Missing data source. Add default_data_source to datadile.yaml or data_source to the test.")
|
|
120
|
+
|
|
121
|
+
data_source_name = str(data_source_name)
|
|
122
|
+
if data_source_name not in data_sources:
|
|
123
|
+
raise KeyError(f"Unknown data source '{data_source_name}' in config file.")
|
|
124
|
+
|
|
125
|
+
return _resolve_data_source_config(data_sources[data_source_name], f"data_sources.{data_source_name}")
|
datadile/core.py
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import ast
|
|
3
|
+
import operator
|
|
4
|
+
import shutil
|
|
5
|
+
import sys
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from decimal import Decimal
|
|
8
|
+
from importlib import resources
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Any, Callable
|
|
11
|
+
|
|
12
|
+
import yaml
|
|
13
|
+
from rich.console import Console
|
|
14
|
+
from rich.table import Table
|
|
15
|
+
from sqlalchemy import create_engine, text
|
|
16
|
+
|
|
17
|
+
from .config import get_data_source_config
|
|
18
|
+
|
|
19
|
+
console = Console()
|
|
20
|
+
|
|
21
|
+
DATA_TEST_FILE_PATTERN = "*.dile.yaml"
|
|
22
|
+
DEFAULT_SKILL_INSTALL_PATH = Path(".opencode") / "skills" / "datadile" / "SKILL.md"
|
|
23
|
+
SEVERITIES = {"LOW", "MEDIUM", "HIGH"}
|
|
24
|
+
EXPECT_OPERATORS = {
|
|
25
|
+
">=": operator.ge,
|
|
26
|
+
"<=": operator.le,
|
|
27
|
+
"!=": operator.ne,
|
|
28
|
+
"=": operator.eq,
|
|
29
|
+
">": operator.gt,
|
|
30
|
+
"<": operator.lt,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@dataclass(frozen=True)
|
|
35
|
+
class DataTest:
|
|
36
|
+
name: str
|
|
37
|
+
description: str
|
|
38
|
+
query: str
|
|
39
|
+
expect: str
|
|
40
|
+
severity: str = "MEDIUM"
|
|
41
|
+
data_source: str | None = None
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass(frozen=True)
|
|
45
|
+
class DataTestResult:
|
|
46
|
+
test: DataTest
|
|
47
|
+
actual: Any = None
|
|
48
|
+
passed: bool = False
|
|
49
|
+
error: str | None = None
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _build_postgres_connection_url(data_source_config: dict) -> str:
|
|
53
|
+
return (
|
|
54
|
+
f"postgresql+psycopg2://{data_source_config['user']}:{data_source_config['password']}"
|
|
55
|
+
f"@{data_source_config['host']}:{data_source_config['port']}/{data_source_config['database']}"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def load_data_tests(path: str | Path) -> list[DataTest]:
|
|
60
|
+
test_path = Path(path)
|
|
61
|
+
with test_path.open() as f:
|
|
62
|
+
raw = yaml.safe_load(f)
|
|
63
|
+
|
|
64
|
+
if isinstance(raw, dict) and "tests" in raw:
|
|
65
|
+
raw_tests = raw["tests"]
|
|
66
|
+
else:
|
|
67
|
+
raw_tests = raw
|
|
68
|
+
|
|
69
|
+
if not isinstance(raw_tests, list):
|
|
70
|
+
raise ValueError("Data test file must contain a list of tests or a top-level 'tests' list.")
|
|
71
|
+
|
|
72
|
+
return [_parse_data_test(item, index) for index, item in enumerate(raw_tests, start=1)]
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def discover_data_test_files(root: str | Path = ".") -> list[Path]:
|
|
76
|
+
return sorted(Path(root).rglob(DATA_TEST_FILE_PATTERN))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def _parse_data_test(raw: Any, index: int) -> DataTest:
|
|
80
|
+
if not isinstance(raw, dict):
|
|
81
|
+
raise ValueError(f"Test #{index} must be a mapping.")
|
|
82
|
+
|
|
83
|
+
missing = [field for field in ("name", "description", "query", "expect") if field not in raw]
|
|
84
|
+
if missing:
|
|
85
|
+
raise ValueError(f"Test #{index} is missing required field(s): {', '.join(missing)}.")
|
|
86
|
+
|
|
87
|
+
severity = str(raw.get("severity", "MEDIUM")).upper()
|
|
88
|
+
if severity not in SEVERITIES:
|
|
89
|
+
raise ValueError(f"Test #{index} has invalid severity '{severity}'. Use LOW, MEDIUM, or HIGH.")
|
|
90
|
+
|
|
91
|
+
return DataTest(
|
|
92
|
+
name=str(raw["name"]),
|
|
93
|
+
description=str(raw["description"]),
|
|
94
|
+
query=str(raw["query"]),
|
|
95
|
+
expect=str(raw["expect"]),
|
|
96
|
+
severity=severity,
|
|
97
|
+
data_source=str(raw["data_source"]) if raw.get("data_source") else None,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def evaluate_expectation(actual: Any, expectation: str) -> bool:
|
|
102
|
+
op_symbol, expected = _parse_expectation(expectation)
|
|
103
|
+
return EXPECT_OPERATORS[op_symbol](actual, expected)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _parse_expectation(expectation: str) -> tuple[str, Any]:
|
|
107
|
+
expression = expectation.strip()
|
|
108
|
+
for op_symbol in sorted(EXPECT_OPERATORS, key=len, reverse=True):
|
|
109
|
+
if expression.startswith(op_symbol):
|
|
110
|
+
rhs = expression[len(op_symbol) :].strip()
|
|
111
|
+
if not rhs:
|
|
112
|
+
raise ValueError(f"Expectation '{expectation}' is missing a comparison value.")
|
|
113
|
+
return op_symbol, _parse_expected_value(rhs)
|
|
114
|
+
raise ValueError(
|
|
115
|
+
f"Expectation '{expectation}' must start with one of: "
|
|
116
|
+
f"{', '.join(sorted(EXPECT_OPERATORS, key=len, reverse=True))}."
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _parse_expected_value(value: str) -> Any:
|
|
121
|
+
try:
|
|
122
|
+
return ast.literal_eval(value)
|
|
123
|
+
except (SyntaxError, ValueError):
|
|
124
|
+
return yaml.safe_load(value)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def run_data_tests(tests: list[DataTest], data_source_config: dict | Callable[[str | None], dict]) -> list[DataTestResult]:
|
|
128
|
+
query_runners: dict[str | None, Callable[[str], list[dict[str, Any]]]] = {}
|
|
129
|
+
default_run_query = None if callable(data_source_config) else _build_query_runner(data_source_config)
|
|
130
|
+
results = []
|
|
131
|
+
|
|
132
|
+
for test in tests:
|
|
133
|
+
try:
|
|
134
|
+
if callable(data_source_config):
|
|
135
|
+
if test.data_source not in query_runners:
|
|
136
|
+
query_runners[test.data_source] = _build_query_runner(data_source_config(test.data_source))
|
|
137
|
+
run_query = query_runners[test.data_source]
|
|
138
|
+
else:
|
|
139
|
+
run_query = default_run_query
|
|
140
|
+
|
|
141
|
+
rows = run_query(test.query)
|
|
142
|
+
actual = _normalize_query_result(rows)
|
|
143
|
+
passed = evaluate_expectation(actual, test.expect)
|
|
144
|
+
results.append(DataTestResult(test=test, actual=actual, passed=passed))
|
|
145
|
+
except Exception as exc:
|
|
146
|
+
results.append(DataTestResult(test=test, passed=False, error=str(exc)))
|
|
147
|
+
|
|
148
|
+
return results
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def _build_query_runner(data_source_config: dict) -> Callable[[str], list[dict[str, Any]]]:
|
|
152
|
+
if data_source_config.get("id"):
|
|
153
|
+
data_source_id = data_source_config["id"]
|
|
154
|
+
raise ValueError(
|
|
155
|
+
f"Server-backed data source '{data_source_id}' is configured, but remote test execution "
|
|
156
|
+
"is not implemented in this package yet."
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
data_source_type = str(data_source_config.get("type", "postgresql")).lower()
|
|
160
|
+
if data_source_type in {"postgres", "postgresql"}:
|
|
161
|
+
engine = create_engine(_build_postgres_connection_url(data_source_config))
|
|
162
|
+
|
|
163
|
+
def run_postgres_query(query: str) -> list[dict[str, Any]]:
|
|
164
|
+
with engine.connect() as conn:
|
|
165
|
+
return [dict(row._mapping) for row in conn.execute(text(query))]
|
|
166
|
+
|
|
167
|
+
return run_postgres_query
|
|
168
|
+
|
|
169
|
+
raise ValueError(f"Unsupported data source type '{data_source_type}'.")
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def _normalize_query_result(rows: list[dict[str, Any]]) -> Any:
|
|
173
|
+
normalized_rows = [_normalize_value(row) for row in rows]
|
|
174
|
+
if not normalized_rows:
|
|
175
|
+
return None
|
|
176
|
+
|
|
177
|
+
if len(normalized_rows) == 1:
|
|
178
|
+
row = normalized_rows[0]
|
|
179
|
+
values = list(row.values())
|
|
180
|
+
return values[0] if len(values) == 1 else row
|
|
181
|
+
|
|
182
|
+
if all(len(row) == 1 for row in normalized_rows):
|
|
183
|
+
return [next(iter(row.values())) for row in normalized_rows]
|
|
184
|
+
return normalized_rows
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def _normalize_value(value: Any) -> Any:
|
|
188
|
+
if isinstance(value, dict):
|
|
189
|
+
return {key: _normalize_value(inner) for key, inner in value.items()}
|
|
190
|
+
if isinstance(value, list):
|
|
191
|
+
return [_normalize_value(inner) for inner in value]
|
|
192
|
+
if isinstance(value, Decimal):
|
|
193
|
+
if value == value.to_integral_value():
|
|
194
|
+
return int(value)
|
|
195
|
+
return float(value)
|
|
196
|
+
return value
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def print_results(results: list[DataTestResult]) -> None:
|
|
200
|
+
table = Table(title="Datadile Data Tests")
|
|
201
|
+
table.add_column("Status")
|
|
202
|
+
table.add_column("Severity")
|
|
203
|
+
table.add_column("Name")
|
|
204
|
+
table.add_column("Expect")
|
|
205
|
+
table.add_column("Actual")
|
|
206
|
+
|
|
207
|
+
for result in results:
|
|
208
|
+
status = "PASS" if result.passed else "FAIL"
|
|
209
|
+
style = "green" if result.passed else "red"
|
|
210
|
+
actual = result.error if result.error else repr(result.actual)
|
|
211
|
+
table.add_row(
|
|
212
|
+
f"[{style}]{status}[/{style}]",
|
|
213
|
+
result.test.severity,
|
|
214
|
+
result.test.name,
|
|
215
|
+
result.test.expect,
|
|
216
|
+
actual,
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
console.print(table)
|
|
220
|
+
|
|
221
|
+
failures = [result for result in results if not result.passed]
|
|
222
|
+
console.print(f"{len(results) - len(failures)} passed, {len(failures)} failed")
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def test_command(args: argparse.Namespace) -> None:
|
|
226
|
+
test_paths = [Path(args.filepath)] if args.filepath else discover_data_test_files()
|
|
227
|
+
if not test_paths:
|
|
228
|
+
console.print(f"No data test files found matching {DATA_TEST_FILE_PATTERN}")
|
|
229
|
+
sys.exit(1)
|
|
230
|
+
|
|
231
|
+
tests = []
|
|
232
|
+
for test_path in test_paths:
|
|
233
|
+
tests.extend(load_data_tests(test_path))
|
|
234
|
+
|
|
235
|
+
results = run_data_tests(tests, get_data_source_config)
|
|
236
|
+
print_results(results)
|
|
237
|
+
|
|
238
|
+
if any(not result.passed for result in results):
|
|
239
|
+
sys.exit(1)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def install_skill_command(args: argparse.Namespace) -> None:
|
|
243
|
+
destination = Path(args.destination)
|
|
244
|
+
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
245
|
+
|
|
246
|
+
with resources.path("datadile.skill", "SKILL.md") as source:
|
|
247
|
+
shutil.copyfile(source, destination)
|
|
248
|
+
|
|
249
|
+
console.print(f"Installed Datadile skill to {destination}")
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
def main() -> None:
|
|
253
|
+
parser = argparse.ArgumentParser(description="Datadile data quality CLI")
|
|
254
|
+
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
255
|
+
|
|
256
|
+
test_parser = subparsers.add_parser("test", help="Run YAML data tests")
|
|
257
|
+
test_parser.add_argument("filepath", nargs="?", help="Path to a YAML data test file")
|
|
258
|
+
test_parser.set_defaults(func=test_command)
|
|
259
|
+
|
|
260
|
+
skill_parser = subparsers.add_parser("install-skill", help="Install the bundled coding-agent skill")
|
|
261
|
+
skill_parser.add_argument(
|
|
262
|
+
"destination",
|
|
263
|
+
nargs="?",
|
|
264
|
+
default=DEFAULT_SKILL_INSTALL_PATH,
|
|
265
|
+
help=f"Where to write SKILL.md (default: {DEFAULT_SKILL_INSTALL_PATH})",
|
|
266
|
+
)
|
|
267
|
+
skill_parser.set_defaults(func=install_skill_command)
|
|
268
|
+
|
|
269
|
+
args = parser.parse_args()
|
|
270
|
+
args.func(args)
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import ast
|
|
2
|
+
import re
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
DEFAULT_CONTEXT_CHAR_LIMIT = 50_000
|
|
7
|
+
_SQL_START_RE = re.compile(r"^\s*(select|with|insert|update|delete|create|alter|drop)\b", re.I)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def detect_script_language(script: str, script_path: str | Path | None = None) -> str:
|
|
11
|
+
if script_path is not None:
|
|
12
|
+
suffix = Path(script_path).suffix.lower()
|
|
13
|
+
if suffix == ".py":
|
|
14
|
+
return "python"
|
|
15
|
+
if suffix == ".sql":
|
|
16
|
+
return "sql"
|
|
17
|
+
|
|
18
|
+
try:
|
|
19
|
+
ast.parse(script)
|
|
20
|
+
except SyntaxError:
|
|
21
|
+
if _SQL_START_RE.search(script):
|
|
22
|
+
return "sql"
|
|
23
|
+
return "unknown"
|
|
24
|
+
|
|
25
|
+
return "python"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def expand_python_internal_dependencies(
|
|
29
|
+
script: str,
|
|
30
|
+
script_path: str | Path,
|
|
31
|
+
char_limit: int = DEFAULT_CONTEXT_CHAR_LIMIT,
|
|
32
|
+
) -> str:
|
|
33
|
+
"""Append local Python dependencies imported by script, recursively, within char_limit."""
|
|
34
|
+
root_path = Path(script_path).resolve()
|
|
35
|
+
dependency_blocks = []
|
|
36
|
+
remaining = max(0, char_limit - len(script))
|
|
37
|
+
|
|
38
|
+
for dependency_path in _iter_internal_dependencies(script, root_path):
|
|
39
|
+
if remaining <= 0:
|
|
40
|
+
break
|
|
41
|
+
|
|
42
|
+
try:
|
|
43
|
+
dependency_code = dependency_path.read_text()
|
|
44
|
+
except OSError:
|
|
45
|
+
continue
|
|
46
|
+
|
|
47
|
+
block = f"\n\n# Internal dependency: {dependency_path}\n{dependency_code}"
|
|
48
|
+
if len(block) > remaining:
|
|
49
|
+
block = block[:remaining]
|
|
50
|
+
dependency_blocks.append(block)
|
|
51
|
+
remaining -= len(block)
|
|
52
|
+
|
|
53
|
+
return script + "".join(dependency_blocks)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def build_api_code(
|
|
57
|
+
script: str,
|
|
58
|
+
script_path: str | Path,
|
|
59
|
+
char_limit: int = DEFAULT_CONTEXT_CHAR_LIMIT,
|
|
60
|
+
) -> str:
|
|
61
|
+
if detect_script_language(script, script_path) != "python":
|
|
62
|
+
return script
|
|
63
|
+
return expand_python_internal_dependencies(script, script_path, char_limit)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _iter_internal_dependencies(script: str, script_path: Path):
|
|
67
|
+
seen = {script_path}
|
|
68
|
+
queued = list(_resolve_imports(script, script_path))
|
|
69
|
+
|
|
70
|
+
while queued:
|
|
71
|
+
dependency_path = queued.pop(0)
|
|
72
|
+
if dependency_path in seen:
|
|
73
|
+
continue
|
|
74
|
+
seen.add(dependency_path)
|
|
75
|
+
yield dependency_path
|
|
76
|
+
|
|
77
|
+
try:
|
|
78
|
+
dependency_code = dependency_path.read_text()
|
|
79
|
+
except OSError:
|
|
80
|
+
continue
|
|
81
|
+
queued.extend(_resolve_imports(dependency_code, dependency_path))
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _resolve_imports(script: str, source_path: Path) -> list[Path]:
|
|
85
|
+
try:
|
|
86
|
+
tree = ast.parse(script)
|
|
87
|
+
except SyntaxError:
|
|
88
|
+
return []
|
|
89
|
+
|
|
90
|
+
dependencies = []
|
|
91
|
+
seen = set()
|
|
92
|
+
for import_node in ast.walk(tree):
|
|
93
|
+
candidates = []
|
|
94
|
+
if isinstance(import_node, ast.Import):
|
|
95
|
+
for alias in import_node.names:
|
|
96
|
+
candidates.extend(_resolve_absolute_module(alias.name, source_path))
|
|
97
|
+
elif isinstance(import_node, ast.ImportFrom):
|
|
98
|
+
candidates.extend(_resolve_import_from(import_node, source_path))
|
|
99
|
+
|
|
100
|
+
for candidate in candidates:
|
|
101
|
+
if candidate == source_path or candidate in seen:
|
|
102
|
+
continue
|
|
103
|
+
seen.add(candidate)
|
|
104
|
+
dependencies.append(candidate)
|
|
105
|
+
|
|
106
|
+
return dependencies
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _resolve_import_from(import_node: ast.ImportFrom, source_path: Path) -> list[Path]:
|
|
110
|
+
module_parts = import_node.module.split(".") if import_node.module else []
|
|
111
|
+
if import_node.level:
|
|
112
|
+
base_dir = _relative_import_base(source_path, import_node.level)
|
|
113
|
+
paths = _module_candidates(base_dir, module_parts)
|
|
114
|
+
for alias in import_node.names:
|
|
115
|
+
if alias.name != "*":
|
|
116
|
+
paths.extend(_module_candidates(base_dir, [*module_parts, alias.name]))
|
|
117
|
+
return _existing_python_files(paths)
|
|
118
|
+
|
|
119
|
+
paths = []
|
|
120
|
+
if import_node.module:
|
|
121
|
+
paths.extend(_resolve_absolute_module(import_node.module, source_path))
|
|
122
|
+
for alias in import_node.names:
|
|
123
|
+
if alias.name != "*":
|
|
124
|
+
paths.extend(_resolve_absolute_module(f"{import_node.module}.{alias.name}", source_path))
|
|
125
|
+
return paths
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def _resolve_absolute_module(module_name: str, source_path: Path) -> list[Path]:
|
|
129
|
+
module_parts = module_name.split(".")
|
|
130
|
+
candidates = []
|
|
131
|
+
for root in _candidate_roots(source_path):
|
|
132
|
+
candidates.extend(_module_candidates(root, module_parts))
|
|
133
|
+
return _existing_python_files(candidates)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def _candidate_roots(source_path: Path) -> list[Path]:
|
|
137
|
+
roots = [source_path.parent, Path.cwd().resolve()]
|
|
138
|
+
return list(dict.fromkeys(roots))
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def _relative_import_base(source_path: Path, level: int) -> Path:
|
|
142
|
+
base = source_path.parent
|
|
143
|
+
for _ in range(max(0, level - 1)):
|
|
144
|
+
base = base.parent
|
|
145
|
+
return base
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def _module_candidates(root: Path, module_parts: list[str]) -> list[Path]:
|
|
149
|
+
if not module_parts:
|
|
150
|
+
return [root / "__init__.py"]
|
|
151
|
+
|
|
152
|
+
module_path = root.joinpath(*module_parts)
|
|
153
|
+
return [module_path.with_suffix(".py"), module_path / "__init__.py"]
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def _existing_python_files(paths: list[Path]) -> list[Path]:
|
|
157
|
+
existing = []
|
|
158
|
+
seen = set()
|
|
159
|
+
for path in paths:
|
|
160
|
+
resolved = path.resolve()
|
|
161
|
+
if resolved in seen or not resolved.is_file():
|
|
162
|
+
continue
|
|
163
|
+
if any(part in {"site-packages", "dist-packages", ".venv", "venv"} for part in resolved.parts):
|
|
164
|
+
continue
|
|
165
|
+
seen.add(resolved)
|
|
166
|
+
existing.append(resolved)
|
|
167
|
+
return existing
|
datadile/search.py
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import re
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from rank_bm25 import BM25Plus
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _is_text_file(path: Path) -> bool:
|
|
9
|
+
try:
|
|
10
|
+
with open(path, "rb") as f:
|
|
11
|
+
chunk = f.read(8192)
|
|
12
|
+
return b"\x00" not in chunk
|
|
13
|
+
except OSError:
|
|
14
|
+
return False
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def search_codebase(search_dirs: list[str], column_names: list[str]) -> list[dict]:
|
|
18
|
+
"""Search directories recursively for files mentioning column names, ranked by BM25."""
|
|
19
|
+
if not column_names:
|
|
20
|
+
return []
|
|
21
|
+
|
|
22
|
+
file_paths = []
|
|
23
|
+
file_contents = []
|
|
24
|
+
|
|
25
|
+
for search_dir in search_dirs:
|
|
26
|
+
for root, dirs, files in os.walk(search_dir):
|
|
27
|
+
dirs[:] = [d for d in dirs if not d.startswith(".")]
|
|
28
|
+
for fname in sorted(files):
|
|
29
|
+
fpath = Path(root) / fname
|
|
30
|
+
if not _is_text_file(fpath):
|
|
31
|
+
continue
|
|
32
|
+
try:
|
|
33
|
+
content = fpath.read_text(errors="ignore")
|
|
34
|
+
except OSError:
|
|
35
|
+
continue
|
|
36
|
+
file_paths.append(str(fpath))
|
|
37
|
+
file_contents.append(content)
|
|
38
|
+
|
|
39
|
+
if not file_contents:
|
|
40
|
+
return []
|
|
41
|
+
|
|
42
|
+
def tokenize(text: str) -> list[str]:
|
|
43
|
+
return re.findall(r"\w+", text.lower())
|
|
44
|
+
|
|
45
|
+
tokenized_corpus = [tokenize(c) for c in file_contents]
|
|
46
|
+
bm25 = BM25Plus(tokenized_corpus)
|
|
47
|
+
|
|
48
|
+
query_tokens = [col.lower() for col in column_names]
|
|
49
|
+
scores = bm25.get_scores(query_tokens)
|
|
50
|
+
|
|
51
|
+
ranked = sorted(
|
|
52
|
+
[
|
|
53
|
+
{"path": file_paths[i], "content": file_contents[i], "score": float(scores[i])}
|
|
54
|
+
for i in range(len(file_paths))
|
|
55
|
+
if scores[i] > 0
|
|
56
|
+
],
|
|
57
|
+
key=lambda x: x["score"],
|
|
58
|
+
reverse=True,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
return ranked
|
datadile/skill/SKILL.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: datadile
|
|
3
|
+
description: Use when creating, editing, reviewing, or debugging Datadile data tests, datadile.yaml config, *.dile.yaml files, SQL expectations, or the datadile CLI/package code. Load this skill before changing data test YAML, connection configuration, test discovery, expectation parsing, result normalization, or CLI behavior.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Datadile
|
|
7
|
+
|
|
8
|
+
Datadile runs YAML-defined data tests against query results. Use this skill when work involves Datadile test files, configuration, CLI behavior, or package internals.
|
|
9
|
+
|
|
10
|
+
## Use Cases
|
|
11
|
+
|
|
12
|
+
- Add or update `*.dile.yaml` files near application code.
|
|
13
|
+
- Review data tests for safe SQL, clear expectations, and valid severities.
|
|
14
|
+
- Create or edit `datadile.yaml` without storing secrets in the file.
|
|
15
|
+
- Debug `datadile test` failures, test discovery, config lookup, or data source selection.
|
|
16
|
+
- Modify Datadile internals such as parsing, expectation evaluation, result normalization, or CLI commands.
|
|
17
|
+
|
|
18
|
+
## Core Rules
|
|
19
|
+
|
|
20
|
+
- Datadile discovers only files named `*.dile.yaml` when `datadile test` is run without a path.
|
|
21
|
+
- Each test needs `name`, `description`, `query`, and `expect`.
|
|
22
|
+
- `severity` is optional and must be `LOW`, `MEDIUM`, or `HIGH`; it defaults to `MEDIUM`.
|
|
23
|
+
- `data_source` is optional; without it, Datadile uses `default_data_source` from `datadile.yaml`.
|
|
24
|
+
- Keep passwords and API keys in environment variables. Use `password_env` and `api_key_env`; do not put secret values directly in YAML.
|
|
25
|
+
- PostgreSQL is the local execution target today. Keep test YAML generic enough that other query engines can be added later.
|
|
26
|
+
|
|
27
|
+
## Data Test Examples
|
|
28
|
+
|
|
29
|
+
Use this shape for count checks:
|
|
30
|
+
|
|
31
|
+
```yaml
|
|
32
|
+
tests:
|
|
33
|
+
- name: no_failed_orders_today
|
|
34
|
+
description: Orders should not fail during the current day.
|
|
35
|
+
severity: HIGH
|
|
36
|
+
data_source: app_db
|
|
37
|
+
query: |
|
|
38
|
+
select count(*) as failed_orders
|
|
39
|
+
from orders
|
|
40
|
+
where status = 'failed'
|
|
41
|
+
and created_at >= current_date
|
|
42
|
+
expect: "= 0"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Use list expectations for one-column multi-row checks:
|
|
46
|
+
|
|
47
|
+
```yaml
|
|
48
|
+
tests:
|
|
49
|
+
- name: active_plan_ids_are_known
|
|
50
|
+
description: Active subscriptions should only use known plan IDs.
|
|
51
|
+
query: |
|
|
52
|
+
select distinct plan_id
|
|
53
|
+
from subscriptions
|
|
54
|
+
where status = 'active'
|
|
55
|
+
order by plan_id
|
|
56
|
+
expect: "= [1, 2, 3]"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Config Examples
|
|
60
|
+
|
|
61
|
+
Local config lives at `./datadile.yaml`; user config lives at `~/.datadile/datadile.yaml`. Local config takes precedence.
|
|
62
|
+
|
|
63
|
+
```yaml
|
|
64
|
+
api_key_env: DATADILE_API_KEY
|
|
65
|
+
default_data_source: main
|
|
66
|
+
|
|
67
|
+
data_sources:
|
|
68
|
+
main:
|
|
69
|
+
type: postgresql
|
|
70
|
+
host: localhost
|
|
71
|
+
port: 5432
|
|
72
|
+
user: myuser
|
|
73
|
+
database: mydb
|
|
74
|
+
password_env: DATADILE_DATA_SOURCE_PASSWORD
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Server-backed data sources can reference an ID, but remote execution is not implemented in the local package yet:
|
|
78
|
+
|
|
79
|
+
```yaml
|
|
80
|
+
api_key_env: DATADILE_API_KEY
|
|
81
|
+
default_data_source: warehouse
|
|
82
|
+
|
|
83
|
+
data_sources:
|
|
84
|
+
warehouse:
|
|
85
|
+
id: ds_abc123
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Expectation Semantics
|
|
89
|
+
|
|
90
|
+
- Supported operators are `=`, `!=`, `>`, `>=`, `<`, and `<=`.
|
|
91
|
+
- One-row, one-column results compare as a scalar, such as `= 0`.
|
|
92
|
+
- Multi-row, one-column results compare as a list, such as `= [1, 2, 3]`.
|
|
93
|
+
- Wider rows compare as dictionaries or lists of dictionaries.
|
|
94
|
+
- Empty result sets normalize to `None`, so use `= null` when that is intentional.
|
|
95
|
+
|
|
96
|
+
## Coding Guidance
|
|
97
|
+
|
|
98
|
+
- Preserve the `*.dile.yaml` discovery rule unless the user explicitly asks to broaden it.
|
|
99
|
+
- Do not add support for inline passwords or API keys.
|
|
100
|
+
- Keep YAML examples quoted around expectation strings, especially values beginning with comparison operators.
|
|
101
|
+
- When changing CLI behavior, keep `datadile test [filepath]` working.
|
|
102
|
+
- When changing config behavior, keep local `datadile.yaml` precedence over `~/.datadile/datadile.yaml`.
|
|
File without changes
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: datadile
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: YAML-defined data tests for SQL query results
|
|
5
|
+
Project-URL: Homepage, https://github.com/Sand1929/datadile
|
|
6
|
+
Project-URL: Repository, https://github.com/Sand1929/datadile
|
|
7
|
+
Author-email: Sandy Suh <sandy@parsagon.io>
|
|
8
|
+
License: Apache License
|
|
9
|
+
Version 2.0, January 2004
|
|
10
|
+
http://www.apache.org/licenses/
|
|
11
|
+
|
|
12
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
13
|
+
|
|
14
|
+
1. Definitions.
|
|
15
|
+
|
|
16
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
17
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
18
|
+
|
|
19
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
20
|
+
the copyright owner that is granting the License.
|
|
21
|
+
|
|
22
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
23
|
+
other entities that control, are controlled by, or are under common
|
|
24
|
+
control with that entity. For the purposes of this definition,
|
|
25
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
26
|
+
direction or management of such entity, whether by contract or
|
|
27
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
28
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
29
|
+
|
|
30
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
31
|
+
exercising permissions granted by this License.
|
|
32
|
+
|
|
33
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
34
|
+
including but not limited to software source code, documentation
|
|
35
|
+
source, and configuration files.
|
|
36
|
+
|
|
37
|
+
"Object" form shall mean any form resulting from mechanical
|
|
38
|
+
transformation or translation of a Source form, including but
|
|
39
|
+
not limited to compiled object code, generated documentation,
|
|
40
|
+
and conversions to other media types.
|
|
41
|
+
|
|
42
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
43
|
+
Object form, made available under the License, as indicated by a
|
|
44
|
+
copyright notice that is included in or attached to the work
|
|
45
|
+
(an example is provided in the Appendix below).
|
|
46
|
+
|
|
47
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
48
|
+
form, that is based on (or derived from) the Work and for which the
|
|
49
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
50
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
51
|
+
of this License, Derivative Works shall not include works that remain
|
|
52
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
53
|
+
the Work and Derivative Works thereof.
|
|
54
|
+
|
|
55
|
+
"Contribution" shall mean any work of authorship, including
|
|
56
|
+
the original version of the Work and any modifications or additions
|
|
57
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
58
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
59
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
60
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
61
|
+
means any form of electronic, verbal, or written communication sent
|
|
62
|
+
to the Licensor or its representatives, including but not limited to
|
|
63
|
+
communication on electronic mailing lists, source code control systems,
|
|
64
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
65
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
66
|
+
excluding communication that is conspicuously marked or otherwise
|
|
67
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
68
|
+
|
|
69
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
70
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
71
|
+
subsequently incorporated within the Work.
|
|
72
|
+
|
|
73
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
77
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
78
|
+
Work and such Derivative Works in Source or Object form.
|
|
79
|
+
|
|
80
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
81
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
82
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
83
|
+
(except as stated in this section) patent license to make, have made,
|
|
84
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
85
|
+
where such license applies only to those patent claims licensable
|
|
86
|
+
by such Contributor that are necessarily infringed by their
|
|
87
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
88
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
89
|
+
institute patent litigation against any entity (including a
|
|
90
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
91
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
92
|
+
or contributory patent infringement, then any patent licenses
|
|
93
|
+
granted to You under this License for that Work shall terminate
|
|
94
|
+
as of the date such litigation is filed.
|
|
95
|
+
|
|
96
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
97
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
98
|
+
modifications, and in Source or Object form, provided that You
|
|
99
|
+
meet the following conditions:
|
|
100
|
+
|
|
101
|
+
(a) You must give any other recipients of the Work or
|
|
102
|
+
Derivative Works a copy of this License; and
|
|
103
|
+
|
|
104
|
+
(b) You must cause any modified files to carry prominent notices
|
|
105
|
+
stating that You changed the files; and
|
|
106
|
+
|
|
107
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
108
|
+
that You distribute, all copyright, patent, trademark, and
|
|
109
|
+
attribution notices from the Source form of the Work,
|
|
110
|
+
excluding those notices that do not pertain to any part of
|
|
111
|
+
the Derivative Works; and
|
|
112
|
+
|
|
113
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
114
|
+
distribution, then any Derivative Works that You distribute must
|
|
115
|
+
include a readable copy of the attribution notices contained
|
|
116
|
+
within such NOTICE file, excluding those notices that do not
|
|
117
|
+
pertain to any part of the Derivative Works, in at least one
|
|
118
|
+
of the following places: within a NOTICE text file distributed
|
|
119
|
+
as part of the Derivative Works; within the Source form or
|
|
120
|
+
documentation, if provided along with the Derivative Works; or,
|
|
121
|
+
within a display generated by the Derivative Works, if and
|
|
122
|
+
wherever such third-party notices normally appear. The contents
|
|
123
|
+
of the NOTICE file are for informational purposes only and
|
|
124
|
+
do not modify the License. You may add Your own attribution
|
|
125
|
+
notices within Derivative Works that You distribute, alongside
|
|
126
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
127
|
+
that such additional attribution notices cannot be construed
|
|
128
|
+
as modifying the License.
|
|
129
|
+
|
|
130
|
+
You may add Your own copyright statement to Your modifications and
|
|
131
|
+
may provide additional or different license terms and conditions
|
|
132
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
133
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
134
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
135
|
+
the conditions stated in this License.
|
|
136
|
+
|
|
137
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
138
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
139
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
140
|
+
this License, without any additional terms or conditions.
|
|
141
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
142
|
+
the terms of any separate license agreement you may have executed
|
|
143
|
+
with Licensor regarding such Contributions.
|
|
144
|
+
|
|
145
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
146
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
147
|
+
except as required for reasonable and customary use in describing the
|
|
148
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
149
|
+
|
|
150
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
151
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
152
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
153
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
154
|
+
implied, including, without limitation, any warranties or conditions
|
|
155
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
156
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
157
|
+
appropriateness of using or redistributing the Work and assume any
|
|
158
|
+
risks associated with Your exercise of permissions under this License.
|
|
159
|
+
|
|
160
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
161
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
162
|
+
unless required by applicable law (such as deliberate and grossly
|
|
163
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
164
|
+
liable to You for damages, including any direct, indirect, special,
|
|
165
|
+
incidental, or consequential damages of any character arising as a
|
|
166
|
+
result of this License or out of the use or inability to use the
|
|
167
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
168
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
169
|
+
other commercial damages or losses), even if such Contributor
|
|
170
|
+
has been advised of the possibility of such damages.
|
|
171
|
+
|
|
172
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
173
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
174
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
175
|
+
or other liability obligations and/or rights consistent with this
|
|
176
|
+
License. However, in accepting such obligations, You may act only
|
|
177
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
178
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
179
|
+
defend, and hold each Contributor harmless for any liability
|
|
180
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
181
|
+
of your accepting any such warranty or additional liability.
|
|
182
|
+
|
|
183
|
+
END OF TERMS AND CONDITIONS
|
|
184
|
+
|
|
185
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
186
|
+
|
|
187
|
+
To apply the Apache License to your work, attach the following
|
|
188
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
189
|
+
replaced with your own identifying information. (Don't include
|
|
190
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
191
|
+
comment syntax for the file format. We also recommend that a
|
|
192
|
+
file or class name and description of purpose be included on the
|
|
193
|
+
same "printed page" as the copyright notice for easier
|
|
194
|
+
identification within third-party archives.
|
|
195
|
+
|
|
196
|
+
Copyright 2026 Sandy Suh
|
|
197
|
+
|
|
198
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
199
|
+
you may not use this file except in compliance with the License.
|
|
200
|
+
You may obtain a copy of the License at
|
|
201
|
+
|
|
202
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
203
|
+
|
|
204
|
+
Unless required by applicable law or agreed to in writing, software
|
|
205
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
206
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
207
|
+
See the License for the specific language governing permissions and
|
|
208
|
+
limitations under the License.
|
|
209
|
+
License-File: LICENSE
|
|
210
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
211
|
+
Classifier: Operating System :: OS Independent
|
|
212
|
+
Classifier: Programming Language :: Python :: 3
|
|
213
|
+
Requires-Python: >=3.10
|
|
214
|
+
Requires-Dist: httpx
|
|
215
|
+
Requires-Dist: prompt-toolkit
|
|
216
|
+
Requires-Dist: psycopg2-binary
|
|
217
|
+
Requires-Dist: pyyaml>=6.0
|
|
218
|
+
Requires-Dist: rank-bm25>=0.2
|
|
219
|
+
Requires-Dist: rich
|
|
220
|
+
Requires-Dist: sqlalchemy>=2.0
|
|
221
|
+
Requires-Dist: sqlparse>=0.4
|
|
222
|
+
Description-Content-Type: text/markdown
|
|
223
|
+
|
|
224
|
+
# datadile
|
|
225
|
+
|
|
226
|
+
Datadile runs YAML-defined data tests against query results.
|
|
227
|
+
|
|
228
|
+
## Installation
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
pip install datadile
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Configuration
|
|
235
|
+
|
|
236
|
+
datadile looks for a YAML config file in two locations (local takes precedence):
|
|
237
|
+
|
|
238
|
+
1. `./datadile.yaml` (current directory)
|
|
239
|
+
2. `~/.datadile/datadile.yaml` (user-level)
|
|
240
|
+
|
|
241
|
+
Copy the example and fill in your values:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
cp datadile.yaml.example datadile.yaml
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
```yaml
|
|
248
|
+
# Optional. Only required for premium server-backed features.
|
|
249
|
+
api_key_env: DATADILE_API_KEY
|
|
250
|
+
|
|
251
|
+
# Optional. Used by tests that do not set data_source.
|
|
252
|
+
default_data_source: main
|
|
253
|
+
|
|
254
|
+
data_sources:
|
|
255
|
+
main:
|
|
256
|
+
type: postgresql
|
|
257
|
+
host: localhost
|
|
258
|
+
port: 5432
|
|
259
|
+
user: myuser
|
|
260
|
+
database: mydb
|
|
261
|
+
password_env: DATADILE_DATA_SOURCE_PASSWORD
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Put data source passwords and API keys in environment variables, not in `datadile.yaml`:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
export DATADILE_DATA_SOURCE_PASSWORD='your_password_here'
|
|
268
|
+
export DATADILE_API_KEY='your_api_key_here'
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Use `password_env` or `api_key_env` if you want Datadile to read a different environment variable name.
|
|
272
|
+
|
|
273
|
+
Add more named entries under `data_sources` when tests need to run against multiple databases. `default_data_source` is optional, but tests that do not set `data_source` need a default.
|
|
274
|
+
|
|
275
|
+
`api_key_env` is optional. You only need it for premium features that access Datadile servers.
|
|
276
|
+
|
|
277
|
+
Data source entries can be defined inline, or referenced by ID if the connection details are stored on your Datadile account:
|
|
278
|
+
|
|
279
|
+
```yaml
|
|
280
|
+
api_key_env: DATADILE_API_KEY
|
|
281
|
+
|
|
282
|
+
default_data_source: warehouse
|
|
283
|
+
|
|
284
|
+
data_sources:
|
|
285
|
+
warehouse:
|
|
286
|
+
id: ds_abc123
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
`postgresql` is currently supported for local execution. Data tests keep `query` generic so query engines such as MongoDB can be added without changing the test format.
|
|
290
|
+
|
|
291
|
+
## Usage
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
datadile test
|
|
295
|
+
datadile test <path/to/file.dile.yaml>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
With no path, Datadile recursively discovers only files matching `*.dile.yaml` from the current directory. Other YAML files, such as `docker-compose.yaml`, GitHub Actions workflows, Helm values, and OpenAPI specs, are ignored.
|
|
299
|
+
|
|
300
|
+
## Data Tests
|
|
301
|
+
|
|
302
|
+
Tests are defined in YAML. Each test has `name`, `description`, `query`, and `expect`. `severity` is optional and defaults to `MEDIUM`; valid values are `LOW`, `MEDIUM`, and `HIGH`. `data_source` is optional and references a named source from `data_sources`; otherwise Datadile uses `default_data_source` if one is configured.
|
|
303
|
+
|
|
304
|
+
For example, a test can set `data_source: app_db` after `app_db` is added under `data_sources`.
|
|
305
|
+
|
|
306
|
+
Use the `*.dile.yaml` naming convention and colocate data tests near the application code they protect:
|
|
307
|
+
|
|
308
|
+
```text
|
|
309
|
+
app/orders/orders.py
|
|
310
|
+
app/orders/orders.dile.yaml
|
|
311
|
+
app/billing/invoices.ts
|
|
312
|
+
app/billing/invoices.dile.yaml
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
```yaml
|
|
316
|
+
tests:
|
|
317
|
+
- name: no_failed_orders
|
|
318
|
+
description: There should be no failed orders today.
|
|
319
|
+
severity: HIGH
|
|
320
|
+
data_source: app_db
|
|
321
|
+
query: |
|
|
322
|
+
select count(*) as failed_orders
|
|
323
|
+
from orders
|
|
324
|
+
where status = 'failed'
|
|
325
|
+
and created_at >= current_date
|
|
326
|
+
expect: "= 0"
|
|
327
|
+
|
|
328
|
+
- name: active_plan_ids
|
|
329
|
+
description: Active subscriptions should only use known plan IDs.
|
|
330
|
+
query: |
|
|
331
|
+
select distinct plan_id
|
|
332
|
+
from subscriptions
|
|
333
|
+
where status = 'active'
|
|
334
|
+
order by plan_id
|
|
335
|
+
expect: "= [1, 2, 3]"
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
`expect` is a comparison string. Supported operators are `=`, `!=`, `>`, `>=`, `<`, and `<=`.
|
|
339
|
+
|
|
340
|
+
For one-row, one-column query results, Datadile compares the scalar value. For multi-row, one-column results, it compares a list of values. For wider results, it compares dictionaries or lists of dictionaries.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
datadile/__init__.py,sha256=1V_F6lvCy82PQHLkHFzpaTtasq5D5RnaKNYNY6AfcOU,43
|
|
2
|
+
datadile/config.py,sha256=VpfsBRgAH6K5jKKNW2PEggDQor87grnsynb8_XQ_q_Y,4105
|
|
3
|
+
datadile/core.py,sha256=ywG2tj_7PgG6-BiY_nBdRxMeTwazRFHVQ-VeDwh5VWc,9144
|
|
4
|
+
datadile/script_context.py,sha256=yRlbBsArMcerzClruN1YbhnHHTAyVoQfpHzOGudQ5G0,5303
|
|
5
|
+
datadile/search.py,sha256=XTghjq-pqA4hc_JvzzxOlHR8wfgzZJWFtLIT44D1d80,1712
|
|
6
|
+
datadile/skill/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
datadile/skill/SKILL.md,sha256=1WkW29v_4i8sj82a_jvSM5J1vEKMoxGiPHaCm_qihpU,3721
|
|
8
|
+
datadile-0.1.0.dist-info/METADATA,sha256=QfKcJ3odgq9y9kBtLgeokBWruqz5fc9ddqcStPz8L9w,17271
|
|
9
|
+
datadile-0.1.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
10
|
+
datadile-0.1.0.dist-info/entry_points.txt,sha256=d68v93ozKg6FYneQutCIdepR6gntJduPRbHF-CvEmks,43
|
|
11
|
+
datadile-0.1.0.dist-info/licenses/LICENSE,sha256=f3t_-KHmcTzmw5cQW5ynF4U-qQZvojU0VuHWGiUcLoE,11339
|
|
12
|
+
datadile-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Sandy Suh
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|