commit:     e2e53ce3a0fca9c2cfd679082acb46f30829b26b
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Sun Dec 14 11:03:58 2025 +0000
Commit:     Brian Harring <ferringb <AT> gmail <DOT> com>
CommitDate: Mon Dec 15 12:42:09 2025 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/snakeoil.git/commit/?id=e2e53ce3

chore: fix deprecation markers so they're usable for news, tighten versions.

The large bulk of chunks of this are things that must be resolved in
pkgcore- including optionally transferring it into pkgcore itself so it's
an internal, and can be iterated on faster w/in that.

Effectively lock most of these removes to 0.12.0.  Last released is 0.12.x,
and these changes will go out in 0.11.0 which isn't a semver break,
but large enough changes that it'll be bumped.

Signed-off-by: Brian Harring <ferringb <AT> gmail.com>

 src/snakeoil/bash.py                     |  4 +++-
 src/snakeoil/contexts.py                 |  2 +-
 src/snakeoil/demandload.py               |  2 +-
 src/snakeoil/deprecation/__init__.py     | 19 ++++++++++++++-----
 src/snakeoil/deprecation/__main__.py     |  2 +-
 src/snakeoil/klass/__init__.py           |  6 +++---
 src/snakeoil/klass/_deprecated.py        | 19 ++++++++++++++-----
 src/snakeoil/modules.py                  |  8 ++++----
 src/snakeoil/osutils/__init__.py         | 25 ++++++++++++++++---------
 src/snakeoil/sequences.py                | 10 +++++-----
 src/snakeoil/test/eq_hash_inheritance.py |  2 +-
 src/snakeoil/test/mixins.py              |  2 +-
 src/snakeoil/test/modules.py             |  2 +-
 13 files changed, 65 insertions(+), 38 deletions(-)

