Skip to content

Commit

Permalink
Improve deprecation documentation (#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
FasterSpeeding committed May 12, 2024
1 parent 6d85432 commit 2fdb1c4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
8 changes: 6 additions & 2 deletions alluka/_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,15 @@ def set_type_dependency(self, type_: type[_T], value: _T, /) -> Self:
return self


@typing_extensions.deprecated("Use CachingContext")
@typing_extensions.deprecated("Use Context or CachingContext")
class BasicContext(CachingContext):
"""Deprecated alias of [alluka.CachingContext][].
[alluka.OverridingContext][] replaces the undocumented type special casing.
!!! warning "deprecated"
This is deprecated as of `v0.3.0`.
use [alluka.Context][] or [alluka.CachingContext][].
[alluka.OverridingContext][] should be used as a replacement for the
undocumented type special casing.
"""

__slots__ = ("_special_case_types",)
Expand Down
8 changes: 6 additions & 2 deletions alluka/_self_injecting.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
class AsyncSelfInjecting(alluka.AsyncSelfInjecting[_CallbackSigT]):
"""Deprecated class for marking async functions as self-injecting.
Use [Client.auto_inject_async][alluka.abc.Client.auto_inject_async].
!!! warning "deprecated"
This is deprecated as of `v0.2.0`,
Use [Client.auto_inject_async][alluka.abc.Client.auto_inject_async].
"""

__slots__ = ("_callback", "_client")
Expand Down Expand Up @@ -112,7 +114,9 @@ def callback(self) -> _CallbackSigT:
class SelfInjecting(alluka.SelfInjecting[_SyncCallbackT]):
"""Deprecated class for marking functions as self-injecting.
Use [Client.auto_inject][alluka.abc.Client.auto_inject].
!!! warning "deprecated"
This is deprecated as of `v0.2.0`,
Use [Client.auto_inject][alluka.abc.Client.auto_inject].
"""

__slots__ = ("_callback", "_client")
Expand Down
16 changes: 12 additions & 4 deletions alluka/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ def as_async_self_injecting(
) -> AsyncSelfInjecting[_CallbackT]: # pyright: ignore[reportDeprecated]
"""Deprecated callback for making async functions auto-inject.
Use [Client.auto_inject_async][alluka.abc.Client.auto_inject_async].
!!! warning "deprecated"
This is deprecated as of `v0.2.0`, use
[Client.auto_inject_async][alluka.abc.Client.auto_inject_async].
"""

@abc.abstractmethod
Expand All @@ -112,7 +114,9 @@ def as_self_injecting(
) -> SelfInjecting[_SyncCallbackT]: # pyright: ignore[reportDeprecated]
"""Deprecated callback for making functions auto-inject.
Use [Client.auto_inject][alluka.abc.Client.auto_inject].
!!! warning "deprecated"
This is deprecated as of `v0.2.0`, use
[Client.auto_inject][alluka.abc.Client.auto_inject].
"""

def auto_inject(self, callback: collections.Callable[_P, _T], /) -> collections.Callable[_P, _T]:
Expand Down Expand Up @@ -617,7 +621,9 @@ def get_type_dependency(self, type_: type[_T], /, *, default: _DefaultT = ...) -
class AsyncSelfInjecting(abc.ABC, typing.Generic[_CallbackT]):
"""Deprecated interface of a class for marking async functions as self-injecting.
Use [Client.auto_inject_async][alluka.abc.Client.auto_inject_async].
!!! warning "deprecated"
This is deprecated as of `v0.2.0`, use
[Client.auto_inject_async][alluka.abc.Client.auto_inject_async].
"""

__slots__ = ()
Expand Down Expand Up @@ -678,7 +684,9 @@ async def __call__(
class SelfInjecting(abc.ABC, typing.Generic[_SyncCallbackT]):
"""Deprecated interface of a class for marking functions as self-injecting.
Use [Client.auto_inject][alluka.abc.Client.auto_inject].
!!! warning "deprecated"
This is deprecated as of `v0.2.0`, use
[Client.auto_inject][alluka.abc.Client.auto_inject].
"""

__slots__ = ()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ timeout = 15
required_plugins = ["anyio"]
filterwarnings = [
"error",
"ignore:Use CachingContext:DeprecationWarning",
"ignore:Use Context or CachingContext:DeprecationWarning",
"ignore:Use ContextOverride:DeprecationWarning",
]

Expand Down

0 comments on commit 2fdb1c4

Please sign in to comment.