superb-ai-onprem 0.1.2__py3-none-any.whl → 0.1.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.

Potentially problematic release.


This version of superb-ai-onprem might be problematic. Click here for more details.

spb_onprem/_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.1.2'
21
- __version_tuple__ = version_tuple = (0, 1, 2)
20
+ __version__ = version = '0.1.3'
21
+ __version_tuple__ = version_tuple = (0, 1, 3)
@@ -22,49 +22,51 @@ class AuthUser(CustomBaseModel):
22
22
  config_file: str = "~/.spb/onprem-config"
23
23
  ) -> "AuthUser":
24
24
  if cls._instance is None:
25
- if os.environ.get("SUPERB_SYSTEM_SDK") == "true":
26
- if not os.environ.get("SUNRISE_SERVER_URL") and not os.environ.get("SUPERB_SYSTEM_SDK_HOST"):
27
- raise SDKConfigError("Superb Platform SDK is not configured. Please set the environment variable SUPERB_SYSTEM_SDK_URL.")
28
-
29
- if os.environ.get("SUNRISE_SERVER_URL"):
30
- system_sdk_host = os.environ.get("SUNRISE_SERVER_URL")
31
- else:
32
- system_sdk_host = os.environ.get("SUPERB_SYSTEM_SDK_HOST")
33
-
34
- # Skip reading config file when SUPERB_SYSTEM_SDK is true
35
- cls._instance = cls(
36
- host=system_sdk_host,
37
- access_key="",
38
- access_key_secret="",
39
- is_system_sdk=True,
40
- system_sdk_user_email=os.environ.get("SUPERB_SYSTEM_SDK_USER_EMAIL", "")
41
- )
25
+ config_file_path = os.path.expanduser(config_file)
26
+
27
+ if not os.path.exists(config_file_path):
28
+ cls._instance = cls._create_system_sdk_instance()
42
29
  else:
43
- config_file_path = os.path.expanduser(config_file)
44
- config = configparser.ConfigParser()
45
- try:
46
- if not config.read(config_file_path):
47
- raise SDKConfigError(f"Failed to read config file: {config_file_path}")
48
-
49
- if "default" not in config:
50
- raise SDKConfigError(f"Missing 'default' section in config file: {config_file_path}")
51
-
52
- required_keys = ["host", "access_key", "access_key_secret"]
53
- for key in required_keys:
54
- if key not in config["default"]:
55
- raise SDKConfigError(f"Missing required key '{key}' in config file: {config_file_path}")
56
-
57
- cls._instance = cls(
58
- host=config["default"]["host"],
59
- access_key=config["default"]["access_key"],
60
- access_key_secret=config["default"]["access_key_secret"],
61
- is_system_sdk=False,
62
- system_sdk_user_email=None # Not required in normal mode
63
- )
64
- except configparser.Error as e:
65
- raise SDKConfigError(f"Error parsing config file: {str(e)}") from e
30
+ cls._instance = cls._create_config_instance(config_file_path)
66
31
  return cls._instance
67
32
 
33
+ @classmethod
34
+ def _create_system_sdk_instance(cls) -> "AuthUser":
35
+ system_sdk_host = os.environ.get("SUNRISE_SERVER_URL") or os.environ.get("SUPERB_SYSTEM_SDK_HOST") or "http://app-api:8080"
36
+
37
+ return cls(
38
+ host=system_sdk_host,
39
+ access_key="",
40
+ access_key_secret="",
41
+ is_system_sdk=True,
42
+ system_sdk_user_email=os.environ.get("SUPERB_SYSTEM_SDK_USER_EMAIL", "system@superb-ai.com")
43
+ )
44
+
45
+ @classmethod
46
+ def _create_config_instance(cls, config_file_path: str) -> "AuthUser":
47
+ config = configparser.ConfigParser()
48
+ try:
49
+ if not config.read(config_file_path):
50
+ raise SDKConfigError(f"Failed to read config file: {config_file_path}")
51
+
52
+ if "default" not in config:
53
+ raise SDKConfigError(f"Missing 'default' section in config file: {config_file_path}")
54
+
55
+ required_keys = ["host", "access_key", "access_key_secret"]
56
+ for key in required_keys:
57
+ if key not in config["default"]:
58
+ raise SDKConfigError(f"Missing required key '{key}' in config file: {config_file_path}")
59
+
60
+ return cls(
61
+ host=config["default"]["host"],
62
+ access_key=config["default"]["access_key"],
63
+ access_key_secret=config["default"]["access_key_secret"],
64
+ is_system_sdk=False,
65
+ system_sdk_user_email=None
66
+ )
67
+ except configparser.Error as e:
68
+ raise SDKConfigError(f"Error parsing config file: {str(e)}") from e
69
+
68
70
  @property
