poetry-plugin-ivcap 0.2.3__py3-none-any.whl → 0.2.4__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.
@@ -108,16 +108,16 @@ def tool_register(data, line):
108
108
  if os.path.exists(tmp_path):
109
109
  os.remove(tmp_path)
110
110
 
111
- def get_service_id(data, line):
111
+ def get_service_id(data, is_silent, line):
112
112
  service_id = data.get("tool", {}).get("poetry-plugin-ivcap", {}).get("service-id")
113
113
  if not service_id:
114
- service_id = create_service_id(data, line)
114
+ service_id = create_service_id(data, is_silent, line)
115
115
  return service_id
116
116
 
117
- def create_service_id(data, line):
118
- check_ivcap_cmd(line)
117
+ def create_service_id(data, is_silent, line):
118
+ check_ivcap_cmd(line, is_silent)
119
119
  name = get_name(data)
120
- account_id = get_account_id(data, line)
120
+ account_id = get_account_id(data, line, is_silent)
121
121
  id = uuid.uuid5(uuid.NAMESPACE_DNS, f"{name}{account_id}")
122
122
  return f"urn:ivcap:service:{id}"
123
123
 
@@ -127,10 +127,11 @@ def get_policy(data, line):
127
127
  policy = "urn:ivcap:policy:ivcap.open.metadata"
128
128
  return policy
129
129
 
130
- def get_account_id(data, line):
130
+ def get_account_id(data, line, is_silent=False):
131
131
  check_ivcap_cmd(line)
132
132
  cmd = ["ivcap", "context", "get", "account-id"]
133
- line(f"<debug>Running: {' '.join(cmd)} </debug>")
133
+ if not is_silent:
134
+ line(f"<debug>Running: {' '.join(cmd)} </debug>")
134
135
  try:
135
136
  account_id = subprocess.check_output(cmd).decode().strip()
136
137
  return account_id
@@ -138,7 +139,7 @@ def get_account_id(data, line):
138
139
  line(f"<error>Error retrieving account ID: {e}</error>")
139
140
  sys.exit(1)
140
141
 
141
- def check_ivcap_cmd(line):
142
+ def check_ivcap_cmd(line, is_silent=False):
142
143
  if not command_exists("ivcap"):
143
144
  line("<error>'ivcap' command not found. Please install the IVCAP CLI tool.</error>")
144
145
  line("<error>... see https://github.com/ivcap-works/ivcap-cli?tab=readme-ov-file#install-released-binaries for instructions</error>")
@@ -6,12 +6,12 @@
6
6
  import os
7
7
  from poetry.plugins.application_plugin import ApplicationPlugin
8
8
  from cleo.commands.command import Command
9
- from cleo.helpers import argument
9
+ from cleo.helpers import argument, option
10
10
  import subprocess
11
11
 
12
12
  from poetry_plugin_ivcap.util import get_version
13
13
 
14
- from .ivcap import create_service_id, service_register, tool_register
14
+ from .ivcap import create_service_id, get_service_id, service_register, tool_register
15
15
  from .docker import docker_build, docker_run
16
16
  from .ivcap import docker_publish
17
17
 
@@ -31,6 +31,7 @@ Available subcommands:
31
31
  docker-publish Publish the service's docker image to IVCAP
32
32
  service-register Register the service with IVCAP
33
33
  create-service-id Create a unique service ID for the service
34
+ get-service-id Return the service ID for the service
34
35
  tool-register Register the service as an AI Tool with IVCAP
35
36
 
36
37
  Example:
@@ -50,6 +51,9 @@ Configurable options in pyproject.toml:
50
51
  argument("subcommand", optional=True, description="Subcommand: run, deploy, etc."),
51
52
  argument("args", optional=True, multiple=True, description="Additional arguments for subcommand"),
52
53
  ]
54
+ options = [
55
+ option("silent", None, "Run silently (no output)", flag=True),
56
+ ]
53
57
 
54
58
  allow_extra_args = True
55
59
  ignore_validation_errors = True
@@ -60,6 +64,7 @@ Configurable options in pyproject.toml:
60
64
 
61
65
  sub = self.argument("subcommand")
62
66
  args = self.argument("args")
67
+ is_silent = self.option("silent")
63
68
 
64
69
  if sub == "run":
65
70
  self.run_service(data, args, self.line)
