From 974678007f9939dae8a6368a31c9064de16ca0aa Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Thu, 21 Mar 2024 13:33:46 +0800 Subject: [PATCH] removal: remove deprecated pdm.models.environment (#2710) * removal: remove deprecated pdm.models.environment Signed-off-by: Frost Ming * add news Signed-off-by: Frost Ming --- news/2710.removal.md | 1 + src/pdm/environments/__init__.py | 15 --------------- src/pdm/models/environment.py | 12 ------------ 3 files changed, 1 insertion(+), 27 deletions(-) create mode 100644 news/2710.removal.md delete mode 100644 src/pdm/models/environment.py diff --git a/news/2710.removal.md b/news/2710.removal.md new file mode 100644 index 0000000000..c989db1cab --- /dev/null +++ b/news/2710.removal.md @@ -0,0 +1 @@ +Remove `pdm.models.environment` module deprecated before. Also remove the renamed members from `pdm.environments`. diff --git a/src/pdm/environments/__init__.py b/src/pdm/environments/__init__.py index 592faa5987..34351bb526 100644 --- a/src/pdm/environments/__init__.py +++ b/src/pdm/environments/__init__.py @@ -1,20 +1,6 @@ -from typing import Any - from pdm.environments.base import BareEnvironment, BaseEnvironment from pdm.environments.local import PythonLocalEnvironment from pdm.environments.python import PythonEnvironment -from pdm.utils import deprecation_warning - -_deprecated = {"Environment": PythonLocalEnvironment, "GlobalEnvironment": PythonEnvironment} - - -def __getattr__(name: str) -> Any: - if name in _deprecated: - real = _deprecated[name] - deprecation_warning(f"{name} is deprecated, please use {real.__name__} instead", stacklevel=2) - return real - raise AttributeError(f"module {__name__!r} has no attribute {name!r}") - __all__ = [ "BaseEnvironment", @@ -22,4 +8,3 @@ def __getattr__(name: str) -> Any: "PythonEnvironment", "PythonLocalEnvironment", ] -__all__.extend(_deprecated) diff --git a/src/pdm/models/environment.py b/src/pdm/models/environment.py deleted file mode 100644 index e44a85cc85..0000000000 --- a/src/pdm/models/environment.py +++ /dev/null @@ -1,12 +0,0 @@ -import sys - -from pdm import environments -from pdm.utils import deprecation_warning - -deprecation_warning( - "pdm.models.environment is deprecated, please use pdm.environments instead. " - "This module will be removed in the future.", - stacklevel=1, -) - -sys.modules[__name__] = environments