diff --git a/pyproject.toml b/pyproject.toml index 3fbc7f0a4c9d9..898699875e873 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ warn_no_return = "False" # TODO: the goal is for this to be empty [[tool.mypy.overrides]] # the list can be generated with: -# mypy | tr ':' ' ' | awk '{print $1}' | sort | uniq | sed 's/\.py//g' | sed 's|\/|\.|g' | xargs -I {} echo '"{}",' +# mypy --no-error-summary 2>&1 | tr ':' ' ' | awk '{print $1}' | sort | uniq | sed 's/\.py//g; s|src/||g; s|\/|\.|g' | xargs -I {} echo '"{}",' module = [ "pytorch_lightning.callbacks.model_checkpoint", "pytorch_lightning.callbacks.progress.rich_progress", @@ -53,18 +53,21 @@ module = [ "pytorch_lightning.callbacks.stochastic_weight_avg", "pytorch_lightning.core.datamodule", "pytorch_lightning.core.decorators", - "pytorch_lightning.core.module", "pytorch_lightning.core.mixins.device_dtype_mixin", + "pytorch_lightning.core.module", "pytorch_lightning.core.saving", "pytorch_lightning.demos.boring_classes", "pytorch_lightning.demos.mnist_datamodule", - "pytorch_lightning.distributed.dist", "pytorch_lightning.loggers.comet", "pytorch_lightning.loggers.mlflow", "pytorch_lightning.loggers.neptune", "pytorch_lightning.loggers.tensorboard", "pytorch_lightning.loggers.wandb", "pytorch_lightning.loops.epoch.training_epoch_loop", + "pytorch_lightning.profilers.advanced", + "pytorch_lightning.profilers.base", + "pytorch_lightning.profilers.pytorch", + "pytorch_lightning.profilers.simple", "pytorch_lightning.strategies.ddp", "pytorch_lightning.strategies.ddp_spawn", "pytorch_lightning.strategies.deepspeed", @@ -74,16 +77,11 @@ module = [ "pytorch_lightning.strategies.parallel", "pytorch_lightning.strategies.sharded", "pytorch_lightning.strategies.sharded_spawn", - "pytorch_lightning.strategies.tpu_spawn", "pytorch_lightning.strategies.strategy", - "pytorch_lightning.profilers.advanced", - "pytorch_lightning.profilers.base", - "pytorch_lightning.profilers.pytorch", - "pytorch_lightning.profilers.simple", + "pytorch_lightning.strategies.tpu_spawn", "pytorch_lightning.trainer.callback_hook", "pytorch_lightning.trainer.connectors.callback_connector", "pytorch_lightning.trainer.connectors.data_connector", - "pytorch_lightning.trainer.data_loading", "pytorch_lightning.trainer.supporters", "pytorch_lightning.trainer.trainer", "pytorch_lightning.tuner.batch_size_scaling", diff --git a/src/pytorch_lightning/CHANGELOG.md b/src/pytorch_lightning/CHANGELOG.md index e5081e49935cf..fabbd082f0919 100644 --- a/src/pytorch_lightning/CHANGELOG.md +++ b/src/pytorch_lightning/CHANGELOG.md @@ -281,6 +281,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Removed support for the `DDP2Strategy` ([#12705](https://github.com/PyTorchLightning/pytorch-lightning/pull/12705)) +- Removed deprecated `LightningDistributed` ([#13549](https://github.com/PyTorchLightning/pytorch-lightning/pull/13549)) + + - Removed deprecated ClusterEnvironment properties `master_address` and `master_port` in favor of `main_address` and `main_port` ([#13458](https://github.com/PyTorchLightning/pytorch-lightning/pull/13458)) diff --git a/src/pytorch_lightning/distributed/__init__.py b/src/pytorch_lightning/distributed/__init__.py deleted file mode 100644 index ea060e551ad9d..0000000000000 --- a/src/pytorch_lightning/distributed/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright The PyTorch Lightning team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -from pytorch_lightning.distributed.dist import LightningDistributed # noqa: F401 diff --git a/src/pytorch_lightning/distributed/dist.py b/src/pytorch_lightning/distributed/dist.py deleted file mode 100644 index 1799450e3ce05..0000000000000 --- a/src/pytorch_lightning/distributed/dist.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright The PyTorch Lightning team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -from typing import Any - -import torch.distributed - -from pytorch_lightning.utilities import rank_zero_deprecation -from pytorch_lightning.utilities.distributed import group as _group - - -class LightningDistributed: - """ - .. deprecated:: v1.5 - This class is deprecated in v1.5 and will be removed in v1.7. - The broadcast logic will be moved to the :class:`DDPStrategy` and :class`DDPSpawnStrategy` classes. - - """ - - def __init__(self, rank=None, device=None): - rank_zero_deprecation( - "LightningDistributed is deprecated in v1.5 and will be removed in v1.7." - "Broadcast logic is implemented directly in the :class:`Strategy` implementations." - ) - self.rank = rank - self.device = device - - def broadcast(self, obj: Any, group=_group.WORLD): - # always wrap into a list so it can be broadcasted. - obj = [obj] - - if self.rank != 0: - obj = [None] * len(obj) - - torch.distributed.broadcast_object_list(obj, 0, group=group or _group.WORLD) - - return obj[0] diff --git a/tests/tests_pytorch/deprecated_api/test_remove_1-7.py b/tests/tests_pytorch/deprecated_api/test_remove_1-7.py index 2af4e4c8e26e9..8ab04076f8d26 100644 --- a/tests/tests_pytorch/deprecated_api/test_remove_1-7.py +++ b/tests/tests_pytorch/deprecated_api/test_remove_1-7.py @@ -21,13 +21,6 @@ from pytorch_lightning.strategies import SingleDeviceStrategy -def test_v1_7_0_deprecate_lightning_distributed(tmpdir): - with pytest.deprecated_call(match="LightningDistributed is deprecated in v1.5 and will be removed in v1.7."): - from pytorch_lightning.distributed.dist import LightningDistributed - - _ = LightningDistributed() - - def test_v1_7_0_deprecated_max_steps_none(tmpdir): with pytest.deprecated_call(match="`max_steps = None` is deprecated in v1.5"): _ = Trainer(max_steps=None)