aap-utils 0.2.1__py3-none-any.whl → 0.2.3__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.
- aap_utils/cli.py +19 -13
- {aap_utils-0.2.1.dist-info → aap_utils-0.2.3.dist-info}/METADATA +1 -1
- aap_utils-0.2.3.dist-info/RECORD +8 -0
- aap_utils-0.2.1.dist-info/RECORD +0 -8
- {aap_utils-0.2.1.dist-info → aap_utils-0.2.3.dist-info}/WHEEL +0 -0
- {aap_utils-0.2.1.dist-info → aap_utils-0.2.3.dist-info}/entry_points.txt +0 -0
- {aap_utils-0.2.1.dist-info → aap_utils-0.2.3.dist-info}/top_level.txt +0 -0
aap_utils/cli.py
CHANGED
@@ -6,8 +6,8 @@ API_URL = "http://commit-svc.aiplatform/publish"
|
|
6
6
|
|
7
7
|
def extract_default_image():
|
8
8
|
"""Extracts the image name from KERNEL_IMAGE if available and formats it."""
|
9
|
-
kernel_image = os.getenv("KERNEL_IMAGE", "
|
10
|
-
image_name = kernel_image.split("/")[1].split("@")[0] # Extract
|
9
|
+
kernel_image = os.getenv("KERNEL_IMAGE", "unname/unname_image@sha256:3024")
|
10
|
+
image_name = kernel_image.split("/")[1].split("@")[0] # Extract image name
|
11
11
|
return format_name(image_name)
|
12
12
|
|
13
13
|
def format_name(name):
|
@@ -19,15 +19,21 @@ def validate_image_name(image_name):
|
|
19
19
|
return bool(re.fullmatch(r'[a-z0-9_]+', image_name))
|
20
20
|
|
21
21
|
def validate_tags(tags):
|
22
|
-
"""
|
23
|
-
tag_list = [
|
24
|
-
|
22
|
+
"""Validate tags: lowercase, alphanumeric with underscores, and no spaces."""
|
23
|
+
tag_list = [tag.strip().lower() for tag in tags.split() if tag.strip()]
|
24
|
+
|
25
|
+
if not tag_list:
|
26
|
+
return None # No valid tags
|
27
|
+
|
28
|
+
for tag in tag_list:
|
29
|
+
if not re.fullmatch(r'[a-z0-9_]+', tag):
|
30
|
+
return None # Found an invalid tag
|
31
|
+
|
32
|
+
return tag_list # Return valid tags list
|
25
33
|
|
26
34
|
def get_username():
|
27
|
-
"""Retrieve the username from the environment variable KERNEL_AP_USER or
|
28
|
-
username = os.getenv("KERNEL_AP_USER")
|
29
|
-
if not username:
|
30
|
-
username = input("Enter username (KERNEL_AP_USER not set): ").strip()
|
35
|
+
"""Retrieve the username from the environment variable KERNEL_AP_USER or use 'unname'."""
|
36
|
+
username = os.getenv("KERNEL_AP_USER", "unname")
|
31
37
|
return format_name(username)
|
32
38
|
|
33
39
|
def publish_env():
|
@@ -43,11 +49,11 @@ def publish_env():
|
|
43
49
|
print("Invalid image name. Use only lowercase letters, numbers, or underscores (_).")
|
44
50
|
|
45
51
|
while True:
|
46
|
-
tags = input("Enter tags (separated by
|
47
|
-
formatted_tags =
|
48
|
-
if
|
52
|
+
tags = input("Enter tags (separated by space): ").strip()
|
53
|
+
formatted_tags = validate_tags(tags)
|
54
|
+
if formatted_tags:
|
49
55
|
break
|
50
|
-
print("Invalid tags. Each tag must be lowercase, contain only letters, numbers, or underscores (_), and no spaces.")
|
56
|
+
print("Invalid tags. Each tag must be lowercase, contain only letters, numbers, or underscores (_), and have no spaces.")
|
51
57
|
|
52
58
|
data = {
|
53
59
|
"username": username,
|
@@ -0,0 +1,8 @@
|
|
1
|
+
aap_utils/__init__.py,sha256=g6G3i3a5ANDJWqFX2oPsLpP93aTaoTj0gkMQzeqQIJw,172
|
2
|
+
aap_utils/cli.py,sha256=aMd7ErwL0XMgYmCnWn8MyOrXkC8e_PWZ2374hcfnKYI,2877
|
3
|
+
aap_utils/register.py,sha256=J9tukByU1mcy4SoaJOoGY8jjzL9JMuNTZGtCBSwwon0,3823
|
4
|
+
aap_utils-0.2.3.dist-info/METADATA,sha256=jEzkBZdLTaps9GWURqOONx2gsRZxCfzCEn4dyBwanGY,346
|
5
|
+
aap_utils-0.2.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
+
aap_utils-0.2.3.dist-info/entry_points.txt,sha256=K-h2toLoqFxAg4Bx2r7FWggKgYnAX9zp9s4Ms4r-d6s,49
|
7
|
+
aap_utils-0.2.3.dist-info/top_level.txt,sha256=Qt5xmL8_0_jhMl9uA3lg-xnvs4nCEyVj1tBE4vnp36M,10
|
8
|
+
aap_utils-0.2.3.dist-info/RECORD,,
|
aap_utils-0.2.1.dist-info/RECORD
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
aap_utils/__init__.py,sha256=g6G3i3a5ANDJWqFX2oPsLpP93aTaoTj0gkMQzeqQIJw,172
|
2
|
-
aap_utils/cli.py,sha256=ifnQcXX6KbzL-Dm9v-SoLVl_63uXsW70Juq6qeWQhMo,2905
|
3
|
-
aap_utils/register.py,sha256=J9tukByU1mcy4SoaJOoGY8jjzL9JMuNTZGtCBSwwon0,3823
|
4
|
-
aap_utils-0.2.1.dist-info/METADATA,sha256=boJ_XinydvKnjW3oOZTsEYfA9KOFp6kphvNyGCou6fw,346
|
5
|
-
aap_utils-0.2.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
-
aap_utils-0.2.1.dist-info/entry_points.txt,sha256=K-h2toLoqFxAg4Bx2r7FWggKgYnAX9zp9s4Ms4r-d6s,49
|
7
|
-
aap_utils-0.2.1.dist-info/top_level.txt,sha256=Qt5xmL8_0_jhMl9uA3lg-xnvs4nCEyVj1tBE4vnp36M,10
|
8
|
-
aap_utils-0.2.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|