autonomize-core 0.1.5__tar.gz → 0.1.7__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: autonomize-core
3
- Version: 0.1.5
3
+ Version: 0.1.7
4
4
  Summary: Autonomize Core contains the unified authentication source to access platform.
5
5
  License: Proprietary
6
6
  Author: Varun Prakash
@@ -67,7 +67,7 @@ import os
67
67
  from autonomize.core.credential import ModelhubCredential
68
68
 
69
69
  cred = ModelhubCredential(
70
- auth_url=MODELHUB_AUTH_ENDPOINT,
70
+ modelhub_url=MODELHUB_URI,
71
71
  client_id=MODELHUB_AUTH_CLIENT_ID,
72
72
  client_secret=MODELHUB_AUTH_CLIENT_SECRET,
73
73
  )
@@ -84,7 +84,7 @@ import os
84
84
  from autonomize.core.credential import ModelhubCredential
85
85
 
86
86
  cred = ModelhubCredential(
87
- auth_url=MODELHUB_AUTH_ENDPOINT,
87
+ modelhub_url=MODELHUB_URI,
88
88
  client_id=MODELHUB_AUTH_CLIENT_ID,
89
89
  client_secret=MODELHUB_AUTH_CLIENT_SECRET,
90
90
  )
@@ -101,3 +101,17 @@ Copyright (C) Autonomize AI - All Rights Reserved
101
101
 
102
102
  The contents of this repository cannot be copied and/or distributed without the explicit permission from Autonomize.ai
103
103
 
104
+ # New preferred environment variables:
105
+ MODELHUB_URI=https://your-modelhub.com
106
+ MODELHUB_AUTH_CLIENT_ID=your_client_id
107
+ MODELHUB_AUTH_CLIENT_SECRET=your_secret
108
+ GENESIS_CLIENT_ID=your_genesis_client
109
+ GENESIS_COPILOT_ID=your_copilot
110
+
111
+ # Old environment variables (still work for backward compatibility):
112
+ MODELHUB_BASE_URL=https://your-modelhub.com
113
+ MODELHUB_CLIENT_ID=your_client_id
114
+ MODELHUB_CLIENT_SECRET=your_secret
115
+ CLIENT_ID=your_client
116
+ COPILOT_ID=your_copilot
117
+
@@ -40,7 +40,7 @@ import os
40
40
  from autonomize.core.credential import ModelhubCredential
41
41
 
42
42
  cred = ModelhubCredential(
43
- auth_url=MODELHUB_AUTH_ENDPOINT,
43
+ modelhub_url=MODELHUB_URI,
44
44
  client_id=MODELHUB_AUTH_CLIENT_ID,
45
45
  client_secret=MODELHUB_AUTH_CLIENT_SECRET,
46
46
  )
@@ -57,7 +57,7 @@ import os
57
57
  from autonomize.core.credential import ModelhubCredential
58
58
 
59
59
  cred = ModelhubCredential(
60
- auth_url=MODELHUB_AUTH_ENDPOINT,
60
+ modelhub_url=MODELHUB_URI,
61
61
  client_id=MODELHUB_AUTH_CLIENT_ID,
62
62
  client_secret=MODELHUB_AUTH_CLIENT_SECRET,
63
63
  )
