jvcli 2.0.21__py3-none-any.whl → 2.0.23__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.
jvcli/__init__.py CHANGED
@@ -4,5 +4,5 @@ jvcli package initialization.
4
4
  This package provides the CLI tool for Jivas Package Repository.
5
5
  """
6
6
 
7
- __version__ = "2.0.21"
7
+ __version__ = "2.0.23"
8
8
  __supported__jivas__versions__ = ["2.0.0"]
@@ -35,11 +35,26 @@ def app_header(agent_id: str, action_id: str, info: dict) -> tuple:
35
35
  if description := st.session_state[model_key].get("description", False):
36
36
  st.text(description)
37
37
 
38
- # Manage the 'enabled' field
39
- st.session_state[model_key]["enabled"] = st.checkbox(
40
- "Enabled", key="enabled", value=st.session_state[model_key]["enabled"]
38
+ def update_action() -> None:
39
+ st.session_state[model_key]
40
+ call_update_action(
41
+ agent_id=agent_id,
42
+ action_id=action_id,
43
+ action_data=st.session_state[model_key],
44
+ )
45
+
46
+ current_state = st.session_state[model_key]["enabled"]
47
+ new_state = st.checkbox(
48
+ "Enabled",
49
+ key="enabled",
50
+ value=current_state,
41
51
  )
42
52
 
53
+ if new_state != current_state:
54
+ st.session_state[model_key]["enabled"] = new_state
55
+ update_action()
56
+ st.rerun()
57
+
43
58
  return model_key, module_root
44
59
 
45
60
 
@@ -62,7 +77,10 @@ def app_controls(agent_id: str, action_id: str) -> None:
62
77
 
63
78
  if item_key not in st.session_state.get("model_key", {}).keys():
64
79
  # Special case for 'api_key' to render as a password field
65
- if item_key == "api_key":
80
+ if any(
81
+ keyword in item_key.lower() or item_key.lower() in keyword
82
+ for keyword in ["password", "token", "api_key", "key", "secret"]
83
+ ):
66
84
  st.session_state[model_key][item_key] = st.text_input(
67
85
  label, value=value, type="password", key=item_key
68
86
  )
@@ -79,6 +79,7 @@ def render(router: StreamlitRouter) -> None:
79
79
  st.text(f"- {warning}")
80
80
  if st.button("Recheck Health", key="recheck_inside_expander"):
81
81
  st.session_state["recheck_health_clicked"] = True
82
+ st.rerun()
82
83
 
83
84
  else:
84
85
  st.error("Failed to fetch healthcheck data.")
jvcli/utils.py CHANGED
@@ -5,10 +5,10 @@ import re
5
5
  import tarfile
6
6
 
7
7
  import click
8
+ import nodesemver
8
9
  import requests
10
+ import semver
9
11
  import yaml
10
- from packaging.specifiers import InvalidSpecifier, SpecifierSet
11
- from packaging.version import InvalidVersion, Version
12
12
 
13
13
  from jvcli import __supported__jivas__versions__
14
14
  from jvcli.api import RegistryAPI
@@ -91,58 +91,36 @@ def validate_package_name(name: str) -> None:
91
91
  )
92
92
 
93
93
 
94
- def is_version_compatible(version: str, specifiers: str) -> bool:
94
+ def is_version_compatible(
95
+ version: str, specifiers: str, allow_prerelease: bool = True
96
+ ) -> bool:
95
97
  """
96
- Determines if the provided version satisfies the given specifiers or exact version match.
98
+ Determines if the provided version satisfies the given specifiers or exact version match,
99
+ with an option to consider prerelease versions.
97
100
 