69
71
  def access_token(self):
70
72
  if self._access_token:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: superb-ai-onprem
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Python SDK for Superb AI On-premise
5
5
  Home-page: https://github.com/Superb-AI-Suite/superb-ai-onprem-python
6
6
  Author: Superb AI
@@ -1,5 +1,5 @@
1
1
  spb_onprem/__init__.py,sha256=D9PTLlvRk_aB9DWXMfGrb06dmy5wPYTrxKmNjyfWq1w,1225
2
- spb_onprem/_version.py,sha256=bSmADqydH8nBu-J4lG8UVuR7hnU_zcwhnSav2oQ0W0A,511
2
+ spb_onprem/_version.py,sha256=NIzzV8ZM0W-CSLuEs1weG4zPrn_-8yr1AwwI1iuS6yo,511
3
3
  spb_onprem/base_model.py,sha256=f2l5lgu7NYGOpVbE4_gAhMq1jBBRhaLwPf4fwJVrOHM,124
4
4
  spb_onprem/base_service.py,sha256=zaZ1rOhSAzi0bNc-y-WpUUYpM_cQl3hLFXpbmmCg73k,5607
5
5
  spb_onprem/base_types.py,sha256=5HO6uy6qf08b4KSElwIaGy7UkoQG2KqVO6gcHbsqqSo,269
@@ -66,9 +66,9 @@ spb_onprem/slices/params/slices.py,sha256=leJ6_VmUa5UCyKwspWh1iybeuu5TX4qdgOAVEM
66
66
  spb_onprem/slices/params/update_slice.py,sha256=kryOmCnRTQ_OU0qDKgugppLrpeUpuLwmn_87M5zKqIA,1209
67
67
  spb_onprem/users/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
68
68
  spb_onprem/users/entities/__init__.py,sha256=X8HZsCTlQnuPszok3AwI-i7bsQi0Ehul5L_2jZaol5E,57
69
- spb_onprem/users/entities/auth.py,sha256=UWy1dKOeUCTsXvIIqUHgPpU_RAtM82HC4X2S9ShOr98,3765
70
- superb_ai_onprem-0.1.2.dist-info/licenses/LICENSE,sha256=CdinbFiHKGkGl6cPde6WgXhMuzyUXEG6tzy2-7udZ8o,1066
71
- superb_ai_onprem-0.1.2.dist-info/METADATA,sha256=YBouuzgiaAA5vwmLCyJhfgkVY0M2PLtmveanMNkzJrE,5817
72
- superb_ai_onprem-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
73
- superb_ai_onprem-0.1.2.dist-info/top_level.txt,sha256=AZIJi8aIRJ8vxBL6vvODXVPadF4oetwn0ji2NiAndpM,11
74
- superb_ai_onprem-0.1.2.dist-info/RECORD,,
69
+ spb_onprem/users/entities/auth.py,sha256=_KP-7yUErBxhJMm-dE3ObprPEG6e0JI2qNg6g8aK1qM,3371
70
+ superb_ai_onprem-0.1.3.dist-info/licenses/LICENSE,sha256=CdinbFiHKGkGl6cPde6WgXhMuzyUXEG6tzy2-7udZ8o,1066
71
+ superb_ai_onprem-0.1.3.dist-info/METADATA,sha256=tAzoNRqF4pihZDdd0NCvNAGXoewdKjnJ9H0wuquG7fc,5817
72
+ superb_ai_onprem-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
73
+ superb_ai_onprem-0.1.3.dist-info/top_level.txt,sha256=AZIJi8aIRJ8vxBL6vvODXVPadF4oetwn0ji2NiAndpM,11
74
+ superb_ai_onprem-0.1.3.dist-info/RECORD,,