@@ -73,3 +73,17 @@ To contribute in our Autonomize Core SDK, please refer to our [Contribution Guid
73
73
  Copyright (C) Autonomize AI - All Rights Reserved
74
74
 
75
75
  The contents of this repository cannot be copied and/or distributed without the explicit permission from Autonomize.ai
76
+
77
+ # New preferred environment variables:
78
+ MODELHUB_URI=https://your-modelhub.com
79
+ MODELHUB_AUTH_CLIENT_ID=your_client_id
80
+ MODELHUB_AUTH_CLIENT_SECRET=your_secret
81
+ GENESIS_CLIENT_ID=your_genesis_client
82
+ GENESIS_COPILOT_ID=your_copilot
83
+
84
+ # Old environment variables (still work for backward compatibility):
85
+ MODELHUB_BASE_URL=https://your-modelhub.com
86
+ MODELHUB_CLIENT_ID=your_client_id
87
+ MODELHUB_CLIENT_SECRET=your_secret
88
+ CLIENT_ID=your_client
89
+ COPILOT_ID=your_copilot
@@ -3,7 +3,10 @@ This module contains the BaseClient class for handling common HTTP operations
3
3
  and token management using a simplified, credential-focused approach.
4
4
  """
5
5
 
6
+ # pylint: disable=C0301
7
+
6
8
  import os
9
+ import ssl
7
10
  from typing import Any, Dict, Optional
8
11
 
9
12
  import httpx
@@ -53,12 +56,22 @@ class BaseClient:
53
56
  self.credential = credential
54
57
 
55
58
  # Get client and copilot IDs from args or environment
56
- self.client_id = client_id or os.getenv("CLIENT_ID")
57
- self.copilot_id = copilot_id or os.getenv("COPILOT_ID")
59
+ self.client_id = (
60
+ client_id or os.getenv("GENESIS_CLIENT_ID") or os.getenv("CLIENT_ID")
61
+ )
62
+ self.copilot_id = (
63
+ copilot_id or os.getenv("GENESIS_COPILOT_ID") or os.getenv("COPILOT_ID")
64
+ )
58
65
 
59
66
  # Other configuration
60
67
  self.timeout = timeout
68
+
69
+ # SSL configuration
61
70
  self.verify_ssl = verify_ssl
71
+ if isinstance(self.verify_ssl, str):
72
+ if os.path.isdir(self.verify_ssl):
73
+ self.verify_ssl = ssl.create_default_context(capath=self.verify_ssl)
74
+ self.verify_ssl = ssl.create_default_context(cafile=self.verify_ssl) # type: ignore[arg-type]
62
75
 
63
76
  # Create HTTP clients with retry configured
64
77
  self.client = self._setup_client()
@@ -1,10 +1,11 @@
1
1
  """ModelhubCredential Implementation"""
2
2
 
3
- # pylint: disable=line-too-long, invalid-name
3
+ # pylint: disable=line-too-long, invalid-name, duplicate-code
4
4
 
5
5
  import base64
6
6
  import json
7
7
  import os
8
+ import ssl
8
9
  import time
9
10
  from typing import Optional
10
11
 
@@ -71,13 +72,19 @@ class ModelhubCredential:
71
72
  """
72
73
  # Initialize base URL
73
74
  self._modelhub_url = modelhub_url or (
74
- os.getenv("MODELHUB_BASE_URL", "").strip() or None
75
+ os.getenv("MODELHUB_URI", "").strip()
76
+ or os.getenv("MODELHUB_BASE_URL", "").strip()
77
+ or None
75
78
  )
76
79
  self._client_id = client_id or (
77
- os.getenv("MODELHUB_CLIENT_ID", "").strip() or None
80
+ os.getenv("MODELHUB_AUTH_CLIENT_ID", "").strip()
81
+ or os.getenv("MODELHUB_CLIENT_ID", "").strip()
82
+ or None
78
83
  )
79
84
  self._client_secret = client_secret or (
80
- os.getenv("MODELHUB_CLIENT_SECRET", "").strip() or None
85
+ os.getenv("MODELHUB_AUTH_CLIENT_SECRET", "").strip()
86
+ or os.getenv("MODELHUB_CLIENT_SECRET", "").strip()
87
+ or None
81
88
  )
82
89
  self._token = token
83
90
 
@@ -96,6 +103,10 @@ class ModelhubCredential:
96
103
 
97
104
  # SSL Config
98
105
  self.verify_ssl = verify_ssl
106
+ if isinstance(self.verify_ssl, str):
107
+ if os.path.isdir(self.verify_ssl):
108
+ self.verify_ssl = ssl.create_default_context(capath=self.verify_ssl)
109
+ self.verify_ssl = ssl.create_default_context(cafile=self.verify_ssl) # type: ignore[arg-type]
99
110
 
100
111
  # Validate credentials
101
112
  if self._client_id is None or self._client_secret is None:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "autonomize-core"
3
- version = "0.1.5"
3
+ version = "0.1.7"
4
4
  description = "Autonomize Core contains the unified authentication source to access platform."
5
5
  authors = ["Varun Prakash <varun.prakash@autonomize.ai>"]
6
6
  readme = "README.md"
File without changes