@@ -74,6 +79,9 @@ Configurable options in pyproject.toml:
74
79
  elif sub == "create-service-id":
75
80
  sid = create_service_id(data, self.line)
76
81
  print(sid)
82
+ elif sub == "get-service-id":
83
+ sid = get_service_id(data, is_silent, self.line)
84
+ print(sid)
77
85
  elif sub == "tool-register":
78
86
  tool_register(data, self.line)
79
87
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: poetry-plugin-ivcap
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: A custom Poetry command for IVCAP deployments
5
5
  License: MIT
6
6
  Author: Max Ott
@@ -47,7 +47,7 @@ poetry ivcap docker-build
47
47
  poetry ivcap docker-run
48
48
  poetry ivcap docker-publish
49
49
  poetry ivcap service-register
50
- poetry ivcap create-service-id
50
+ poetry ivcap create-service-idget
51
51
  poetry ivcap tool-register
52
52
  ```
53
53
 
@@ -0,0 +1,10 @@
1
+ poetry_plugin_ivcap/docker.py,sha256=9frC-F5S3p3vP-4mrLSlqvtx9ayNZ-xZXsMkWAtg4y4,7952
2
+ poetry_plugin_ivcap/ivcap.py,sha256=kG2uplKuYy7RQuEzm6KY_PH7fcHqwug0FphmNBqKLKI,5739
3
+ poetry_plugin_ivcap/plugin.py,sha256=T1l8O5Hmh-S2Mqhx9wmF2H8gJ5zAOb4Exv-yS83-4OM,4212
4
+ poetry_plugin_ivcap/util.py,sha256=bcjjbKoV_pAgeuC7Ws9XbJa3phFpNVyrRAlFJ1VubRg,3429
5
+ poetry_plugin_ivcap-0.2.4.dist-info/AUTHORS.md,sha256=s9xR4_HAHQgbNlj505LViebt5AtACQmhPf92aJvNYgg,88
6
+ poetry_plugin_ivcap-0.2.4.dist-info/LICENSE,sha256=dsQrDPPwW7iJs9pxahgJKDW8RNPf5FyXG70MFUlxcuk,1587
7
+ poetry_plugin_ivcap-0.2.4.dist-info/METADATA,sha256=UyJme5lRgsJ22v6-XMqAXf0cmEQ5dobiOdQ3tRvg1Ns,3032
8
+ poetry_plugin_ivcap-0.2.4.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
9
+ poetry_plugin_ivcap-0.2.4.dist-info/entry_points.txt,sha256=3xagEFBkGgrVe8WyjmhlHLr4JDEWPN_W4DwxnIBWbNY,74
10
+ poetry_plugin_ivcap-0.2.4.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- poetry_plugin_ivcap/docker.py,sha256=9frC-F5S3p3vP-4mrLSlqvtx9ayNZ-xZXsMkWAtg4y4,7952
2
- poetry_plugin_ivcap/ivcap.py,sha256=5s9y6U-nhdmTh-Xeek8l_oCJvnufYa485GAlr4GE_Xs,5624
3
- poetry_plugin_ivcap/plugin.py,sha256=v_lW-G4FE1l2SmKt_Xfx-mrwxabWhWjsKsbvGS0h7HY,3869
4
- poetry_plugin_ivcap/util.py,sha256=bcjjbKoV_pAgeuC7Ws9XbJa3phFpNVyrRAlFJ1VubRg,3429
5
- poetry_plugin_ivcap-0.2.3.dist-info/AUTHORS.md,sha256=s9xR4_HAHQgbNlj505LViebt5AtACQmhPf92aJvNYgg,88
6
- poetry_plugin_ivcap-0.2.3.dist-info/LICENSE,sha256=dsQrDPPwW7iJs9pxahgJKDW8RNPf5FyXG70MFUlxcuk,1587
7
- poetry_plugin_ivcap-0.2.3.dist-info/METADATA,sha256=nwCpQpWqEhvm6ATx8lQ4R_tlKZZiUPqQKUONo0P7_hw,3029
8
- poetry_plugin_ivcap-0.2.3.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
9
- poetry_plugin_ivcap-0.2.3.dist-info/entry_points.txt,sha256=3xagEFBkGgrVe8WyjmhlHLr4JDEWPN_W4DwxnIBWbNY,74
10
- poetry_plugin_ivcap-0.2.3.dist-info/RECORD,,