netra-zen 1.0.8__py3-none-any.whl → 1.0.9__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.
- agent_interface/__init__.py +25 -25
- agent_interface/base_agent.py +350 -350
- {netra_zen-1.0.8.dist-info → netra_zen-1.0.9.dist-info}/METADATA +971 -971
- {netra_zen-1.0.8.dist-info → netra_zen-1.0.9.dist-info}/RECORD +15 -15
- scripts/agent_cli.py +643 -10
- scripts/bump_version.py +137 -137
- token_budget/budget_manager.py +199 -199
- token_budget/models.py +73 -73
- token_budget/visualization.py +21 -21
- token_transparency/__init__.py +19 -19
- token_transparency/claude_pricing_engine.py +326 -326
- {netra_zen-1.0.8.dist-info → netra_zen-1.0.9.dist-info}/WHEEL +0 -0
- {netra_zen-1.0.8.dist-info → netra_zen-1.0.9.dist-info}/entry_points.txt +0 -0
- {netra_zen-1.0.8.dist-info → netra_zen-1.0.9.dist-info}/licenses/LICENSE.md +0 -0
- {netra_zen-1.0.8.dist-info → netra_zen-1.0.9.dist-info}/top_level.txt +0 -0
scripts/bump_version.py
CHANGED
@@ -1,138 +1,138 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
"""
|
3
|
-
Version bump utility for Zen Orchestrator.
|
4
|
-
Updates version in all relevant files.
|
5
|
-
|
6
|
-
Usage:
|
7
|
-
python scripts/bump_version.py patch # 1.0.0 -> 1.0.1
|
8
|
-
python scripts/bump_version.py minor # 1.0.0 -> 1.1.0
|
9
|
-
python scripts/bump_version.py major # 1.0.0 -> 2.0.0
|
10
|
-
python scripts/bump_version.py 1.2.3 # Set specific version
|
11
|
-
"""
|
12
|
-
|
13
|
-
import re
|
14
|
-
import sys
|
15
|
-
from pathlib import Path
|
16
|
-
from typing import Tuple
|
17
|
-
|
18
|
-
|
19
|
-
def parse_version(version_str: str) -> Tuple[int, int, int]:
|
20
|
-
"""Parse version string to tuple of integers."""
|
21
|
-
match = re.match(r'^(\d+)\.(\d+)\.(\d+)$', version_str)
|
22
|
-
if not match:
|
23
|
-
raise ValueError(f"Invalid version format: {version_str}")
|
24
|
-
return tuple(map(int, match.groups()))
|
25
|
-
|
26
|
-
|
27
|
-
def format_version(version_tuple: Tuple[int, int, int]) -> str:
|
28
|
-
"""Format version tuple to string."""
|
29
|
-
return '.'.join(map(str, version_tuple))
|
30
|
-
|
31
|
-
|
32
|
-
def get_current_version() -> str:
|
33
|
-
"""Get current version from __init__.py."""
|
34
|
-
init_file = Path(__file__).parent.parent / "__init__.py"
|
35
|
-
content = init_file.read_text()
|
36
|
-
match = re.search(r'__version__\s*=\s*["\']([^"\']+)["\']', content)
|
37
|
-
if not match:
|
38
|
-
raise ValueError("Could not find version in __init__.py")
|
39
|
-
return match.group(1)
|
40
|
-
|
41
|
-
|
42
|
-
def bump_version(current: str, bump_type: str) -> str:
|
43
|
-
"""Bump version based on type."""
|
44
|
-
if re.match(r'^\d+\.\d+\.\d+$', bump_type):
|
45
|
-
# Specific version provided
|
46
|
-
return bump_type
|
47
|
-
|
48
|
-
major, minor, patch = parse_version(current)
|
49
|
-
|
50
|
-
if bump_type == 'major':
|
51
|
-
return format_version((major + 1, 0, 0))
|
52
|
-
elif bump_type == 'minor':
|
53
|
-
return format_version((major, minor + 1, 0))
|
54
|
-
elif bump_type == 'patch':
|
55
|
-
return format_version((major, minor, patch + 1))
|
56
|
-
else:
|
57
|
-
raise ValueError(f"Invalid bump type: {bump_type}")
|
58
|
-
|
59
|
-
|
60
|
-
def update_file(file_path: Path, old_version: str, new_version: str, patterns: list):
|
61
|
-
"""Update version in a file using specified patterns."""
|
62
|
-
if not file_path.exists():
|
63
|
-
print(f" ⚠️ {file_path} does not exist, skipping...")
|
64
|
-
return
|
65
|
-
|
66
|
-
content = file_path.read_text()
|
67
|
-
original_content = content
|
68
|
-
|
69
|
-
for pattern in patterns:
|
70
|
-
old_pattern = pattern.format(version=old_version)
|
71
|
-
new_pattern = pattern.format(version=new_version)
|
72
|
-
content = content.replace(old_pattern, new_pattern)
|
73
|
-
|
74
|
-
if content != original_content:
|
75
|
-
file_path.write_text(content)
|
76
|
-
print(f" ✅ Updated {file_path}")
|
77
|
-
else:
|
78
|
-
print(f" ℹ️ No changes in {file_path}")
|
79
|
-
|
80
|
-
|
81
|
-
def main():
|
82
|
-
"""Main function."""
|
83
|
-
if len(sys.argv) != 2:
|
84
|
-
print(__doc__)
|
85
|
-
sys.exit(1)
|
86
|
-
|
87
|
-
bump_type = sys.argv[1]
|
88
|
-
|
89
|
-
# Get current version
|
90
|
-
try:
|
91
|
-
current = get_current_version()
|
92
|
-
print(f"Current version: {current}")
|
93
|
-
except Exception as e:
|
94
|
-
print(f"Error getting current version: {e}")
|
95
|
-
sys.exit(1)
|
96
|
-
|
97
|
-
# Calculate new version
|
98
|
-
try:
|
99
|
-
new = bump_version(current, bump_type)
|
100
|
-
print(f"New version: {new}")
|
101
|
-
except Exception as e:
|
102
|
-
print(f"Error calculating new version: {e}")
|
103
|
-
sys.exit(1)
|
104
|
-
|
105
|
-
# Update files
|
106
|
-
base_path = Path(__file__).parent.parent
|
107
|
-
|
108
|
-
files_to_update = [
|
109
|
-
(
|
110
|
-
base_path / "__init__.py",
|
111
|
-
['__version__ = "{version}"']
|
112
|
-
),
|
113
|
-
(
|
114
|
-
base_path / "setup.py",
|
115
|
-
['version="{version}"']
|
116
|
-
),
|
117
|
-
(
|
118
|
-
base_path / "pyproject.toml",
|
119
|
-
['version = "{version}"']
|
120
|
-
),
|
121
|
-
]
|
122
|
-
|
123
|
-
print("\nUpdating files:")
|
124
|
-
for file_path, patterns in files_to_update:
|
125
|
-
update_file(file_path, current, new, patterns)
|
126
|
-
|
127
|
-
print(f"\n✨ Version bumped from {current} to {new}")
|
128
|
-
print("\nNext steps:")
|
129
|
-
print(f" 1. Update CHANGELOG.md with changes for v{new}")
|
130
|
-
print(f" 2. Commit: git commit -am 'Bump version to {new}'")
|
131
|
-
print(f" 3. Tag: git tag -a v{new} -m 'Release version {new}'")
|
132
|
-
print(f" 4. Push: git push origin main --tags")
|
133
|
-
print(f" 5. Build: python -m build")
|
134
|
-
print(f" 6. Upload: python -m twine upload dist/*")
|
135
|
-
|
136
|
-
|
137
|
-
if __name__ == "__main__":
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
Version bump utility for Zen Orchestrator.
|
4
|
+
Updates version in all relevant files.
|
5
|
+
|
6
|
+
Usage:
|
7
|
+
python scripts/bump_version.py patch # 1.0.0 -> 1.0.1
|
8
|
+
python scripts/bump_version.py minor # 1.0.0 -> 1.1.0
|
9
|
+
python scripts/bump_version.py major # 1.0.0 -> 2.0.0
|
10
|
+
python scripts/bump_version.py 1.2.3 # Set specific version
|
11
|
+
"""
|
12
|
+
|
13
|
+
import re
|
14
|
+
import sys
|
15
|
+
from pathlib import Path
|
16
|
+
from typing import Tuple
|
17
|
+
|
18
|
+
|
19
|
+
def parse_version(version_str: str) -> Tuple[int, int, int]:
|
20
|
+
"""Parse version string to tuple of integers."""
|
21
|
+
match = re.match(r'^(\d+)\.(\d+)\.(\d+)$', version_str)
|
22
|
+
if not match:
|
23
|
+
raise ValueError(f"Invalid version format: {version_str}")
|
24
|
+
return tuple(map(int, match.groups()))
|
25
|
+
|
26
|
+
|
27
|
+
def format_version(version_tuple: Tuple[int, int, int]) -> str:
|
28
|
+
"""Format version tuple to string."""
|
29
|
+
return '.'.join(map(str, version_tuple))
|
30
|
+
|
31
|
+
|
32
|
+
def get_current_version() -> str:
|
33
|
+
"""Get current version from __init__.py."""
|
34
|
+
init_file = Path(__file__).parent.parent / "__init__.py"
|
35
|
+
content = init_file.read_text()
|
36
|
+
match = re.search(r'__version__\s*=\s*["\']([^"\']+)["\']', content)
|
37
|
+
if not match:
|
38
|
+
raise ValueError("Could not find version in __init__.py")
|
39
|
+
return match.group(1)
|
40
|
+
|
41
|
+
|
42
|
+
def bump_version(current: str, bump_type: str) -> str:
|
43
|
+
"""Bump version based on type."""
|
44
|
+
if re.match(r'^\d+\.\d+\.\d+$', bump_type):
|
45
|
+
# Specific version provided
|
46
|
+
return bump_type
|
47
|
+
|
48
|
+
major, minor, patch = parse_version(current)
|
49
|
+
|
50
|
+
if bump_type == 'major':
|
51
|
+
return format_version((major + 1, 0, 0))
|
52
|
+
elif bump_type == 'minor':
|
53
|
+
return format_version((major, minor + 1, 0))
|
54
|
+
elif bump_type == 'patch':
|
55
|
+
return format_version((major, minor, patch + 1))
|
56
|
+
else:
|
57
|
+
raise ValueError(f"Invalid bump type: {bump_type}")
|
58
|
+
|
59
|
+
|
60
|
+
def update_file(file_path: Path, old_version: str, new_version: str, patterns: list):
|
61
|
+
"""Update version in a file using specified patterns."""
|
62
|
+
if not file_path.exists():
|
63
|
+
print(f" ⚠️ {file_path} does not exist, skipping...")
|
64
|
+
return
|
65
|
+
|
66
|
+
content = file_path.read_text()
|
67
|
+
original_content = content
|
68
|
+
|
69
|
+
for pattern in patterns:
|
70
|
+
old_pattern = pattern.format(version=old_version)
|
71
|
+
new_pattern = pattern.format(version=new_version)
|
72
|
+
content = content.replace(old_pattern, new_pattern)
|
73
|
+
|
74
|
+
if content != original_content:
|
75
|
+
file_path.write_text(content)
|
76
|
+
print(f" ✅ Updated {file_path}")
|
77
|
+
else:
|
78
|
+
print(f" ℹ️ No changes in {file_path}")
|
79
|
+
|
80
|
+
|
81
|
+
def main():
|
82
|
+
"""Main function."""
|
83
|
+
if len(sys.argv) != 2:
|
84
|
+
print(__doc__)
|
85
|
+
sys.exit(1)
|
86
|
+
|
87
|
+
bump_type = sys.argv[1]
|
88
|
+
|
89
|
+
# Get current version
|
90
|
+
try:
|
91
|
+
current = get_current_version()
|
92
|
+
print(f"Current version: {current}")
|
93
|
+
except Exception as e:
|
94
|
+
print(f"Error getting current version: {e}")
|
95
|
+
sys.exit(1)
|
96
|
+
|
97
|
+
# Calculate new version
|
98
|
+
try:
|
99
|
+
new = bump_version(current, bump_type)
|
100
|
+
print(f"New version: {new}")
|
101
|
+
except Exception as e:
|
102
|
+
print(f"Error calculating new version: {e}")
|
103
|
+
sys.exit(1)
|
104
|
+
|
105
|
+
# Update files
|
106
|
+
base_path = Path(__file__).parent.parent
|
107
|
+
|
108
|
+
files_to_update = [
|
109
|
+
(
|
110
|
+
base_path / "__init__.py",
|
111
|
+
['__version__ = "{version}"']
|
112
|
+
),
|
113
|
+
(
|
114
|
+
base_path / "setup.py",
|
115
|
+
['version="{version}"']
|
116
|
+
),
|
117
|
+
(
|
118
|
+
base_path / "pyproject.toml",
|
119
|
+
['version = "{version}"']
|
120
|
+
),
|
121
|
+
]
|
122
|
+
|
123
|
+
print("\nUpdating files:")
|
124
|
+
for file_path, patterns in files_to_update:
|
125
|
+
update_file(file_path, current, new, patterns)
|
126
|
+
|
127
|
+
print(f"\n✨ Version bumped from {current} to {new}")
|
128
|
+
print("\nNext steps:")
|
129
|
+
print(f" 1. Update CHANGELOG.md with changes for v{new}")
|
130
|
+
print(f" 2. Commit: git commit -am 'Bump version to {new}'")
|
131
|
+
print(f" 3. Tag: git tag -a v{new} -m 'Release version {new}'")
|
132
|
+
print(f" 4. Push: git push origin main --tags")
|
133
|
+
print(f" 5. Build: python -m build")
|
134
|
+
print(f" 6. Upload: python -m twine upload dist/*")
|
135
|
+
|
136
|
+
|
137
|
+
if __name__ == "__main__":
|
138
138
|
main()
|