gitarsenal-cli 1.1.16 → 1.1.18
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.
- package/package.json +1 -1
- package/python/__pycache__/gitarsenal_proxy_client.cpython-313.pyc +0 -0
- package/python/__pycache__/setup_modal_token.cpython-313.pyc +0 -0
- package/python/__pycache__/test_modalSandboxScript.cpython-313.pyc +0 -0
- package/python/modal_proxy_service.py +38 -7
- package/python/setup_modal_token.py +2 -1
- package/python/test_modalSandboxScript.py +36 -4
package/package.json
CHANGED
Binary file
|
Binary file
|
Binary file
|
@@ -56,11 +56,13 @@ try:
|
|
56
56
|
except ImportError:
|
57
57
|
logger.warning("setup_modal_token module not found")
|
58
58
|
# Fallback to a hardcoded token
|
59
|
-
|
59
|
+
# Modal tokens are in the format: ak-xxxxxxxxxxxxxxxxxx
|
60
|
+
MODAL_TOKEN = "ak-eNMIXRdfbvpxIXcSHKPFQW" # Your actual token
|
60
61
|
except Exception as e:
|
61
62
|
logger.error(f"Error using setup_modal_token module: {e}")
|
62
63
|
# Fallback to a hardcoded token
|
63
|
-
|
64
|
+
# Modal tokens are in the format: ak-xxxxxxxxxxxxxxxxxx
|
65
|
+
MODAL_TOKEN = "ak-eNMIXRdfbvpxIXcSHKPFQW" # Your actual token
|
64
66
|
|
65
67
|
# Set the token in environment variables
|
66
68
|
os.environ["MODAL_TOKEN"] = MODAL_TOKEN
|
@@ -294,9 +296,23 @@ def create_ssh_container():
|
|
294
296
|
f.write(f'{{"token_id": "{MODAL_TOKEN}", "token": "{MODAL_TOKEN}"}}')
|
295
297
|
logger.info(f"Created Modal token file at {token_file}")
|
296
298
|
|
297
|
-
#
|
299
|
+
# Set up token using multiple approaches
|
300
|
+
# 1. Create .modalconfig file as an alternative method
|
301
|
+
modalconfig_file = Path.home() / ".modalconfig"
|
302
|
+
with open(modalconfig_file, 'w') as f:
|
303
|
+
f.write(f"token_id = {token}\n")
|
304
|
+
logger.info(f"Created .modalconfig file at {modalconfig_file}")
|
305
|
+
|
306
|
+
# 2. Import modal and set token directly
|
298
307
|
import modal
|
299
|
-
|
308
|
+
|
309
|
+
# 3. Try to directly configure Modal
|
310
|
+
try:
|
311
|
+
import modal.config
|
312
|
+
modal.config._auth_config.token_id = token
|
313
|
+
logger.info("Explicitly set token in Modal config")
|
314
|
+
except Exception as e:
|
315
|
+
logger.warning(f"Error setting token in Modal config: {e}")
|
300
316
|
# No need to clean up any temporary files
|
301
317
|
|
302
318
|
if result.returncode == 0:
|
@@ -365,10 +381,25 @@ def create_ssh_container():
|
|
365
381
|
f.write(f'{{"token_id": "{MODAL_TOKEN}", "token": "{MODAL_TOKEN}"}}')
|
366
382
|
logger.info(f"Created Modal token file at {token_file} in thread")
|
367
383
|
|
368
|
-
#
|
384
|
+
# Set up token using multiple approaches
|
385
|
+
# 1. Create .modalconfig file as an alternative method
|
386
|
+
modalconfig_file = Path.home() / ".modalconfig"
|
387
|
+
with open(modalconfig_file, 'w') as f:
|
388
|
+
f.write(f"token_id = {MODAL_TOKEN}\n")
|
389
|
+
logger.info(f"Created .modalconfig file at {modalconfig_file} in thread")
|
390
|
+
|
391
|
+
# 2. Import modal and set token directly
|
369
392
|
import modal
|
370
|
-
|
371
|
-
|
393
|
+
|
394
|
+
# 3. Try to directly configure Modal
|
395
|
+
try:
|
396
|
+
import modal.config
|
397
|
+
modal.config._auth_config.token_id = MODAL_TOKEN
|
398
|
+
logger.info("Explicitly set token in Modal config in thread")
|
399
|
+
except Exception as e:
|
400
|
+
logger.warning(f"Error setting token in Modal config in thread: {e}")
|
401
|
+
|
402
|
+
logger.info("Modal token setup completed in thread")
|
372
403
|
except Exception as e:
|
373
404
|
logger.warning(f"Failed to set token via CLI in thread: {e}")
|
374
405
|
|
@@ -21,7 +21,8 @@ logger = logging.getLogger("modal-setup")
|
|
21
21
|
|
22
22
|
# Built-in Modal token for the freemium service
|
23
23
|
# This token is used for all users of the package
|
24
|
-
|
24
|
+
# Modal tokens are in the format: ak-xxxxxxxxxxxxxxxxxx
|
25
|
+
BUILT_IN_MODAL_TOKEN = "ak-eNMIXRdfbvpxIXcSHKPFQW" # Your actual token
|
25
26
|
|
26
27
|
def setup_modal_token():
|
27
28
|
"""
|
@@ -18,7 +18,8 @@ try:
|
|
18
18
|
modal_dir.mkdir(exist_ok=True)
|
19
19
|
|
20
20
|
# Use the token from environment or a default one
|
21
|
-
|
21
|
+
# Modal tokens are in the format: ak-xxxxxxxxxxxxxxxxxx
|
22
|
+
token = os.environ.get("MODAL_TOKEN_ID") or os.environ.get("MODAL_TOKEN") or "ak-eNMIXRdfbvpxIXcSHKPFQW"
|
22
23
|
|
23
24
|
# Set both environment variables
|
24
25
|
os.environ["MODAL_TOKEN_ID"] = token
|
@@ -39,12 +40,27 @@ try:
|
|
39
40
|
if os.environ.get('MODAL_TOKEN'):
|
40
41
|
print(f"🔍 MODAL_TOKEN length: {len(os.environ.get('MODAL_TOKEN'))}")
|
41
42
|
print(f"✅ Modal token found (length: {len(token)})")
|
43
|
+
|
44
|
+
# Create a .modalconfig file as an alternative method
|
45
|
+
modalconfig_file = Path.home() / ".modalconfig"
|
46
|
+
with open(modalconfig_file, 'w') as f:
|
47
|
+
f.write(f"token_id = {token}\n")
|
48
|
+
print(f"✅ Created .modalconfig file at {modalconfig_file}")
|
42
49
|
except Exception as e:
|
43
50
|
print(f"⚠️ Error setting up Modal token: {e}")
|
44
51
|
|
45
52
|
# Import modal after token setup
|
46
53
|
import modal
|
47
54
|
|
55
|
+
# Explicitly set the token in Modal's config
|
56
|
+
try:
|
57
|
+
# Try to directly configure Modal with the token
|
58
|
+
import modal.config
|
59
|
+
modal.config._auth_config.token_id = token
|
60
|
+
print(f"✅ Explicitly set token in Modal config")
|
61
|
+
except Exception as e:
|
62
|
+
print(f"⚠️ Error setting token in Modal config: {e}")
|
63
|
+
|
48
64
|
def handle_interactive_input(prompt, is_password=False):
|
49
65
|
"""Handle interactive input from the user with optional password masking"""
|
50
66
|
print("\n" + "="*60)
|
@@ -2131,8 +2147,9 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
|
|
2131
2147
|
if modal_token_id:
|
2132
2148
|
print(f"✅ Modal token found (length: {len(modal_token_id)})")
|
2133
2149
|
|
2134
|
-
#
|
2150
|
+
# Set up Modal token using multiple approaches
|
2135
2151
|
try:
|
2152
|
+
# 1. Create token file
|
2136
2153
|
from pathlib import Path
|
2137
2154
|
modal_dir = Path.home() / ".modal"
|
2138
2155
|
modal_dir.mkdir(exist_ok=True)
|
@@ -2141,10 +2158,25 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
|
|
2141
2158
|
print(f"🔄 Creating Modal token file (token length: {len(modal_token_id)})")
|
2142
2159
|
with open(token_file, 'w') as f:
|
2143
2160
|
f.write(f'{{"token_id": "{modal_token_id}", "token": "{modal_token_id}"}}')
|
2144
|
-
|
2145
2161
|
print(f"✅ Modal token file created at {token_file}")
|
2162
|
+
|
2163
|
+
# 2. Create .modalconfig file
|
2164
|
+
modalconfig_file = Path.home() / ".modalconfig"
|
2165
|
+
with open(modalconfig_file, 'w') as f:
|
2166
|
+
f.write(f"token_id = {modal_token_id}\n")
|
2167
|
+
print(f"✅ Created .modalconfig file at {modalconfig_file}")
|
2168
|
+
|
2169
|
+
# 3. Try to directly configure Modal
|
2170
|
+
import modal.config
|
2171
|
+
modal.config._auth_config.token_id = modal_token_id
|
2172
|
+
print(f"✅ Explicitly set token in Modal config")
|
2173
|
+
|
2174
|
+
# 4. Set environment variables again to be sure
|
2175
|
+
os.environ["MODAL_TOKEN_ID"] = modal_token_id
|
2176
|
+
os.environ["MODAL_TOKEN"] = modal_token_id
|
2177
|
+
print(f"✅ Reset environment variables with token")
|
2146
2178
|
except Exception as e:
|
2147
|
-
print(f"⚠️ Error
|
2179
|
+
print(f"⚠️ Error setting up Modal token: {e}")
|
2148
2180
|
else:
|
2149
2181
|
print("❌ No Modal token found in environment variables")
|
2150
2182
|
# Try to get from file as a last resort
|