devs-common 2.0.10__tar.gz → 2.0.11__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.
Files changed (42) hide show
  1. {devs_common-2.0.10 → devs_common-2.0.11}/PKG-INFO +1 -1
  2. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/core/container.py +22 -17
  3. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common.egg-info/PKG-INFO +1 -1
  4. {devs_common-2.0.10 → devs_common-2.0.11}/pyproject.toml +1 -1
  5. {devs_common-2.0.10 → devs_common-2.0.11}/LICENSE +0 -0
  6. {devs_common-2.0.10 → devs_common-2.0.11}/README.md +0 -0
  7. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/__init__.py +0 -0
  8. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/config.py +0 -0
  9. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/core/__init__.py +0 -0
  10. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/core/project.py +0 -0
  11. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/core/workspace.py +0 -0
  12. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/devs_config.py +0 -0
  13. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/exceptions.py +0 -0
  14. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/templates/Dockerfile +0 -0
  15. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/templates/devcontainer.json +0 -0
  16. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/templates/scripts/copy-ssh.sh +0 -0
  17. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/templates/scripts/post-create-wrapper.sh +0 -0
  18. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/templates/scripts/python-venv-integration.sh +0 -0
  19. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/templates/scripts/screenshot-webapp.sh +0 -0
  20. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/templates/scripts/setup-workspace.sh +0 -0
  21. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/templates/scripts/start-tunnel.sh +0 -0
  22. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/templates/scripts/tunnel-status.sh +0 -0
  23. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/templates/scripts/webapp-screenshot.py +0 -0
  24. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/templates/sudo-scripts/init-firewall.sh +0 -0
  25. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/templates/sudo-scripts/setup-devs-env.sh +0 -0
  26. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/templates/sudo-scripts/setup-vscode-cache.sh +0 -0
  27. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/templates/sudo-scripts/start-services.sh +0 -0
  28. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/templates/vscode-settings-reference.md +0 -0
  29. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/utils/__init__.py +0 -0
  30. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/utils/config_hash.py +0 -0
  31. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/utils/console.py +0 -0
  32. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/utils/devcontainer.py +0 -0
  33. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/utils/devcontainer_template.py +0 -0
  34. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/utils/docker_client.py +0 -0
  35. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/utils/file_utils.py +0 -0
  36. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/utils/git_utils.py +0 -0
  37. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common/utils/repo_cache.py +0 -0
  38. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common.egg-info/SOURCES.txt +0 -0
  39. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common.egg-info/dependency_links.txt +0 -0
  40. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common.egg-info/requires.txt +0 -0
  41. {devs_common-2.0.10 → devs_common-2.0.11}/devs_common.egg-info/top_level.txt +0 -0
  42. {devs_common-2.0.10 → devs_common-2.0.11}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devs-common
3
- Version: 2.0.10
3
+ Version: 2.0.11
4
4
  Summary: Shared utilities for devs package ecosystem
5
5
  Author: Dan Lester
6
6
  License-Expression: MIT
@@ -399,27 +399,20 @@ class ContainerManager:
399
399
  project_labels = self._get_project_labels(dev_name)
400
400
 
401
401
  try:
402
- console.print(f" 🔍 Looking for containers with labels: {project_labels}")
403
402
  existing_containers = self.docker.find_containers_by_labels(project_labels)
404
- console.print(f" 📋 Found {len(existing_containers)} containers")
405
403
 
406
404
  if existing_containers:
407
405
  for container_info in existing_containers:
408
406
  container_name = container_info['name']
409
- container_status = container_info['status']
410
407
 
411
- console.print(f" 🛑 Stopping container: {container_name} (status: {container_status})")
412
408
  try:
413
- stop_result = self.docker.stop_container(container_name)
414
- console.print(f" 📋 Stop result: {stop_result}")
409
+ self.docker.stop_container(container_name)
415
410
  except DockerError as stop_e:
416
411
  console.print(f" ⚠️ Stop failed for {container_name}: {stop_e}")
417
412
 
418
413
  if remove:
419
- console.print(f" 🗑️ Removing container: {container_name}")
420
414
  try:
421
- remove_result = self.docker.remove_container(container_name)
422
- console.print(f" 📋 Remove result: {remove_result}")
415
+ self.docker.remove_container(container_name)
423
416
  except DockerError as remove_e:
424
417
  console.print(f" ⚠️ Remove failed for {container_name}: {remove_e}")
425
418
 
@@ -586,7 +579,7 @@ class ContainerManager:
586
579
 
587
580
  return removed_count
588
581
 
