unitlab 2.3.18__tar.gz → 2.3.20__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.1
2
2
  Name: unitlab
3
- Version: 2.3.18
3
+ Version: 2.3.20
4
4
  Home-page: https://github.com/teamunitlab/unitlab-sdk
5
5
  Author: Unitlab Inc.
6
6
  Author-email: team@unitlab.ai
@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
2
2
 
3
3
  setup(
4
4
  name="unitlab",
5
- version="2.3.18",
5
+ version="2.3.20",
6
6
  license="MIT",
7
7
  author="Unitlab Inc.",
8
8
  author_email="team@unitlab.ai",
@@ -382,7 +382,6 @@ class CloudflareAPITunnel:
382
382
  if delete_response.status_code in [200, 204, 404]:
383
383
  print(f" ✅ Deleted old tunnel")
384
384
  # Try creating a new one with a timestamp suffix
385
- import time
386
385
  self.clean_device_id = f"{self.device_id.replace(' ', '').replace('-', '').replace('.', '').replace('_', '')[:24]}-{int(time.time())}"
387
386
  device_tunnel = self.create_device_tunnel(retry_on_fail=False)
388
387
  if device_tunnel:
@@ -464,10 +463,11 @@ class CloudflareAPITunnel:
464
463
 
465
464
  # If 404, tunnel doesn't exist or we don't have access
466
465
  if token_response.status_code == 404:
467
- print(f"🔄 Tunnel not accessible (404), will try to recreate...")
468
- # Mark for recreation
466
+ print(f"🔄 Tunnel not accessible (404), will recreate...")
467
+ # Mark for recreation and continue
469
468
  device_tunnel['needs_recreation'] = True
470
- return None
469
+ # Set cmd to None to skip the rest of this block
470
+ cmd = None
471
471
  else:
472
472
  print(f" ℹ️ Token endpoint returned {token_response.status_code}")
473
473
  print(f" This might mean the tunnel needs to be recreated manually")
@@ -496,27 +496,37 @@ class CloudflareAPITunnel:
496
496
  tunnel_id
497
497
  ]
498
498
 
499
- self.tunnel_process = subprocess.Popen(
500
- cmd,
501
- stdout=subprocess.PIPE,
502
- stderr=subprocess.STDOUT,
503
- text=True,
504
- bufsize=1
505
- )
506
-
507
- print("⏳ Waiting for tunnel to connect...")
508
- time.sleep(5)
509
-
510
- if self.tunnel_process.poll() is None:
511
- print("✅ Tunnel is running!")
512
- print(f"📌 Device ID: {self.clean_device_id}")
513
- print(f"📌 Jupyter URL: {self.jupyter_url}")
514
- print(f"📌 SSH hostname: {self.ssh_hostname}")
515
- print(f"📌 SSH command: ssh -o ProxyCommand='cloudflared access ssh --hostname {self.ssh_hostname}' user@localhost")
516
- return self.tunnel_process
499
+ # Only start the tunnel if we have a valid command
500
+ if cmd:
501
+ self.tunnel_process = subprocess.Popen(
502
+ cmd,
503
+ stdout=subprocess.PIPE,
504
+ stderr=subprocess.STDOUT,
505
+ text=True,
506
+ bufsize=1
507
+ )
508
+
509
+ print("⏳ Waiting for tunnel to connect...")
510
+ time.sleep(5)
511
+
512
+ if self.tunnel_process.poll() is None:
513
+ print(" Tunnel is running!")
514
+ print(f"📌 Device ID: {self.clean_device_id}")
515
+ print(f"📌 Jupyter URL: {self.jupyter_url}")
516
+ print(f"📌 SSH hostname: {self.ssh_hostname}")
517
+ print(f"📌 SSH command: ssh -o ProxyCommand='cloudflared access ssh --hostname {self.ssh_hostname}' user@localhost")
518
+ return self.tunnel_process
519
+ else:
520
+ output = self.tunnel_process.stdout.read() if self.tunnel_process.stdout else ""
521
+ print(f"❌ Tunnel failed to start: {output}")
522
+ return None
517
523
  else:
518
- output = self.tunnel_process.stdout.read() if self.tunnel_process.stdout else ""
519
- print(f"❌ Tunnel failed to start: {output}")
524
+ # If no cmd, it means we need to handle recreation or other error
525
+ if device_tunnel and device_tunnel.get('needs_recreation'):
526
+ # The recreation happens above before this point
527
+ print("❌ Failed to start tunnel after recreation attempt")
528
+ else:
529
+ print("❌ No valid command to start tunnel")
520
530
  return None
521
531
 
522
532
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unitlab
3
- Version: 2.3.18
3
+ Version: 2.3.20
4
4
  Home-page: https://github.com/teamunitlab/unitlab-sdk
5
5
  Author: Unitlab Inc.
6
6
  Author-email: team@unitlab.ai
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes