Skip to content

Commit f7a01e9

Browse files
justusschockBorda
authored andcommitted
Remove fabric legacy CLI (#20588)
(cherry picked from commit 9afcc58)
1 parent 145d04c commit f7a01e9

File tree

4 files changed

+6
-34
lines changed

4 files changed

+6
-34
lines changed

src/lightning/__setup__.py

-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ def _setup_args() -> dict[str, Any]:
9898
"entry_points": {
9999
"console_scripts": [
100100
"fabric = lightning.fabric.cli:_main",
101-
"lightning = lightning.fabric.cli:_legacy_main",
102101
],
103102
},
104103
"setup_requires": [],

src/lightning/fabric/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
66

7+
## [unreleased] - YYYY-MM-DD
8+
9+
### Removed
10+
11+
Removed legacy supoport for `lightning run model`. Use `fabric run` instead. ([#20588](https://github.com/Lightning-AI/pytorch-lightning/pull/20588))
12+
713
## [2.5.0] - 2024-12-19
814

915
### Added

src/lightning/fabric/cli.py

-21
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
import logging
1515
import os
1616
import re
17-
import subprocess
18-
import sys
1917
from argparse import Namespace
2018
from typing import Any, Optional
2119

@@ -50,25 +48,6 @@ def _get_supported_strategies() -> list[str]:
5048
if _CLICK_AVAILABLE:
5149
import click
5250

53-
def _legacy_main() -> None:
54-
"""Legacy CLI handler for fabric.
55-
56-
Raises deprecation warning and runs through fabric cli if necessary, else runs the entrypoint directly
57-
58-
"""
59-
hparams = sys.argv[1:]
60-
if len(hparams) >= 2 and hparams[0] == "run" and hparams[1] == "model":
61-
print(
62-
"`lightning run model` is deprecated and will be removed in future versions."
63-
" Please call `fabric run` instead."
64-
)
65-
_main()
66-
return
67-
68-
if _LIGHTNING_SDK_AVAILABLE:
69-
subprocess.run([sys.executable, "-m", "lightning_sdk.cli.entrypoint"] + hparams)
70-
return
71-
7251
@click.group()
7352
def _main() -> None:
7453
pass

tests/tests_fabric/test_cli.py

-12
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,6 @@ def test_run_through_fabric_entry_point():
179179
assert message in result.stdout or message in result.stderr
180180

181181

182-
@pytest.mark.skipif("lightning.fabric" == "lightning_fabric", reason="standalone package")
183-
def test_run_through_lightning_entry_point():
184-
result = subprocess.run("lightning run model --help", capture_output=True, text=True, shell=True)
185-
186-
deprecation_message = (
187-
"`lightning run model` is deprecated and will be removed in future versions. Please call `fabric run` instead"
188-
)
189-
message = "Usage: lightning run [OPTIONS] SCRIPT [SCRIPT_ARGS]"
190-
assert deprecation_message in result.stdout
191-
assert message in result.stdout or message in result.stderr
192-
193-
194182
@mock.patch("lightning.fabric.cli._process_cli_args")
195183
@mock.patch("lightning.fabric.cli._load_distributed_checkpoint")
196184
@mock.patch("lightning.fabric.cli.torch.save")

0 commit comments

Comments
 (0)