diff --git a/src/snakeoil/bash.py b/src/snakeoil/bash.py
index a39fd9c..9c6f289 100644
--- a/src/snakeoil/bash.py
+++ b/src/snakeoil/bash.py
@@ -33,7 +33,9 @@ __all__ = (
 
 
 iter_read_bash = deprecated(
-    "snakeoil.bash.iter_read_bash has been renamed to read_bash", 
removal_in=(0, 12, 0)
+    "This has been renamed to read_bash",
+    removal_in=(0, 12, 0),
+    qualname="snakeoil.bash.iter_read_bash",
 )(lambda *a, **kw: read_bash(*a, **kw))
 
 

diff --git a/src/snakeoil/contexts.py b/src/snakeoil/contexts.py
index 8b348b9..b6d2231 100644
--- a/src/snakeoil/contexts.py
+++ b/src/snakeoil/contexts.py
@@ -361,7 +361,7 @@ class GitStash(AbstractContextManager):
 
 
 @deprecated(
-    "snakeoil.contexts.chdir is deprecated.  Use contextlib.chdir instead",
+    "Use contextlib.chdir instead",
     removal_in=(0, 12, 0),
 )
 def chdir(path: str) -> contextlib.chdir:

diff --git a/src/snakeoil/demandload.py b/src/snakeoil/demandload.py
index b232e3f..dce673e 100644
--- a/src/snakeoil/demandload.py
+++ b/src/snakeoil/demandload.py
@@ -9,7 +9,7 @@ from .delayed import regexp
 
 
 @deprecated(
-    "snakeoil.klass.demand_compile_regexp has moved to 
snakeoil.delayed.regexp",
+    "Use snakeoil.delayed.regexp which no longer relies on scope trickery",
     removal_in=(0, 12, 0),
 )
 def demand_compile_regexp(

diff --git a/src/snakeoil/deprecation/__init__.py 
b/src/snakeoil/deprecation/__init__.py
index 443aab1..dc985f6 100644
--- a/src/snakeoil/deprecation/__init__.py
+++ b/src/snakeoil/deprecation/__init__.py
@@ -152,16 +152,20 @@ class Record:
     removal_in_python: Version | None = None
 
     def _collect_strings(self) -> typing.Iterator[str]:
+        yield self.msg
         if self.removal_in:
             yield "removal in version=" + (".".join(map(str, self.removal_in)))
         if self.removal_in_python:
             yield "removal in python=" + (".".join(map(str, 
self.removal_in_python)))
-        yield f"reason: {self.msg}"
 
     def __str__(self) -> str:
         return ", ".join(self._collect_strings())
 
 
+class RecordNote(Record):
+    __slots__ = ()
+
+
 @dataclasses.dataclass(slots=True, frozen=True, kw_only=True)
 class RecordCallable(Record):
     qualname: str
@@ -172,10 +176,10 @@ class RecordCallable(Record):
             raise ValueError(
                 f"functor {thing!r} has .locals() in it; you need to provide 
the actual qualname"
             )
-        return cls(*args, qualname=thing.__qualname__, **kwargs)
+        return cls(*args, qualname=f"{thing.__module__}.{thing.__qualname__}", 
**kwargs)
 
     def _collect_strings(self) -> typing.Iterator[str]:
-        yield f"qualname={self.qualname!r}"
+        yield self.qualname
         yield from super(RecordCallable, self)._collect_strings()
 
 
@@ -184,7 +188,7 @@ class RecordModule(Record):
     qualname: str
 
     def _collect_strings(self) -> typing.Iterator[str]:
-        yield f"module={self.qualname!r}"
+        yield self.qualname
         yield from super(RecordModule, self)._collect_strings()
 
 
@@ -302,7 +306,9 @@ class Registry:
             raise ValueError("either removal_in or removal_in_python must be 
set")
         """Add a directive in the code that if invoked, records the 
deprecation"""
         self._deprecations.append(
-            Record(msg=msg, removal_in=removal_in, 
removal_in_python=removal_in_python)
+            RecordNote(
+                msg=msg, removal_in=removal_in, 
removal_in_python=removal_in_python
+            )
         )
 
     def module(
@@ -347,6 +353,7 @@ class Registry:
         force_load=True,
         project_version: Version | None = None,
         python_version: Version | None = None,
+        with_notes=True,
     ) -> typing.Iterator[Record]:
         """Enumerate the deprecations that exceed the minimum versions
 
@@ -363,6 +370,8 @@ class Registry:
             ):
                 pass
         for deprecation in self:
+            if not with_notes and isinstance(deprecation, RecordNote):
+                continue
             if (
                 deprecation.removal_in is not None
                 and project_version >= deprecation.removal_in

diff --git a/src/snakeoil/deprecation/__main__.py 
b/src/snakeoil/deprecation/__main__.py
index 057b1f2..e9f0b8e 100644
--- a/src/snakeoil/deprecation/__main__.py
+++ b/src/snakeoil/deprecation/__main__.py
@@ -29,7 +29,7 @@ def main(options, out, _err) -> int:
     registry = typing.cast(Registry, options.registry)
     for deprecation in sorted(
         registry.expired_deprecations(
-            python_version=(1000, 0, 0), project_version=(1000, 0, 0)
+            python_version=(1000, 0, 0), project_version=(1000, 0, 0), 
with_notes=False
         ),
         key=lambda x: str(x),
     ):

diff --git a/src/snakeoil/klass/__init__.py b/src/snakeoil/klass/__init__.py
index 6a2ce99..f2e9db8 100644
--- a/src/snakeoil/klass/__init__.py
+++ b/src/snakeoil/klass/__init__.py
@@ -296,7 +296,7 @@ class GenericRichComparison(GenericEquality):
 
 
 @deprecated(
-    "generic_equality metaclass usage is deprecated; inherit from 
snakeoil.klass.GenericEquality instead.",
+    "inherit from snakeoil.klass.GenericEquality instead",
     removal_in=(0, 12, 0),
 )
 def generic_equality(
@@ -346,7 +346,7 @@ def generic_equality(
 
 
 @deprecated(
-    "snakeoil.klass.chained_getter is deprecated.  Use operator.attrgetter 
instead.",
+    "Use operator.attrgetter instead",
     removal_in=(0, 12, 0),
 )
 class chained_getter(
@@ -382,7 +382,7 @@ class chained_getter(
 
 static_attrgetter = deprecated(
     "snakeoil.klass.static_attrgetter is deprecated.  Use operator.attrgetter 
instead",
-    removal_in=(0, 13, 0),
+    removal_in=(0, 12, 0),
 )(chained_getter)
 
 

diff --git a/src/snakeoil/klass/_deprecated.py 
b/src/snakeoil/klass/_deprecated.py
index db68885..3e7f2a9 100644
--- a/src/snakeoil/klass/_deprecated.py
+++ b/src/snakeoil/klass/_deprecated.py
@@ -8,7 +8,10 @@ import typing
 from snakeoil._internals import deprecated
 
 
-@deprecated("Use snakeoil.klass.meta.Immutable* metaclasses instead")
+@deprecated(
+    "Use snakeoil.klass.meta.Immutable* metaclasses instead",
+    qualname="snakeoil.klass.immutable_instance",
+)
 def immutable_instance(
     name: str, bases: tuple[type], scope: dict[str, typing.Any], real_type=type
 ) -> type:
@@ -23,7 +26,9 @@ def immutable_instance(
 
 
 @deprecated(
-    "Use snakeoil.klass.meta.Immutable* metaclasses instead", removal_in=(0, 
12, 0)
+    "Use snakeoil.klass.meta.Immutable* metaclasses instead",
+    removal_in=(0, 12, 0),
+    qualname="snakeoil.klass.ImmutableInstance*",
 )
 class ImmutableInstance:
     """Class that disables surface-level attribute modifications."""
@@ -44,7 +49,9 @@ class ImmutableInstance:
 
 
 @deprecated(
-    "Use snakeoil.klass.meta.Immutable* metaclasses instead", removal_in=(0, 
12, 0)
+    "Use snakeoil.klass.meta.Immutable* metaclasses instead",
+    removal_in=(0, 12, 0),
+    qualname="snakeoil.klass.inject_immutable_instance",
 )
 def inject_immutable_instance(scope: dict[str, typing.Any]):
     """inject immutable __setattr__ and __delattr__ implementations
@@ -89,8 +96,9 @@ def __generic_gt(self, other):
 
 
 @deprecated(
-    "inject_richcmp_methods_from_cmp is deprecated, migrate to 
functools.total_ordering instead.",
+    "Use functools.total_ordering instead",
     removal_in=(0, 12, 0),
+    qualname="snakeoil.klass.inject_richcmp_methods_from_cmp",
 )
 def inject_richcmp_methods_from_cmp(scope):
     """
@@ -143,8 +151,9 @@ def inject_richcmp_methods_from_cmp(scope):
 
 
 @deprecated(
-    "snakeoil.klass.steal_docs is deprecated; use functools.wraps",
+    "Use functools.wraps",
     removal_in=(0, 12, 0),
+    qualname="snakeoil.klass.steal_docs",
 )
 def steal_docs(target, ignore_missing=False, name=None):
     """

diff --git a/src/snakeoil/modules.py b/src/snakeoil/modules.py
index 32076c2..db39c21 100644
--- a/src/snakeoil/modules.py
+++ b/src/snakeoil/modules.py
@@ -20,8 +20,8 @@ class FailedImport(ImportError):
 
 
 @deprecated(
-    "snakeoil.modules.load_attribute is deprecated.  Use 
importlib.import_module's package argument",
-    removal_in=(0, 13, 0),
+    "Use importlib.import_module's package argument",
+    removal_in=(0, 12, 0),
 )
 def load_attribute(name):
     """load an attribute from a module
@@ -47,8 +47,8 @@ def load_attribute(name):
 
 
 @deprecated(
-    "snakeoil.modules.load_any is deprecated.  Use importlib.import_module's 
package argument",
-    removal_in=(0, 13, 0),
+    "Use importlib.import_module's package argument",
+    removal_in=(0, 12, 0),
 )
 def load_any(name):
     """

diff --git a/src/snakeoil/osutils/__init__.py b/src/snakeoil/osutils/__init__.py
index 646d5dc..fc1399a 100644
--- a/src/snakeoil/osutils/__init__.py
+++ b/src/snakeoil/osutils/__init__.py
@@ -28,7 +28,9 @@ from stat import (
 from snakeoil._internals import deprecated
 
 listdir = deprecated(
-    "snakeoil.osutils.listdir is deprecated.  Use os.listdir", removal_in=(0, 
12, 0)
+    "snakeoil.osutils.listdir is deprecated.  Use os.listdir",
+    removal_in=(0, 12, 0),
+    qualname="snakeoil.osutils.listdir",
 )(lambda *a, **kw: os.listdir(*a, **kw))
 
 
@@ -176,7 +178,10 @@ def ensure_dirs(path, gid=-1, uid=-1, mode=0o777, 
minimal=True):
     return True
 
 
-@deprecated("snakeoil.osutils.absyymlink is deprecated", removal_in=(1, 0, 0))
+@deprecated(
+    "Use os.path.* functions instead.  Be mindful that this protected against 
//, which os.path.* doesn't, but pathlib should.",
+    removal_in=(0, 12, 0),
+)
 def abssymlink(path):
     """Return the absolute path of a symlink
 
@@ -208,9 +213,7 @@ def force_symlink(target, link):
             raise
 
 
-@deprecated(
-    "snakeoil.osutils.abspath is deprecated.  Us os.path.abspath", 
removal_in=(1, 0, 0)
-)
+@deprecated("Use os.path.abspath", removal_in=(0, 12, 0))
 def abspath(path):
     """resolve a path absolutely, including symlink resolving.
 
@@ -232,8 +235,8 @@ def abspath(path):
 
 
 @deprecated(
-    "snakeoil.osutils.normpath is deprecated.  Us os.path.normpath",
-    removal_in=(1, 0, 0),
+    "Use os.path.normpath or pathlib.  Be aware that os.path doesn't strip 
prefix // into /",
+    removal_in=(0, 12, 0),
 )
 def normpath(mypath: str) -> str:
     """normalize path- //usr/bin becomes /usr/bin, /usr/../bin becomes /bin
@@ -250,10 +253,14 @@ def normpath(mypath: str) -> str:
 
 # convenience.  importing join into a namespace is ugly, pjoin less so
 pjoin = deprecated(
-    "snakeoil.osutils.pjoin is deprecated.  Use os.path.join", removal_in=(0, 
13, 0)
+    "Use os.path.join",
+    removal_in=(0, 12, 0),
+    qualname="snakeoil.osutils.pjoin",
 )(lambda *a, **kw: os.path.join(*a, **kw))
 join = deprecated(
-    "snakeoil.osutils.join is deprecated.  Use os.path.join", removal_in=(0, 
13, 0)
+    "Use os.path.join",
+    removal_in=(0, 12, 0),
+    qualname="snakeoil.osutils.join",
 )(lambda *a, **kw: os.path.join(*a, **kw))
 
 

diff --git a/src/snakeoil/sequences.py b/src/snakeoil/sequences.py
index 5355f09..d4998d3 100644
--- a/src/snakeoil/sequences.py
+++ b/src/snakeoil/sequences.py
@@ -33,8 +33,8 @@ H = TypeVar("H", bound=Hashable)
 
 
 @deprecated(
-    """snakeoil.klass.unstable_unique is deprecated.  Use set() instead, it 
will have superior performance characteristics albeit will allocate more than 
this implementationd which sorted the sequence""",
-    removal_in=(1, 0, 0),
+    """Use set() instead, it will have superior performance characteristics 
albeit will allocate more than this implementationd which sorted the 
sequence""",
+    removal_in=(0, 12, 0),
 )
 def unstable_unique(sequence):
     """Given a sequence, return a list of the unique items without preserving 
ordering."""
@@ -76,7 +76,7 @@ def unstable_unique(sequence):
 
 
 @deprecated(
-    "snakeoil.sequence.stable_unique is deprecated.  Use 
snakeoil.sequence.unique_stable but be aware it now requires all items be 
hashable",
+    "Use snakeoil.sequence.unique_stable but be aware it now requires all 
items be hashable",
     removal_in=(0, 13, 0),
 )
 def stable_unique(iterable: Iterable[T]) -> list[T]:
@@ -90,8 +90,8 @@ def stable_unique(iterable: Iterable[T]) -> list[T]:
 
 
 @deprecated(
-    "snakeoil.sequence.iter_stable_unique is deprecated.  Use 
snakeoil.sequence.unique_stable but be aware it now requires all items be 
hashable",
-    removal_in=(0, 12, 0),
+    "Use snakeoil.sequence.unique_stable but be aware it now requires all 
items be hashable",
+    removal_in=(0, 13, 0),
 )
 def iter_stable_unique(iterable: Iterable[T]) -> Iterator[T]:
     """Given a sequence, yield unique items while preserving ordering.

diff --git a/src/snakeoil/test/eq_hash_inheritance.py 
b/src/snakeoil/test/eq_hash_inheritance.py
index 5f8cc24..5b33eb5 100644
--- a/src/snakeoil/test/eq_hash_inheritance.py
+++ b/src/snakeoil/test/eq_hash_inheritance.py
@@ -4,7 +4,7 @@ from snakeoil._internals import deprecated
 
 
 @deprecated(
-    "snakeoil.test.eq_hash_inheritance.Test is a noop.  Remove it from your 
tests",
+    "This was broken thus disabled long ago.  It's a noop, remove it from your 
tests",
     removal_in=(0, 12, 0),
 )
 class Test:

diff --git a/src/snakeoil/test/mixins.py b/src/snakeoil/test/mixins.py
index 495b485..ad444c2 100644
--- a/src/snakeoil/test/mixins.py
+++ b/src/snakeoil/test/mixins.py
@@ -8,7 +8,7 @@ from snakeoil.compatibility import IGNORED_EXCEPTIONS
 
 
 @deprecated(
-    "snakeoil.test.mixins.PythonNamespaceWalker is deprecated, instead use 
snakeoil.python_namespaces.submodules_of",
+    "Use snakeoil.python_namespaces.submodules_of, or derive from 
snakeoil.code_quality.NamespaceWalker for tests",
     removal_in=(0, 12, 0),
 )
 class PythonNamespaceWalker:

diff --git a/src/snakeoil/test/modules.py b/src/snakeoil/test/modules.py
index 902aa61..2b2923c 100644
--- a/src/snakeoil/test/modules.py
+++ b/src/snakeoil/test/modules.py
@@ -3,7 +3,7 @@ from snakeoil._internals import deprecated
 
 
 @deprecated(
-    "ExportedModules does nothing.  Use snakeoil.test.code_quality.Modules",
+    "This was broken and accidentally disabled long ago, and is a no-op.  Use 
snakeoil.test.code_quality.Modules",
     removal_in=(0, 12, 0),
 )
 class ExportedModules:

Reply via email to