astoncli 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.
- aston/__init__.py +0 -0
- aston/axios.py +525 -0
- aston/config.py +88 -0
- aston/docker.py +402 -0
- aston/exceptions.py +49 -0
- aston/ingestion.py +1105 -0
- aston/llm.py +182 -0
- aston/pipeline.py +749 -0
- aston/poller.py +201 -0
- aston/relevance.py +175 -0
- aston/repo_verification.py +243 -0
- aston/rule_validation.py +437 -0
- aston/scanner.py +211 -0
- aston/watcher.py +66 -0
- astoncli-0.1.0.dist-info/METADATA +883 -0
- astoncli-0.1.0.dist-info/RECORD +19 -0
- astoncli-0.1.0.dist-info/WHEEL +5 -0
- astoncli-0.1.0.dist-info/entry_points.txt +2 -0
- astoncli-0.1.0.dist-info/top_level.txt +1 -0
aston/watcher.py
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from aston.ingestion import get_latest_pypi_version
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from packaging.version import Version
|
|
4
|
+
import re
|
|
5
|
+
import json
|
|
6
|
+
from aston.exceptions import ConfigurationError
|
|
7
|
+
|
|
8
|
+
def is_major_version_change(current_version, target_version):
|
|
9
|
+
current_major = int(current_version.split(".")[0])
|
|
10
|
+
target_major = int(target_version.split(".")[0])
|
|
11
|
+
# print(current_version)
|
|
12
|
+
# print(target_version)
|
|
13
|
+
|
|
14
|
+
return target_major > current_major
|
|
15
|
+
|
|
16
|
+
def watcher(path: str) -> dict:
|
|
17
|
+
dependencies = {}
|
|
18
|
+
folder_path = Path(path).expanduser().resolve()
|
|
19
|
+
|
|
20
|
+
if not folder_path.exists():
|
|
21
|
+
raise ConfigurationError(
|
|
22
|
+
message=f"Repository directory not found: {folder_path}",
|
|
23
|
+
details="Ensure the target workspace path exists before running dependency scanning."
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
req_file = folder_path / "requirements.txt"
|
|
27
|
+
if not req_file.is_file():
|
|
28
|
+
raise ConfigurationError(
|
|
29
|
+
message=f"No requirements.txt found in repository path: {folder_path}",
|
|
30
|
+
details="Ensure the target directory contains a valid requirements.txt file before running dependency analysis."
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
for line in req_file.read_text(encoding="utf-8").splitlines():
|
|
34
|
+
line = line.strip()
|
|
35
|
+
if not line or line.startswith("#") or line.startswith("-"):
|
|
36
|
+
continue
|
|
37
|
+
|
|
38
|
+
# Extract package name and check if it's an exact version pin vs range/constraint
|
|
39
|
+
match = re.match(r"^([a-zA-Z0-9\-_]+)", line)
|
|
40
|
+
if match:
|
|
41
|
+
pkg_name = match.group(1)
|
|
42
|
+
pkg_key = pkg_name.lower()
|
|
43
|
+
|
|
44
|
+
# Check for exact version pin (e.g., openai==0.28.1)
|
|
45
|
+
exact_match = re.match(r"^[a-zA-Z0-9\-_]+\s*==\s*([0-9\.]+)$", line)
|
|
46
|
+
exact_version = exact_match.group(1) if exact_match else None
|
|
47
|
+
|
|
48
|
+
target_version = get_latest_pypi_version(pkg_key)
|
|
49
|
+
|
|
50
|
+
dependencies[pkg_key] = {
|
|
51
|
+
"declared": {
|
|
52
|
+
"specifier": line,
|
|
53
|
+
"version": exact_version, # Null if it's a constraint range like 2.31,<3
|
|
54
|
+
"source_file": req_file.name,
|
|
55
|
+
"source_type": "requirements"
|
|
56
|
+
},
|
|
57
|
+
"resolved": None,
|
|
58
|
+
"installed": None,
|
|
59
|
+
"target_version": target_version if target_version else exact_version,
|
|
60
|
+
"provenance_status": "declared"
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return dependencies
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# sot = watcher('demo/')
|