98
- Args:
99
- - version (str): The version to be checked. E.g., "2.1.0".
100
- - specifiers (str): The version specifier set or exact version. E.g., "2.1.0", ">=0.2,<0.3", or "^2.0.0".
101
-
102
- Returns:
103
- - bool: True if the version satisfies the specifier set or exact match, False otherwise.
101
+ - Converts comma-separated specifiers to space-separated (Node-style).
104
102
  """
105
- try:
106
- # Handle edge cases for empty strings or None inputs
107
- if not version or not specifiers:
108
- return False
109
-
110
- # Handle exact version equality when no special characters present
111
- if all(c not in specifiers for c in "<>!=~^*,"):
112
- return Version(version) == Version(specifiers)
113
-
114
- # Handle tilde (~) syntax, as in npm semver, if used
115
- if specifiers.startswith("~"):
116
- base_version = Version(specifiers[1:])
117
- if base_version.release is None or len(base_version.release) < 2:
118
- raise InvalidSpecifier(f"Invalid tilde specifier: '{specifiers}'")
119
- next_minor = base_version.minor + 1
120
- specifiers = f">={base_version},<{base_version.major}.{next_minor}.0"
121
-
122
- # Explicitly handle caret (^) syntax (npm semver style)
123
- elif specifiers.startswith("^"):
124
- base_version = Version(specifiers[1:])
125
- major, minor, patch = (
126
- base_version.major,
127
- base_version.minor,
128
- base_version.micro,
129
- )
130
-
131
- if major > 0:
132
- specifiers = f">={base_version},<{major + 1}.0.0"
133
- elif major == 0 and minor > 0:
134
- specifiers = f">={base_version},<0.{minor + 1}.0"
135
- else: # major == 0 and minor == 0
136
- specifiers = f">={base_version},<0.0.{patch + 1}"
137
-
138
- # Finally check using the SpecifierSet
139
- specifier_set = SpecifierSet(specifiers)
140
- parsed_version = Version(version)
103
+ if not version or not specifiers:
104
+ return False
141
105
 
142
- return parsed_version in specifier_set
106
+ # Replace comma(s) and optional surrounding spaces with one space
107
+ specifiers = re.sub(r"\s*,\s*", " ", specifiers.strip())
143
108
 
144
- except (InvalidVersion, InvalidSpecifier, TypeError) as e:
145
- print(f"Version parsing error: {e}")
109
+ try:
110
+ # For nodesemver
111
+ return nodesemver.satisfies(
112
+ version, specifiers, include_prerelease=allow_prerelease
113
+ )
114
+ except ImportError:
115
+ try:
116
+ # For python-semver >=3.0.0
117
+ # semver>=3.0.0 supports allow_prerelease
118
+ return semver.satisfies(
119
+ version, specifiers, allow_prerelease=allow_prerelease
120
+ )
121
+ except Exception:
122
+ return False
123
+ except Exception:
146
124
  return False
147
125
 
148
126
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jvcli
3
- Version: 2.0.21
3
+ Version: 2.0.23
4
4
  Summary: CLI tool for Jivas Package Repository
5
5
  Home-page: https://github.com/TrueSelph/jvcli
6
6
  Author: TrueSelph Inc.
@@ -18,6 +18,8 @@ Requires-Dist: streamlit-elements>=0.1.0
18
18
  Requires-Dist: streamlit-router>=0.1.8
19
19
  Requires-Dist: streamlit-javascript>=0.1.5
20
20
  Requires-Dist: python-dotenv>=1.0.0
21
+ Requires-Dist: semver>=3.0.4
22
+ Requires-Dist: node-semver>=0.9.0
21
23
  Provides-Extra: dev
22
24
  Requires-Dist: pre-commit; extra == "dev"
23
25
  Requires-Dist: pytest; extra == "dev"
@@ -1,17 +1,17 @@
1
- jvcli/__init__.py,sha256=rwEW3zEmW8938C_XRMX7PPGTl1TfTaV13RDHEb_1C_E,171
1
+ jvcli/__init__.py,sha256=VCQXylrCEDTW6Rz0VeY_DYFEzxZFpcUrQk9D4XpnHOk,171
2
2
  jvcli/api.py,sha256=gd-EP1e75e7HijyrP-EF6i_jjCo6YUeSbm1l5daKLfQ,10352
3
3
  jvcli/auth.py,sha256=mHP425hvXhNxzeX--cApkrP7SdDPmfG6V0Li5TLHmIg,1953
4
4
  jvcli/cli.py,sha256=ntTkriNGtfxFAdJw5ikdq2wD43pIqDpb7lfXsCMXOWQ,1191
5
- jvcli/utils.py,sha256=rhXStZMsW7mMp5l0p_90c7G0p1FhfVB97Cr9zN1plds,8484
5
+ jvcli/utils.py,sha256=ZTwvGcEE94aORLDbevfkPNICFqNU8PpqH7d424xuYlg,7242
6
6
  jvcli/client/__init__.py,sha256=WGP05OBzZHReqENYs1qYqMnYvgAaNVW6KvGQvyB3NGs,85
7
7
  jvcli/client/app.py,sha256=bjdGY9J43qymdmODt0BgzN66Aolyo1653ZuCj_gNdKA,6184
8
8
  jvcli/client/lib/__init__.py,sha256=_Wv8CNIxeIle_x0U9T6w9s5mPuOY9-0u69BvTEPXLUw,38
9
9
  jvcli/client/lib/page.py,sha256=QF53ffO4A2P9QTdPFfi0baCpKyEMmfkLyhJNxm7pTb0,2225
10
10
  jvcli/client/lib/utils.py,sha256=Z1YJfeu8PnS-Ko2VcvDNu7mP6JrfUP3yJsFdKDf-psg,9692
11
- jvcli/client/lib/widgets.py,sha256=kGI_bHbqUFZCFctNOwIKOL5ZdelQo9Gx_n5Ju2x3PQU,9555
11
+ jvcli/client/lib/widgets.py,sha256=lXPldIM8bCxrF2zP2hxLrdlnLzi4rzcce183_bt8O2s,10060
12
12
  jvcli/client/pages/__init__.py,sha256=sXsBV8cGItWhXtYg8PkfCd1Vi5ibd-rv5LABnPC_St4,51
13
13
  jvcli/client/pages/action_dashboard_page.py,sha256=LvDFUt2-hNSmHTHyN1tDSPaE1sV-m_uyId1sGWuoMsw,5029
14
- jvcli/client/pages/analytics_page.py,sha256=N6iA5GSVc4QyjUZASHDd16M8IpJWpt9hm-k5RgDTD_A,8273
14
+ jvcli/client/pages/analytics_page.py,sha256=TehUi9w6t-m2sW0Q24IfOqsc1WriIoD4_0GqRaYD4kk,8308
15
15
  jvcli/client/pages/chat_page.py,sha256=HJC2GxqFQhaCyv-3GmrxY6hPsR-i3BjaJyZfxAEwIk4,4769
16
16
  jvcli/client/pages/graph_page.py,sha256=2ZN-C9eskqICgnZhfP1zc6YOPPsGib_WZw3xHXcA63k,491
17
17
  jvcli/commands/__init__.py,sha256=bjZvM55MC2NugvRlxkEU9CDDP9NnsygcsGZewj1gQcg,57
@@ -53,9 +53,9 @@ jvcli/templates/2.0.0/project/main.jac,sha256=r37jsaGq-85YvDbHP3bQvBXk0u8w0rtRTZ
53
53
  jvcli/templates/2.0.0/project/actions/README.md,sha256=TU1t-rOBH5WQP_HUWaEBLq5BbPv4jejtjIrwTW4hZwM,1742
54
54
  jvcli/templates/2.0.0/project/daf/README.md,sha256=fO-dcc3j-1E6sFagIvvJsISAth11N-2d64G0yHi7JrY,1682
55
55
  jvcli/templates/2.0.0/project/tests/README.md,sha256=-1ZXkxuUKa6tMw_jlF3rpCvUFq8ijW2L-nSuAkbCANo,917
56
- jvcli-2.0.21.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
57
- jvcli-2.0.21.dist-info/METADATA,sha256=pvuUcjqJwJau9MLRCf7sRz21ZujT-Z6hXvVz70D9ARY,21604
58
- jvcli-2.0.21.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
59
- jvcli-2.0.21.dist-info/entry_points.txt,sha256=XunGcL0LWmIMIytaUckUA27czEf8M2Y4aTOfYIpOgrQ,42
60
- jvcli-2.0.21.dist-info/top_level.txt,sha256=akZnN9Zy1dFT93N0ms-C8ZXUn-xlhq37nO3jSRp0Y6o,6
61
- jvcli-2.0.21.dist-info/RECORD,,
56
+ jvcli-2.0.23.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
57
+ jvcli-2.0.23.dist-info/METADATA,sha256=Y-geVO2ZGScotSDmFAsdInQ0fYCzWtMJ0T-cMvLD7XE,21667
58
+ jvcli-2.0.23.dist-info/WHEEL,sha256=wXxTzcEDnjrTwFYjLPcsW_7_XihufBwmpiBeiXNBGEA,91
59
+ jvcli-2.0.23.dist-info/entry_points.txt,sha256=XunGcL0LWmIMIytaUckUA27czEf8M2Y4aTOfYIpOgrQ,42
60
+ jvcli-2.0.23.dist-info/top_level.txt,sha256=akZnN9Zy1dFT93N0ms-C8ZXUn-xlhq37nO3jSRp0Y6o,6
61
+ jvcli-2.0.23.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (79.0.0)
2
+ Generator: setuptools (80.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5