jvcli 2.0.12__py3-none-any.whl → 2.0.14__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.12"
7
+ __version__ = "2.0.14"
8
8
  __supported__jivas__versions__ = ["2.0.0"]
@@ -23,6 +23,7 @@ def startproject(project_name: str, version: str) -> None:
23
23
  Usage:
24
24
  jvcli startproject <project_name> [--version <jivas_version>]
25
25
  """
26
+
26
27
  template_path = os.path.join(TEMPLATES_DIR, version, "project")
27
28
 
28
29
  if not os.path.exists(template_path):
@@ -61,9 +62,22 @@ def startproject(project_name: str, version: str) -> None:
61
62
  with open(template_file_path, "r") as template_file:
62
63
  contents = template_file.read()
63
64
 
64
- # Write `.env` instead of `env.example`
65
+ if file_name == "gitignore.example":
66
+ # Write `.gitignore`
67
+ target_file_path_gitignore = os.path.join(target_dir, ".gitignore")
68
+ with open(target_file_path_gitignore, "w") as gitignore_file:
69
+ gitignore_file.write(contents)
70
+
65
71
  if file_name == "env.example":
66
- target_file_path = os.path.join(target_dir, ".env")
72
+ # Write `.env`
73
+ target_file_path_env = os.path.join(target_dir, ".env")
74
+ with open(target_file_path_env, "w") as env_file:
75
+ env_file.write(contents)
76
+
77
+ # Write `env.example`
78
+ target_file_path_example = os.path.join(target_dir, "env.example")
79
+ with open(target_file_path_example, "w") as example_file:
80
+ example_file.write(contents)
67
81
 
68
82
  with open(target_file_path, "w") as project_file:
69
83
  project_file.write(contents)
@@ -0,0 +1,53 @@
1
+ # Python #
2
+ *.pyc
3
+ __pycache__
4
+ venv
5
+ .pytest_cache
6
+ __jac_gen__
7
+
8
+ # Distribution / packaging
9
+ .Python
10
+ play/
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib64/
18
+ parts/
19
+ sdist/
20
+ var/
21
+ wheels/
22
+ share/python-wheels/
23
+ *.egg-info/
24
+ .installed.cfg
25
+ *.egg
26
+ MANIFEST
27
+ test_source/
28
+
29
+ # Others #
30
+ .coverage
31
+ .session
32
+ *.session.db
33
+ mydatabase/
34
+ actions/jivas/
35
+ .DS_Store
36
+ .vscode
37
+ build
38
+ *Zone.Identifier
39
+ .DS_Store
40
+ parser.out
41
+ codegen_output*
42
+ .qodo
43
+ .files
44
+ *.rdb
45
+ node_modules
46
+ out.dot
47
+ out.txt
48
+ .jvdata
49
+ .env
50
+
51
+ # Mypy files #
52
+ .mypy_cache*
53
+ .jac_mypy_cache*
@@ -25,7 +25,7 @@ done
25
25
  # Check if JIVAS_TOKEN is set
26
26
  if [ -n "$JIVAS_TOKEN" ]; then
27
27
 
28
- echo -e "\n\nImporting demo agent...\n"
28
+ echo -e "\n\nImporting agent...\n"
29
29
  # Import the agent
30
30
  AGENT_ID=$(curl --silent --show-error --no-progress-meter \
31
31
  --request POST \
jvcli/utils.py CHANGED
@@ -6,8 +6,8 @@ import tarfile
6
6
 
7
7
  import click
8
8
  import yaml
9
- from packaging.specifiers import SpecifierSet
10
- from packaging.version import parse as parse_version
9
+ from packaging.specifiers import InvalidSpecifier, SpecifierSet
10
+ from packaging.version import InvalidVersion, Version
11
11
 
12
12
  from jvcli import __supported__jivas__versions__
13
13
  from jvcli.api import RegistryAPI
@@ -92,61 +92,56 @@ def validate_package_name(name: str) -> None:
92
92
 
93
93
  def is_version_compatible(version: str, specifiers: str) -> bool:
94
94
  """
95
- Compares the provided version to a given set of specifications/modifiers or exact version match.
95
+ Determines if the provided version satisfies the given specifiers or exact version match.
96
96
 