589
- def _prepare_container_exec(self, dev_name: str, workspace_dir: Path, debug: bool = False, live: bool = False, extra_env: Optional[Dict[str, str]] = None) -> Tuple[str, str]:
582
+ def _prepare_container_exec(self, dev_name: str, workspace_dir: Path, debug: bool = False, live: bool = False, extra_env: Optional[Dict[str, str]] = None, reuse_existing: bool = False) -> Tuple[str, str]:
590
583
  """Prepare container for exec operations (shared by exec_shell and exec_command).
591
584
 
592
585
  Args:
@@ -595,6 +588,10 @@ class ContainerManager:
595
588
  debug: Show debug output for devcontainer operations
596
589
  live: Whether the container is in live mode
597
590
  extra_env: Additional environment variables to pass to container
591
+ reuse_existing: If True, use existing container as-is (starting
592
+ it if stopped) without rebuilding. Only creates a new
593
+ container if none exists. Used by tunnel commands to
594
+ avoid accidentally destroying work in the container.
598
595
 
599
596
  Returns:
600
597
  Tuple of (container_name, container_workspace_dir)
@@ -623,9 +620,17 @@ class ContainerManager:
623
620
  workspace_name = workspace_info["workspace_name"]
624
621
  container_workspace_dir = f"/workspaces/{workspace_name}"
625
622
 
626
- # Ensure container is running
627
- if not self.ensure_container_running(dev_name, workspace_dir, debug=debug, live=live, extra_env=extra_env):
628
- raise ContainerError(f"Failed to start container for {dev_name}")
623
+ if reuse_existing and existing_containers:
624
+ # Use existing container as-is (start if stopped, but never rebuild)
625
+ status = existing_containers[0].get('status', '')
626
+ if status != 'running':
627
+ container_id = existing_containers[0].get('name', container_name)
628
+ console.print(f" ▶️ Starting stopped container: {container_id}")
629
+ self.docker.start_container(container_id)
630
+ else:
631
+ # Ensure container is running (may create/restart as needed)
632
+ if not self.ensure_container_running(dev_name, workspace_dir, debug=debug, live=live, extra_env=extra_env):
633
+ raise ContainerError(f"Failed to start container for {dev_name}")
629
634
 
630
635
  return container_name, container_workspace_dir
631
636
 
@@ -896,7 +901,7 @@ class ContainerManager:
896
901
  """
897
902
  try:
898
903
  container_name, container_workspace_dir = self._prepare_container_exec(
899
- dev_name, workspace_dir, debug=debug, live=live, extra_env=extra_env
904
+ dev_name, workspace_dir, debug=debug, live=live, extra_env=extra_env, reuse_existing=True
900
905
  )
901
906
 
902
907
  tunnel_name = self._get_tunnel_name(dev_name)
@@ -954,7 +959,7 @@ class ContainerManager:
954
959
  """
955
960
  try:
956
961
  container_name, container_workspace_dir = self._prepare_container_exec(
957
- dev_name, workspace_dir, debug=debug, live=live, extra_env=extra_env
962
+ dev_name, workspace_dir, debug=debug, live=live, extra_env=extra_env, reuse_existing=True
958
963
  )
959
964
 
960
965
  tunnel_name = self._get_tunnel_name(dev_name)
@@ -1049,7 +1054,7 @@ class ContainerManager:
1049
1054
  try:
1050
1055
  # Prepare container for execution
1051
1056
  container_name, container_workspace_dir = self._prepare_container_exec(
1052
- dev_name, workspace_dir, debug=debug, live=live, extra_env=extra_env
1057
+ dev_name, workspace_dir, debug=debug, live=live, extra_env=extra_env, reuse_existing=True
1053
1058
  )
1054
1059
 
1055
1060
  # Check tunnel status
@@ -1091,7 +1096,7 @@ class ContainerManager:
1091
1096
  try:
1092
1097
  # Prepare container for execution
1093
1098
  container_name, container_workspace_dir = self._prepare_container_exec(
1094
- dev_name, workspace_dir, debug=debug, live=live, extra_env=extra_env
1099
+ dev_name, workspace_dir, debug=debug, live=live, extra_env=extra_env, reuse_existing=True
1095
1100
  )
1096
1101
 
1097
1102
  # Kill the tunnel
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devs-common
3
- Version: 2.0.10
3
+ Version: 2.0.11
4
4
  Summary: Shared utilities for devs package ecosystem
5
5
  Author: Dan Lester
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "devs-common"
7
- version = "2.0.10"
7
+ version = "2.0.11"
8
8
  description = "Shared utilities for devs package ecosystem"
9
9
  authors = [
10
10
  {name = "Dan Lester"},
File without changes
File without changes
File without changes