|
15 | 15 |
|
16 | 16 | from lightning_app import _logger, _PROJECT_ROOT, _root_logger
|
17 | 17 | from lightning_app.__version__ import version
|
18 |
| -from lightning_app.core.constants import PREPARE_LIGHTING |
| 18 | +from lightning_app.core.constants import PACKAGE_LIGHTNING |
19 | 19 | from lightning_app.utilities.git import check_github_repository, get_dir_name
|
20 | 20 |
|
21 | 21 | logger = logging.getLogger(__name__)
|
@@ -101,30 +101,34 @@ def _prepare_lightning_wheels_and_requirements(root: Path) -> Optional[Callable]
|
101 | 101 | # Packaging the Lightning codebase happens only inside the `lightning` repo.
|
102 | 102 | git_dir_name = get_dir_name() if check_github_repository() else None
|
103 | 103 |
|
104 |
| - if not PREPARE_LIGHTING and (not git_dir_name or (git_dir_name and not git_dir_name.startswith("lightning"))): |
| 104 | + is_lightning = git_dir_name and git_dir_name == "lightning" |
| 105 | + |
| 106 | + if (PACKAGE_LIGHTNING is None and not is_lightning) or PACKAGE_LIGHTNING == "0": |
105 | 107 | return
|
106 |
| - if not bool(int(os.getenv("SKIP_LIGHTING_WHEELS_BUILD", "0"))): |
107 |
| - download_frontend(_PROJECT_ROOT) |
108 |
| - _prepare_wheel(_PROJECT_ROOT) |
| 108 | + |
| 109 | + download_frontend(_PROJECT_ROOT) |
| 110 | + _prepare_wheel(_PROJECT_ROOT) |
109 | 111 |
|
110 | 112 | logger.info("Packaged Lightning with your application.")
|
111 | 113 |
|
112 | 114 | tar_name = _copy_tar(_PROJECT_ROOT, root)
|
113 | 115 |
|
114 | 116 | tar_files = [os.path.join(root, tar_name)]
|
115 | 117 |
|
116 |
| - # skipping this by default |
117 |
| - if not bool(int(os.getenv("SKIP_LIGHTING_UTILITY_WHEELS_BUILD", "1"))): |
| 118 | + # Don't skip by default |
| 119 | + if (PACKAGE_LIGHTNING or is_lightning) and not bool(int(os.getenv("SKIP_LIGHTING_UTILITY_WHEELS_BUILD", "0"))): |
118 | 120 | # building and copying launcher wheel if installed in editable mode
|
119 | 121 | launcher_project_path = get_dist_path_if_editable_install("lightning_launcher")
|
120 | 122 | if launcher_project_path:
|
| 123 | + logger.info("Packaged Lightning Launcher with your application.") |
121 | 124 | _prepare_wheel(launcher_project_path)
|
122 | 125 | tar_name = _copy_tar(launcher_project_path, root)
|
123 | 126 | tar_files.append(os.path.join(root, tar_name))
|
124 | 127 |
|
125 | 128 | # building and copying lightning-cloud wheel if installed in editable mode
|
126 | 129 | lightning_cloud_project_path = get_dist_path_if_editable_install("lightning_cloud")
|
127 | 130 | if lightning_cloud_project_path:
|
| 131 | + logger.info("Packaged Lightning Cloud with your application.") |
128 | 132 | _prepare_wheel(lightning_cloud_project_path)
|
129 | 133 | tar_name = _copy_tar(lightning_cloud_project_path, root)
|
130 | 134 | tar_files.append(os.path.join(root, tar_name))
|
|
0 commit comments