Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/lightning_app/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed `AutoScaler` failing due to port collision across works ([#15966](https://github.com/Lightning-AI/lightning/pull/15966))


- Fixed a bug where auto-upgrading to the latest lightning via the CLI could get stuck in a loop ([#15984](https://github.com/Lightning-AI/lightning/pull/15984))


- Fixed Registration for CloudComputes of Works in `L.app.structures` ([#15964](https://github.com/Lightning-AI/lightning/pull/15964))


Expand Down
5 changes: 3 additions & 2 deletions src/lightning_app/cli/lightning_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@


def main() -> None:
# Check environment and versions if not in the cloud
if "LIGHTNING_APP_STATE_URL" not in os.environ:
# Check environment and versions if not in the cloud and not testing
is_testing = bool(int(os.getenv("LIGHTING_TESTING", "0")))
if not is_testing and "LIGHTNING_APP_STATE_URL" not in os.environ:
# Enforce running in PATH Python
_check_environment_and_redirect()

Expand Down
1 change: 1 addition & 0 deletions src/lightning_app/testing/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ def run_app_in_cloud(
with tempfile.TemporaryDirectory() as tmpdir:
env_copy = os.environ.copy()
env_copy["PACKAGE_LIGHTNING"] = "1"
env_copy["LIGHTING_TESTING"] = "1"
if debug:
env_copy["LIGHTNING_DEBUG"] = "1"
shutil.copytree(app_folder, tmpdir, dirs_exist_ok=True)
Expand Down
4 changes: 2 additions & 2 deletions src/lightning_app/utilities/cli_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def _get_newer_version() -> Optional[str]:
return None if __version__ == latest_version else latest_version
except Exception:
# Return None if any exception occurs
return "err"
return None


def _redirect_command(executable: str):
Expand All @@ -277,7 +277,7 @@ def _check_version_and_upgrade():
prompt = f"A newer version of {__package_name__} is available ({new_version}). Would you like to upgrade?"

if click.confirm(prompt, default=True):
command = f"pip install --upgrade {__package_name__}"
command = f"pip install '{__package_name__}=={new_version}'"

logger.info(f"⚡ RUN: {command}")

Expand Down
2 changes: 1 addition & 1 deletion tests/tests_app/utilities/test_cli_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_arrow_time_callback():
"1.0.0dev",
None,
),
({"1.0.0": "this wil trigger an error"}, "1.0.0", "err"),
({"1.0.0": "this wil trigger an error"}, "1.0.0", None),
({}, "1.0.0rc0", None),
],
)
Expand Down