poetry-plugin-ivcap 0.2.2__tar.gz → 0.2.4__tar.gz
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.
- {poetry_plugin_ivcap-0.2.2 → poetry_plugin_ivcap-0.2.4}/PKG-INFO +3 -3
- {poetry_plugin_ivcap-0.2.2 → poetry_plugin_ivcap-0.2.4}/README.md +1 -1
- {poetry_plugin_ivcap-0.2.2 → poetry_plugin_ivcap-0.2.4}/poetry_plugin_ivcap/ivcap.py +9 -8
- {poetry_plugin_ivcap-0.2.2 → poetry_plugin_ivcap-0.2.4}/poetry_plugin_ivcap/plugin.py +10 -2
- {poetry_plugin_ivcap-0.2.2 → poetry_plugin_ivcap-0.2.4}/pyproject.toml +2 -2
- {poetry_plugin_ivcap-0.2.2 → poetry_plugin_ivcap-0.2.4}/AUTHORS.md +0 -0
- {poetry_plugin_ivcap-0.2.2 → poetry_plugin_ivcap-0.2.4}/LICENSE +0 -0
- {poetry_plugin_ivcap-0.2.2 → poetry_plugin_ivcap-0.2.4}/poetry_plugin_ivcap/docker.py +0 -0
- {poetry_plugin_ivcap-0.2.2 → poetry_plugin_ivcap-0.2.4}/poetry_plugin_ivcap/util.py +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: poetry-plugin-ivcap
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: A custom Poetry command for IVCAP deployments
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Max Ott
|
|
7
7
|
Author-email: max.ott@csiro.au
|
|
8
|
-
Requires-Python: >=3.9
|
|
8
|
+
Requires-Python: >=3.9
|
|
9
9
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -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-
|
|
50
|
+
poetry ivcap create-service-idget
|
|
51
51
|
poetry ivcap tool-register
|
|
52
52
|
```
|
|
53
53
|
|
|
@@ -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
|
-
|
|
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
|
[tool.poetry]
|
|
2
2
|
name = "poetry-plugin-ivcap"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.4"
|
|
4
4
|
description = "A custom Poetry command for IVCAP deployments"
|
|
5
5
|
authors = ["Max Ott <max.ott@csiro.au>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -8,7 +8,7 @@ readme = "README.md"
|
|
|
8
8
|
packages = [{ include = "poetry_plugin_ivcap" }]
|
|
9
9
|
|
|
10
10
|
[tool.poetry.dependencies]
|
|
11
|
-
python = "
|
|
11
|
+
python = ">=3.9"
|
|
12
12
|
pydantic = "^2.11.5"
|
|
13
13
|
humanize = "^4.12.3"
|
|
14
14
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|