From 0a5d4414f597abb45a81919ca1439154d4ea27ee Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Fri, 21 Nov 2025 16:56:10 -0500 Subject: [PATCH 1/5] add deprecator --- src/diffpy/structure/__init__.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/diffpy/structure/__init__.py b/src/diffpy/structure/__init__.py index e66c0879..4b531e89 100644 --- a/src/diffpy/structure/__init__.py +++ b/src/diffpy/structure/__init__.py @@ -33,8 +33,10 @@ * SymmetryError """ -# Interface definitions ------------------------------------------------------ +import sys + +import diffpy.structure as _structure from diffpy.structure.atom import Atom from diffpy.structure.lattice import Lattice from diffpy.structure.parsers import getParser @@ -45,6 +47,28 @@ # package version from diffpy.structure.version import __version__ +# Deprecations ------------------------------------------------------- +# Only use the backport for module shims + + +# @deprecated +# custom deprecator for diffpy.Structure module +class DeprecatedStructureModule: + """Proxy for backward compatibility of diffpy.Structure.""" + + def __getattr__(self, name): + import warnings + + warnings.warn( + "Module 'diffpy.Structure' is deprecated. Use 'diffpy.structure' instead.", + DeprecationWarning, + stacklevel=2, + ) + return getattr(_structure, name) + + +sys.modules["diffpy.Structure"] = DeprecatedStructureModule() + # top level routines From 275990058abfc1d914e0c40d11014da662ffb272 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Fri, 21 Nov 2025 16:56:53 -0500 Subject: [PATCH 2/5] news --- news/dep-warning1.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/dep-warning1.rst diff --git a/news/dep-warning1.rst b/news/dep-warning1.rst new file mode 100644 index 00000000..bd4b2fbd --- /dev/null +++ b/news/dep-warning1.rst @@ -0,0 +1,23 @@ +**Added:** + +* Add deprecation warning for ``diffpy.Structure`` import. + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* From 73a6b13a856d8140eb6cee315674fb3a09b2ac53 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Fri, 21 Nov 2025 16:58:46 -0500 Subject: [PATCH 3/5] rm comment --- src/diffpy/structure/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/diffpy/structure/__init__.py b/src/diffpy/structure/__init__.py index 4b531e89..3ab52b61 100644 --- a/src/diffpy/structure/__init__.py +++ b/src/diffpy/structure/__init__.py @@ -48,7 +48,6 @@ from diffpy.structure.version import __version__ # Deprecations ------------------------------------------------------- -# Only use the backport for module shims # @deprecated From 5841feb7e4502638bd85e7be1ca3bc40b8b05859 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Mon, 24 Nov 2025 09:56:08 -0500 Subject: [PATCH 4/5] update wording --- src/diffpy/structure/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/diffpy/structure/__init__.py b/src/diffpy/structure/__init__.py index 3ab52b61..263ef216 100644 --- a/src/diffpy/structure/__init__.py +++ b/src/diffpy/structure/__init__.py @@ -59,7 +59,8 @@ def __getattr__(self, name): import warnings warnings.warn( - "Module 'diffpy.Structure' is deprecated. Use 'diffpy.structure' instead.", + "Module 'diffpy.Structure' is deprecated and will be removed in version 3.8. " + "Use 'diffpy.structure' instead.", DeprecationWarning, stacklevel=2, ) From 3c462a7b2414ebe2abe0022811d04bb62b87559d Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Tue, 25 Nov 2025 15:29:41 -0500 Subject: [PATCH 5/5] Update deprecation warning for diffpy.Structure module --- src/diffpy/structure/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diffpy/structure/__init__.py b/src/diffpy/structure/__init__.py index 263ef216..62778b45 100644 --- a/src/diffpy/structure/__init__.py +++ b/src/diffpy/structure/__init__.py @@ -59,7 +59,7 @@ def __getattr__(self, name): import warnings warnings.warn( - "Module 'diffpy.Structure' is deprecated and will be removed in version 3.8. " + "Module 'diffpy.Structure' is deprecated and will be removed in version 4.0. " "Use 'diffpy.structure' instead.", DeprecationWarning, stacklevel=2,