agentic-data 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.
agentic_data/__init__.py
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"""AgenticData — Universal data comprehension for AI agents.
|
|
2
|
+
|
|
3
|
+
Pure-Python SDK that wraps the ``adat`` CLI binary via subprocess.
|
|
4
|
+
Zero required dependencies; only stdlib: subprocess, json, pathlib, dataclasses.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
import logging
|
|
11
|
+
import subprocess
|
|
12
|
+
from dataclasses import dataclass, field
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from typing import Any, Optional
|
|
15
|
+
|
|
16
|
+
__version__ = "0.1.0"
|
|
17
|
+
|
|
18
|
+
logger = logging.getLogger(__name__)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class DataError(Exception):
|
|
22
|
+
"""Raised when an adat CLI command fails."""
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass
|
|
26
|
+
class DataStore:
|
|
27
|
+
"""Interface to an ``.adat`` data store file.
|
|
28
|
+
|
|
29
|
+
Parameters
|
|
30
|
+
----------
|
|
31
|
+
path : str | Path
|
|
32
|
+
Path to the ``.adat`` file. Created automatically on first write
|
|
33
|
+
if it does not exist.
|
|
34
|
+
binary : str
|
|
35
|
+
Name or path of the ``adat`` CLI binary.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
path: str | Path
|
|
39
|
+
binary: str = "adat"
|
|
40
|
+
_resolved_binary: Optional[str] = field(default=None, repr=False, init=False)
|
|
41
|
+
|
|
42
|
+
def __post_init__(self) -> None:
|
|
43
|
+
self.path = Path(self.path)
|
|
44
|
+
|
|
45
|
+
# ------------------------------------------------------------------
|
|
46
|
+
# Internal helpers
|
|
47
|
+
# ------------------------------------------------------------------
|
|
48
|
+
|
|
49
|
+
def _find_binary(self) -> str:
|
|
50
|
+
if self._resolved_binary is not None:
|
|
51
|
+
return self._resolved_binary
|
|
52
|
+
|
|
53
|
+
import shutil
|
|
54
|
+
|
|
55
|
+
found = shutil.which(self.binary)
|
|
56
|
+
if found is None:
|
|
57
|
+
raise DataError(
|
|
58
|
+
f"Cannot find '{self.binary}' on PATH. "
|
|
59
|
+
"Install AgenticData: curl -fsSL https://agentralabs.tech/install/data | bash"
|
|
60
|
+
)
|
|
61
|
+
self._resolved_binary = found
|
|
62
|
+
return found
|
|
63
|
+
|
|
64
|
+
def _run(self, *args: str, check: bool = True) -> str:
|
|
65
|
+
"""Execute an adat CLI command and return stdout."""
|
|
66
|
+
cmd = [self._find_binary(), "--file", str(self.path), *args]
|
|
67
|
+
logger.debug("Running: %s", " ".join(cmd))
|
|
68
|
+
result = subprocess.run(cmd, capture_output=True, text=True)
|
|
69
|
+
if check and result.returncode != 0:
|
|
70
|
+
raise DataError(
|
|
71
|
+
f"adat command failed (exit {result.returncode}): {result.stderr.strip()}"
|
|
72
|
+
)
|
|
73
|
+
return result.stdout.strip()
|
|
74
|
+
|
|
75
|
+
def _run_json(self, *args: str) -> Any:
|
|
76
|
+
"""Execute a command and parse JSON output."""
|
|
77
|
+
raw = self._run(*args, "--format", "json")
|
|
78
|
+
return json.loads(raw) if raw else {}
|
|
79
|
+
|
|
80
|
+
# ------------------------------------------------------------------
|
|
81
|
+
# Data operations
|
|
82
|
+
# ------------------------------------------------------------------
|
|
83
|
+
|
|
84
|
+
def detect_format(self, source: str) -> dict[str, Any]:
|
|
85
|
+
"""Detect the format of a data source. Returns format metadata."""
|
|
86
|
+
return self._run_json("format", "detect", source)
|
|
87
|
+
|
|
88
|
+
def ingest(
|
|
89
|
+
self,
|
|
90
|
+
source: str,
|
|
91
|
+
*,
|
|
92
|
+
format: Optional[str] = None,
|
|
93
|
+
schema: Optional[str] = None,
|
|
94
|
+
) -> str:
|
|
95
|
+
"""Ingest data from a source. Returns the ingestion ID."""
|
|
96
|
+
args = ["ingest", source]
|
|
97
|
+
if format:
|
|
98
|
+
args.extend(["--format", format])
|
|
99
|
+
if schema:
|
|
100
|
+
args.extend(["--schema", schema])
|
|
101
|
+
return self._run(*args)
|
|
102
|
+
|
|
103
|
+
def query(self, expression: str, *, limit: Optional[int] = None) -> list[dict[str, Any]]:
|
|
104
|
+
"""Query data with an expression. Returns matching records."""
|
|
105
|
+
args = ["query", expression, "--format", "json"]
|
|
106
|
+
if limit is not None:
|
|
107
|
+
args.extend(["--limit", str(limit)])
|
|
108
|
+
raw = self._run(*args)
|
|
109
|
+
return json.loads(raw) if raw else []
|
|
110
|
+
|
|
111
|
+
def quality_score(self, source: Optional[str] = None) -> dict[str, Any]:
|
|
112
|
+
"""Compute data quality score. Returns quality metrics."""
|
|
113
|
+
args = ["quality", "score", "--format", "json"]
|
|
114
|
+
if source:
|
|
115
|
+
args.append(source)
|
|
116
|
+
raw = self._run(*args)
|
|
117
|
+
return json.loads(raw) if raw else {}
|
|
118
|
+
|
|
119
|
+
# ------------------------------------------------------------------
|
|
120
|
+
# Stats
|
|
121
|
+
# ------------------------------------------------------------------
|
|
122
|
+
|
|
123
|
+
def stats(self) -> dict[str, Any]:
|
|
124
|
+
"""Get data store statistics."""
|
|
125
|
+
raw = self._run("stats", "--format", "json")
|
|
126
|
+
return json.loads(raw) if raw else {}
|
|
127
|
+
|
|
128
|
+
# ------------------------------------------------------------------
|
|
129
|
+
# File operations
|
|
130
|
+
# ------------------------------------------------------------------
|
|
131
|
+
|
|
132
|
+
def save(self) -> None:
|
|
133
|
+
"""Explicit save (most operations auto-save)."""
|
|
134
|
+
pass
|
|
135
|
+
|
|
136
|
+
@property
|
|
137
|
+
def exists(self) -> bool:
|
|
138
|
+
"""Whether the .adat file exists on disk."""
|
|
139
|
+
return self.path.exists()
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentic-data
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Universal data comprehension for AI agents
|
|
5
|
+
Project-URL: Homepage, https://github.com/agentralabs/agentic-data
|
|
6
|
+
Project-URL: Documentation, https://github.com/agentralabs/agentic-data/tree/main/docs
|
|
7
|
+
Project-URL: Repository, https://github.com/agentralabs/agentic-data
|
|
8
|
+
Author: Agentra Labs
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Keywords: agents,ai,data,lineage,schema
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
22
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
23
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# AgenticData Python SDK
|
|
27
|
+
|
|
28
|
+
Pure-Python SDK that wraps the `adat` CLI binary.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install agentic-data
|
|
32
|
+
```
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
agentic_data/__init__.py,sha256=KWyjDdQeErxAj2OM9O9Xe_rF9GBeXSwkifCAipSCXXM,4638
|
|
2
|
+
agentic_data-0.1.0.dist-info/METADATA,sha256=qkfXIJC_rKXlSqpWt3pK0HTf0XSmqxGmc1pZnP7QqGk,1158
|
|
3
|
+
agentic_data-0.1.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
4
|
+
agentic_data-0.1.0.dist-info/RECORD,,
|