97
97
  Args:
98
- - version (str): The version to be compared. E.g., "2.1.0".
99
- - specifiers (str): The version specifier set or exact version. E.g., "2.1.0" or ">=0.2,<0.3" or "0.0.1" or "^2.0.0"
98
+ - version (str): The version to be checked. E.g., "2.1.0".
99
+ - specifiers (str): The version specifier set or exact version. E.g., "2.1.0", ">=0.2,<0.3", or "^2.0.0".
100
100
 
101
101
  Returns:
102
102
  - bool: True if the version satisfies the specifier set or exact match, False otherwise.
103
103
  """
104
104
  try:
105
- # Parse the version to check
106
- version = parse_version(version)
107
-
108
- # Check if specifiers is a simple exact version match
109
- try:
110
- exact_version = parse_version(specifiers)
111
- return version == exact_version
112
- except Exception:
113
- # If parsing fails, treat it as a specifier set
114
- pass
115
-
116
- # Handle "~" shorthand by translating it to a compatible range
105
+ # Handle edge cases for empty strings or None inputs
106
+ if not version or not specifiers:
107
+ return False
108
+
109
+ # Handle exact version equality when no special characters present
110
+ if all(c not in specifiers for c in "<>!=~^*,"):
111
+ return Version(version) == Version(specifiers)
112
+
113
+ # Handle tilde (~) syntax, as in npm semver, if used
117
114
  if specifiers.startswith("~"):
118
- base_version = specifiers[1:]
119
- parsed_base = parse_version(base_version)
120
- major = parsed_base.major
121
- minor = parsed_base.minor
122
- # Assuming the next release constraint is on minor bump
123
- upper_bound = f"<{major}.{minor + 1}"
124
- specifiers = f">={base_version},{upper_bound}"
125
-
126
- # Handle "^" shorthand to translate to a compatible range
127
- if specifiers.startswith("^"):
128
- base_version = specifiers[1:]
129
- parsed_base = parse_version(base_version)
130
- major = parsed_base.major
131
- minor = parsed_base.minor
132
- patch = parsed_base.micro
115
+ base_version = Version(specifiers[1:])
116
+ if base_version.release is None or len(base_version.release) < 2:
117
+ raise InvalidSpecifier(f"Invalid tilde specifier: '{specifiers}'")
118
+ next_minor = base_version.minor + 1
119
+ specifiers = f">={base_version},<{base_version.major}.{next_minor}.0"
120
+
121
+ # Explicitly handle caret (^) syntax (npm semver style)
122
+ elif specifiers.startswith("^"):
123
+ base_version = Version(specifiers[1:])
124
+ major, minor, patch = (
125
+ base_version.major,
126
+ base_version.minor,
127
+ base_version.micro,
128
+ )
129
+
133
130
  if major > 0:
134
- upper_bound = f"<{major + 1}.0.0"
135
- elif minor > 0:
136
- upper_bound = f"<0.{minor + 1}.0"
137
- else:
138
- upper_bound = f"<0.0.{patch + 1}"
139
- specifiers = f">={base_version},{upper_bound}"
140
-
141
- # Create a SpecifierSet with the given specifiers
142
- spec_set = SpecifierSet(specifiers)
143
-
144
- # Check if the version matches the specifier set
145
- return version in spec_set
146
-
147
- except Exception as e:
148
- # Handle exceptions if the inputs are malformed or invalid
149
- click.secho(f"Error comparing versions: {e}", fg="red")
131
+ specifiers = f">={base_version},<{major + 1}.0.0"
132
+ elif major == 0 and minor > 0:
133
+ specifiers = f">={base_version},<0.{minor + 1}.0"
134
+ else: # major == 0 and minor == 0
135
+ specifiers = f">={base_version},<0.0.{patch + 1}"
136
+
137
+ # Finally check using the SpecifierSet
138
+ specifier_set = SpecifierSet(specifiers)
139
+ parsed_version = Version(version)
140
+
141
+ return parsed_version in specifier_set
142
+
143
+ except (InvalidVersion, InvalidSpecifier, TypeError) as e:
144
+ print(f"Version parsing error: {e}")
150
145
  return False
151
146
 
152
147
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jvcli
3
- Version: 2.0.12
3
+ Version: 2.0.14
4
4
  Summary: CLI tool for Jivas Package Repository
5
5
  Home-page: https://github.com/TrueSelph/jvcli
6
6
  Author: TrueSelph Inc.
@@ -1,8 +1,8 @@
1
- jvcli/__init__.py,sha256=-IAJ0CzKiWPyUvcMlu_oGrkqBmXO7nkby6CEtUlPH3w,171
1
+ jvcli/__init__.py,sha256=zpub8TOqlcUGsmZmx4-MW9dedXM7M0SnEwrcF6gAdqU,171
2
2
  jvcli/api.py,sha256=gd-EP1e75e7HijyrP-EF6i_jjCo6YUeSbm1l5daKLfQ,10352
3
3
  jvcli/auth.py,sha256=p04T02ufqbENx_93oDPg3xsq7sv-Nabeq3YR1kLXfSg,1215
4
4
  jvcli/cli.py,sha256=VM_QGPiYfSdqOZ4n0YLZbrOwXm0d5lHmzv47MqTyBMc,1060
5
- jvcli/utils.py,sha256=NKWjjJ45NFlwT7QVMh1YMY2zfvGaJ_8LppG4D8QXCwA,7726
5
+ jvcli/utils.py,sha256=sdVMBNPSI4985OdspmCxj0BVL61c6dwEQNwhvPJIiAU,7648
6
6
  jvcli/client/__init__.py,sha256=WGP05OBzZHReqENYs1qYqMnYvgAaNVW6KvGQvyB3NGs,85
7
7
  jvcli/client/app.py,sha256=2LGSY2R9GXXRNUu34wb_-i9hLOWbP34YbzgTEnBX-g8,6087
8
8
  jvcli/client/lib/__init__.py,sha256=_Wv8CNIxeIle_x0U9T6w9s5mPuOY9-0u69BvTEPXLUw,38
@@ -21,7 +21,7 @@ jvcli/commands/create.py,sha256=-9Lcng3Ef6AMZwBcuXDgvJCuvWxB_dB_fQF5-OBCkqA,1339
21
21
  jvcli/commands/download.py,sha256=AT6SFiJ9ysqNMDCdKsZ6CMUx96qpyzgraOk6EuNL2Qs,3417
22
22
  jvcli/commands/info.py,sha256=NyIDpR_AGMMSFPE0tFZv4dIuv_gwqrfd589zQAA_Q3s,2685
23
23
  jvcli/commands/publish.py,sha256=q1ihoL42GmEsU5ggHN3bcg8QD26kjRUZGfQpRzI2GMo,6630
24
- jvcli/commands/startproject.py,sha256=W7TzL8HALYd_Lzt3gLFFCZkBXZTR1jwUgZgLP6hETzI,2444
24
+ jvcli/commands/startproject.py,sha256=WMYHdKq3EUMwTPmW9E9VZl1Fbt5UO9kpHlIM-Fab8Lg,3128
25
25
  jvcli/commands/studio.py,sha256=avD5M3Ss7R6AtUMN3Mk6AmTyPJ7LnXcmwQ0mbRzivrQ,8192
26
26
  jvcli/commands/update.py,sha256=LwCLg-W1b8WSdFkiiJ8WwTit2HJXTLpM5OQ4WBTe9C4,1997
27
27
  jvcli/studio/index.html,sha256=LGhVhKwe1FF_9r_PAG7J2ZPrRLFTwFH3PpCN_KdA-10,474
@@ -45,20 +45,21 @@ jvcli/templates/2.0.0/agent_knowledge.yaml,sha256=hI0ifr0ICiZGce-oUFovBOmDWxGU1Z
45
45
  jvcli/templates/2.0.0/agent_memory.yaml,sha256=_MBgObZcW1UzwWuYQVJiPZ_7TvYbGrDgd-xMuzJEkVo,9
46
46
  jvcli/templates/2.0.0/project/README.md,sha256=cr6yHG1qEzO7xDFchEDpl8tKawVvF0tsUVTrWyxjiG4,1077
47
47
  jvcli/templates/2.0.0/project/env.example,sha256=aB3Wp-0fJV1o9WlFLjxjdA5fKMg2zBV-y8-nBm9Q-bk,396
48
+ jvcli/templates/2.0.0/project/gitignore.example,sha256=W-TIjt_iOIV0zI9bisMeJ4mvsD2Ko13jXnNKG2GlXIg,518
48
49
  jvcli/templates/2.0.0/project/globals.jac,sha256=CEt7L25wEZfE6TupqpM1ilHbtJMQQWExDQ5GJlkHPts,56
49
50
  jvcli/templates/2.0.0/project/main.jac,sha256=r37jsaGq-85YvDbHP3bQvBXk0u8w0rtRTZTNxZOjTW0,48
50
51
  jvcli/templates/2.0.0/project/actions/README.md,sha256=TU1t-rOBH5WQP_HUWaEBLq5BbPv4jejtjIrwTW4hZwM,1742
51
52
  jvcli/templates/2.0.0/project/daf/README.md,sha256=M2_BLO6vFlsnUbYHPQMIrcoboe91MO9H9RR8yP9-tF8,1683
52
53
  jvcli/templates/2.0.0/project/sh/exportenv.sh,sha256=keFEu6HAROE8F9cOa5FxdIb2pryd22fED66rhaAvAuU,164
53
- jvcli/templates/2.0.0/project/sh/importagent.sh,sha256=Xe_6seVGF52iEO_jtsvX1N3GtYBhrbYHb58k7i1VG8w,1179
54
+ jvcli/templates/2.0.0/project/sh/importagent.sh,sha256=isDMHR8ZEJEuwAAfJRc0xWhw8xHWetQNMeUqxCDOqx8,1174
54
55
  jvcli/templates/2.0.0/project/sh/initagents.sh,sha256=zFYlpt9G8kvYwGlBc-hJdz2TRQoLNY5Nq2Z_Vvto-NU,927
55
56
  jvcli/templates/2.0.0/project/sh/inituser.sh,sha256=BYvLfFZdL0n7AGmjmoTQQcb236f5wG68RMeVJiUyhFQ,1893
56
57
  jvcli/templates/2.0.0/project/sh/serve.sh,sha256=EsXOqszYD5xa8fjAEwyYCz8mSTX-v5VfiTZeKUpOKYw,105
57
58
  jvcli/templates/2.0.0/project/sh/startclient.sh,sha256=3GbJtTxycLBUJGfX2_b3cfQoAPFzhvcJpWRtS2sSsRM,119
58
59
  jvcli/templates/2.0.0/project/tests/README.md,sha256=-1ZXkxuUKa6tMw_jlF3rpCvUFq8ijW2L-nSuAkbCANo,917
59
- jvcli-2.0.12.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
60
- jvcli-2.0.12.dist-info/METADATA,sha256=IJfoL6NnwDLsjd5hbruANnzh4osTGEqDXQccWKz3Ru4,4202
61
- jvcli-2.0.12.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
62
- jvcli-2.0.12.dist-info/entry_points.txt,sha256=XunGcL0LWmIMIytaUckUA27czEf8M2Y4aTOfYIpOgrQ,42
63
- jvcli-2.0.12.dist-info/top_level.txt,sha256=akZnN9Zy1dFT93N0ms-C8ZXUn-xlhq37nO3jSRp0Y6o,6
64
- jvcli-2.0.12.dist-info/RECORD,,
60
+ jvcli-2.0.14.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
61
+ jvcli-2.0.14.dist-info/METADATA,sha256=zQUANC3ZgDTlXfnenO_l9SftYuGFwlEIZtEQDZOTLG0,4202
62
+ jvcli-2.0.14.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
63
+ jvcli-2.0.14.dist-info/entry_points.txt,sha256=XunGcL0LWmIMIytaUckUA27czEf8M2Y4aTOfYIpOgrQ,42
64
+ jvcli-2.0.14.dist-info/top_level.txt,sha256=akZnN9Zy1dFT93N0ms-C8ZXUn-xlhq37nO3jSRp0Y6o,6
65
+ jvcli-2.0.14.dist-info/RECORD,,
File without changes