From ddb0e46eb12be8dfe044bf6ed6152ed70904fc69 Mon Sep 17 00:00:00 2001 From: Justus Schock <12886177+justusschock@users.noreply.github.com> Date: Thu, 13 Feb 2025 23:13:58 +0100 Subject: [PATCH 1/4] Remove fabric legacy CLI --- src/lightning/__setup__.py | 1 - src/lightning/fabric/cli.py | 19 ------------------- 2 files changed, 20 deletions(-) diff --git a/src/lightning/__setup__.py b/src/lightning/__setup__.py index 2d3bb0e7d1f33..71c24aefd39d8 100644 --- a/src/lightning/__setup__.py +++ b/src/lightning/__setup__.py @@ -98,7 +98,6 @@ def _setup_args() -> dict[str, Any]: "entry_points": { "console_scripts": [ "fabric = lightning.fabric.cli:_main", - "lightning = lightning.fabric.cli:_legacy_main", ], }, "setup_requires": [], diff --git a/src/lightning/fabric/cli.py b/src/lightning/fabric/cli.py index 5f18884e83d79..3b015b866b2d0 100644 --- a/src/lightning/fabric/cli.py +++ b/src/lightning/fabric/cli.py @@ -50,25 +50,6 @@ def _get_supported_strategies() -> list[str]: if _CLICK_AVAILABLE: import click - def _legacy_main() -> None: - """Legacy CLI handler for fabric. - - Raises deprecation warning and runs through fabric cli if necessary, else runs the entrypoint directly - - """ - hparams = sys.argv[1:] - if len(hparams) >= 2 and hparams[0] == "run" and hparams[1] == "model": - print( - "`lightning run model` is deprecated and will be removed in future versions." - " Please call `fabric run` instead." - ) - _main() - return - - if _LIGHTNING_SDK_AVAILABLE: - subprocess.run([sys.executable, "-m", "lightning_sdk.cli.entrypoint"] + hparams) - return - @click.group() def _main() -> None: pass From 2a6f6cc49e3362ad61c1cc22ca404b1af5d3962c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 13 Feb 2025 22:20:49 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/lightning/fabric/cli.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lightning/fabric/cli.py b/src/lightning/fabric/cli.py index 3b015b866b2d0..2268614abb97b 100644 --- a/src/lightning/fabric/cli.py +++ b/src/lightning/fabric/cli.py @@ -14,8 +14,6 @@ import logging import os import re -import subprocess -import sys from argparse import Namespace from typing import Any, Optional From 107acd466c22e0be2d06925e360c11c17a375015 Mon Sep 17 00:00:00 2001 From: Justus Schock <12886177+justusschock@users.noreply.github.com> Date: Thu, 13 Feb 2025 23:27:36 +0100 Subject: [PATCH 3/4] changelog --- src/lightning/fabric/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lightning/fabric/CHANGELOG.md b/src/lightning/fabric/CHANGELOG.md index 7e401aff67671..c8e87416b1bc7 100644 --- a/src/lightning/fabric/CHANGELOG.md +++ b/src/lightning/fabric/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). +## [unreleased] - YYYY-MM-DD + +### Removed + +Removed legacy supoport for `lightning run model`. Use `fabric run` instead. ([#20588](https://github.com/Lightning-AI/pytorch-lightning/pull/20588)) + ## [2.5.0] - 2024-12-19 ### Added From 6bff2a86da2e5d1f37180377337a003b29e08e45 Mon Sep 17 00:00:00 2001 From: Justus Schock <12886177+justusschock@users.noreply.github.com> Date: Thu, 13 Feb 2025 23:34:33 +0100 Subject: [PATCH 4/4] remove test --- tests/tests_fabric/test_cli.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tests/tests_fabric/test_cli.py b/tests/tests_fabric/test_cli.py index ec3160111e6ee..944584114184b 100644 --- a/tests/tests_fabric/test_cli.py +++ b/tests/tests_fabric/test_cli.py @@ -179,18 +179,6 @@ def test_run_through_fabric_entry_point(): assert message in result.stdout or message in result.stderr -@pytest.mark.skipif("lightning.fabric" == "lightning_fabric", reason="standalone package") -def test_run_through_lightning_entry_point(): - result = subprocess.run("lightning run model --help", capture_output=True, text=True, shell=True) - - deprecation_message = ( - "`lightning run model` is deprecated and will be removed in future versions. Please call `fabric run` instead" - ) - message = "Usage: lightning run [OPTIONS] SCRIPT [SCRIPT_ARGS]" - assert deprecation_message in result.stdout - assert message in result.stdout or message in result.stderr - - @mock.patch("lightning.fabric.cli._process_cli_args") @mock.patch("lightning.fabric.cli._load_distributed_checkpoint") @mock.patch("lightning.fabric.cli.torch.save")