Migration Guide🔗
The latest release is v0.16; every release's changes are listed in the Changelog. This guide contains only rewrites, deprecations, and observable changes that existing users need to handle when upgrading. New APIs and capabilities belong in the Changelog and topic guides.
Migrate Legacy Target Values🔗
v0.8 introduced TargetMode so deprecation intent no longer depends on the legacy None, True, and False sentinels. These examples show the current form and the caller behavior to preserve during migration.
target=None → TargetMode.NOTIFY🔗
target=None means "warn, then run the decorated body". It still works, but emits FutureWarning at decoration time.
For a warn-only migration without args_mapping or attrs_mapping, prefer an explicit target=TargetMode.NOTIFY, as the examples here do. Omitting target is the shortest form and resolves to the same mode, because the TargetMode.AUTO default picks TargetMode.NOTIFY when no mapping is present. A decorator that carries a mapping is a different case: see Misconfigured TargetMode combinations, where choosing the remap mode activates a mapping that target=None left inert, and removing the mapping keeps the warn-only behavior.
- # DEPRECATED API — legacy sentinel
- @deprecated(target=None, deprecated_in="1.0", remove_in="2.0")
+ # DEPRECATED API — current warn-only form
+ @deprecated(target=TargetMode.NOTIFY, deprecated_in="1.0", remove_in="2.0")
from deprecate import TargetMode, deprecated
@deprecated(target=TargetMode.NOTIFY, deprecated_in="1.0", remove_in="2.0")
def refresh_cache(cache_key: str) -> str:
"""Refresh one cached value."""
return f"refreshed:{cache_key}"
print(refresh_cache("products")) # warns: FutureWarning
The notice respects num_warns (once by default); the function body still executes normally.
target=True → TargetMode.ARGS_REMAP🔗
target=True remaps deprecated keyword names within the same function. Replace it with TargetMode.ARGS_REMAP; existing callers can keep the old keyword during the migration window while new callers use the replacement.
from deprecate import TargetMode, deprecated
@deprecated(
target=TargetMode.ARGS_REMAP,
args_mapping={"ttl": "cache_ttl"},
deprecated_in="1.0",
remove_in="2.0",
)
def configure_cache(cache_ttl: int = 60) -> int:
"""Return the configured cache lifetime."""
return cache_ttl
# DEPRECATED API — old callers are remapped and warned.
print(configure_cache(ttl=30))
# NEW API — callers use the replacement keyword directly.
print(configure_cache(cache_ttl=45))
target=False → TargetMode.NOTIFY or a callable target🔗
target=False was never a valid target. On a callable it now emits UserWarning at decoration time and behaves like warn-only mode.
Proxy compatibility paths
deprecated_class treats it like an omitted target while marking the configuration as misconfigured, so a supplied mapping may still be inferred. deprecated_instance raises TypeError. Do not rely on either compatibility path.
Choose the behavior you actually need:
- # DEPRECATED API — invalid legacy sentinel
- @deprecated(target=False, deprecated_in="1.0", remove_in="2.0")
+ # DEPRECATED API — keep running this body after warning
+ @deprecated(target=TargetMode.NOTIFY, deprecated_in="1.0", remove_in="2.0")
from deprecate import TargetMode, deprecated
@deprecated(
target=TargetMode.NOTIFY,
deprecated_in="1.0",
remove_in="2.0",
)
def legacy_checksum(payload: str) -> int:
"""Compute the retained legacy checksum."""
return len(payload)
print(legacy_checksum("abc"))
If the old API should forward to a replacement, pass that callable instead. The deprecated body is then not executed:
from deprecate import deprecated
def checksum_v2(payload: bytes) -> int:
"""Compute the replacement checksum."""
return sum(payload)
@deprecated(
target=checksum_v2,
args_mapping={"text": "payload"},
deprecated_in="1.0",
remove_in="2.0",
)
def checksum(text: bytes) -> int:
"""Retain the deprecated signature during migration."""
...
# DEPRECATED API — forwards to checksum_v2 and warns.
print(checksum(text=b"abc"))
# NEW API — callers move directly to the replacement.
print(checksum_v2(payload=b"abc"))
The same rule applies to deprecated_class() and deprecated_instance(): target=False is not a valid mode.
Misconfigured TargetMode combinations🔗
Contradictory combinations emit UserWarning at decoration time. The warning is a migration task: the ignored configuration is scheduled to become an error in v1.0.
| Combination | Migration |
|---|---|
TargetMode.ARGS_REMAP without args_mapping |
Add a real mapping, or use TargetMode.NOTIFY for warn-only behavior. |
Explicit TargetMode.NOTIFY with args_mapping |
Omit target so AUTO infers ARGS_REMAP, select ARGS_REMAP explicitly, or remove the mapping. |
Explicit TargetMode.NOTIFY with args_extra |
Use a callable target if extra kwargs must reach a replacement, or remove args_extra. |
deprecated_class(target=TargetMode.NOTIFY, attrs_mapping=...) |
Omit target so the proxy infers ATTRS_REMAP, select ATTRS_REMAP explicitly, or remove the mapping. |
deprecated_class(target=TargetMode.ATTRS_REMAP) without a mapping |
Add attrs_mapping={"old": "new"}, or use NOTIFY for class-wide warnings. |
An explicitly supplied NOTIFY is never rewritten: its mapping stays inert. Inference happens only when target is omitted.
@deprecated(target=TargetMode.ATTRS_REMAP) is not in this table because it no longer warns: it has raised TypeError since v0.12, for function and class sources alike. Use deprecated_class(attrs_mapping=...); the common front door does not expose the proxy-only attrs_mapping.
DeprecationWrapperInfo field renames🔗
Two audit fields were renamed in v0.8. The old names still work and will be removed in v1.0.
- Reading the old properties emits a
FutureWarningand raisesDeprecatedErrorin fatal mode. - Passing the old names as constructor or
dataclasses.replace()keywords emits aDeprecationWarning.
- # DEPRECATED API — compatibility properties
- info.empty_mapping
- info.identity_mapping
- dataclasses.replace(info, empty_mapping=True)
+ # NEW API — stored field names
+ info.empty_args_mapping
+ info.identity_args_mapping
+ dataclasses.replace(info, empty_args_mapping=True)
The replacement fields are regular dataclass fields, so introspection and dataclasses.replace() use them directly:
from dataclasses import replace
from deprecate.audit import DeprecationWrapperInfo
info = DeprecationWrapperInfo(
empty_args_mapping=True,
identity_args_mapping=["timeout"],
)
updated = replace(info, empty_args_mapping=False)
print(info.empty_args_mapping)
print(info.identity_args_mapping)
print(updated.empty_args_mapping)
Pick Your Upgrade Path🔗
Find the section matching the version you are upgrading from. Each section aggregates every later migration-relevant compatibility change into two tabs:
- Apply every item under Breaking changes.
- Review changed warnings, errors, audit scope, and proxy behavior under Behavior changes.
- Run your suite with
FutureWarningpromoted to an error, then run your pyDeprecate audit/expiry CI checks.
This guide works at minor-line granularity. v0.N.x means the latest available bugfix release in that feature line. The paths assume your dependency constraint allows bugfix updates and that you update within v0.N.x before crossing to the next feature line.
Patch and post releases are folded into their minor interval rather than receiving separate sections.
Releases with no migration work are skipped. Where a later release superseded an intermediate behavior, the section describes the final v0.16.x behavior.
Coming from v0.15.x🔗
- An operand after
--is always a path, never the legacy positional version.pydeprecate expiry -- src/pkg 2.0now treats2.0as a second path instead of reading it as the version, and exits2when no such path exists. Pass--version 2.0. - A second positional version on
expiry,allandstatusis deprecated. With two positionals, the second is a path first. It is read as a version only when it names no path or findable module and parses as one; that spelling prints a notice on stderr and stops working in v1.0. Pass--versioninstead; passing both exits2. - The empty
cliextra is removed. Thepydeprecatecommand needs no dependency, so replacepyDeprecate[cli]with the base package, or withpyDeprecate[audit]when you use the audit extras.pip install 'pyDeprecate[cli]'still installs, with pip's warning that the extra does not exist.
read_only=Trueproxies block six more methods.sort,reverse,popitem,difference_update,intersection_updateandsymmetric_difference_updatenow raiseAttributeErrorinstead of changing the wrapped list, dict or set. The guarded names go from 10 to 16, and a custom method with one of these names is blocked too.- A proxy with a callable
targetandargs_mappingshares one warning budget per call.deprecated_classanddeprecated_instanceemit one call-level warning per call instead of one per renamed keyword, and its message names the replacement rather than each renamed keyword. A test that counted or matched one warning per renamed keyword now changes. - Audit reports a function bound under several names under its own public name. When an alias used to sort first, the row and its finding id carried the alias. A name-based allowlist,
--ignorepattern or committed snapshot keyed on that alias needs the function's own name instead.
Coming from v0.14.x🔗
- A function
deprecated_instancestored as a class attribute now binds like a method, and only plain functions do.- Instance access passes
selfto the wrapped function; usestaticmethod(deprecated_instance(...))for static-style access. - A
functools.partial, bound method, builtin or Cython binding callable is served unbound and silent instead. A deprecatedpartialclass attribute is therefore no longer bound by Python.
- Instance access passes
-
functools.partial,partialmethodandsingledispatchmethodsources now raiseTypeErrorat decoration. This includes a named partial (given a__name__throughfunctools.update_wrapper) that 0.14 accepted. Wrap the object in a plaindefthat calls it and decorate thatdef. -
An operand after
--is always a path, never the legacy positional version.pydeprecate expiry -- src/pkg 2.0now treats2.0as a second path instead of reading it as the version, and exits2when no such path exists. Pass--version 2.0. - A second positional version on
expiry,allandstatusis deprecated. With two positionals, the second is a path first. It is read as a version only when it names no path or findable module and parses as one; that spelling prints a notice on stderr and stops working in v1.0. Pass--versioninstead; passing both exits2. - The empty
cliextra is removed. Thepydeprecatecommand needs no dependency, so replacepyDeprecate[cli]with the base package, or withpyDeprecate[audit]when you use the audit extras.pip install 'pyDeprecate[cli]'still installs, with pip's warning that the extra does not exist.
- Calls that need no forwarding preserve the caller's positional and keyword argument form. A call that needs no forwarding, rename or extra argument reaches the source exactly as made.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
*args, which stay positional. - A custom stream that raises no longer leaves warning bookkeeping or emission context stuck. On a deprecated proxy, a warning that fails to deliver does not spend the warning budget. A decorated function still spends it.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
- Warnings that reported a pyDeprecate frame now point at the caller. Call-time warnings already named the user's call site. The remaining ones, notably the inner warning of a stacked deprecation chain, now carry the caller's line and module too. A warning filter keyed on
module="deprecate"that matched those warnings no longer does. Those warnings therefore surface, and raise under-W error. Key filters on the calling module instead. - Async proxy warnings are emitted when the underlying awaitable or async iterator is obtained. A later failure or exhaustion during
awaitor__anext__still consumes the warning budget.- If the warning itself fails, a coroutine the wrapped call created is closed. A coroutine the wrapped object holds as an attribute, or is itself, is left usable.
next()on a deprecated proxy now warns before the wrapped iterator advances, so a failed warning consumes no item. Calling the proxy also warns first, as@deprecateddoes. Other synchronous operations still warn only after success.- In-place operators and
defaultdictsubscripts keep their effect if delivery fails.
- A custom
streamis called exactly once, with its signature read before the call. A stream that declares**kwargsreceivesstacklevel=and must accept or drop it. Forward it towarnings.warnorlogging.warning;print(msg, **kwargs)raisesTypeError. Declaredef sink(msg)to receive the message alone. A bare(*args, **kwargs)functools.wrapspass-through is judged by the callable it wraps, also when afunctools.partialbinds it. A stream whose only parameter is namedstacklevelreceives the message alone. skip_ifnow covers item and in-place writes. Withskip_ifactive,proxy[key] = value,del proxy[key]and in-place operators write to the wrapped object. The read-only guard does not apply. A fatal proxy (as_exception=True) raisesDeprecatedErrorbefore a subscript, iteration or mapped attribute read touches the wrapped object.- Deprecated generators warn on the first iteration, not at the call. A deprecated generator function keeps
inspect.isgeneratorfunction. A deprecated async-generator function keepsinspect.isasyncgenfunction, so pytestyieldfixtures run their setup and teardown. The warning, thenum_warnsbudget,skip_if, argument binding and anas_exception/as_exceptions()error now resolve on the firstnext()/__anext__(). A generator that is never iterated never warns. Movepytest.warns()andpytest.raises()around the first iteration, and keepas_exceptions()active at that step. - An empty-string
args_mappingvalue keeps the argument. Under@deprecated,args_mapping={"old_arg": ""}now passesold_argthrough under its old name, asdeprecated_classalways did. A**kwargstarget therefore receives it; onlyNonedrops an argument. Map the argument toNoneif you relied on""dropping it. - Proxies carry only the protocols of the wrapped object or its replacement. A deprecated
dictis no longercallable(), anIterator,os.PathLike,AwaitableorAsyncIterable. A protocol the object disables stays disabled.type(proxy) is _DeprecatedProxyis nowFalse; useisinstance(proxy, DeprecationProxy). The generated proxy subclasses cannot be pickled by reference. - Forwarding to a
classmethodchecks the source's shape at decoration. Any receiver name works (klass,mcs).- These source shapes raise
TypeErrorat decoration:- A source with no leading positional parameter raises the error.
- A source with a later parameter named like the target's receiver raises the error.
- A static or plain source given a non-class first argument raises
TypeErrorbefore warning.
- These source shapes raise
- CLI arguments follow
argparse.- Spellings only the Fire-based CLI accepted exit
2:- A quoted literal such as
--version '"0.10"'exits2. - A list literal in
--excludeexits2; pass comma-separated patterns. - A table in
--min-graceexits2; set it inpyproject.toml. --path=pkgexits2.- Short flags such as
-rexit2. - An empty
--report-json=exits2. - Abbreviated option names exit
2. - Before v0.16, a second positional path exits
2; since v0.16 every subcommand takes several paths.
- A quoted literal such as
- A boolean flag given a value accepts only
true,false,1or0. Use the bare flag or--no-<flag>otherwise.
- Spellings only the Fire-based CLI accepted exit
- CLI exit codes changed.
checkandallexit1on misconfigured targets and inner-order@property @deprecatedwrappers, which used to pass. A scan error or internal error exits3instead of1, and--exit-zeromasks neither2nor3.- These inputs exit
2:- A single
.pyfile exits2. - A directory holding several packages exits
2. - A name that is neither a path nor an importable module exits
2.
- A single
- Check how CI steps treat
2and3.
- These inputs exit
deprecated_module(stream=None)warns at the call. An explicitstream=Nonestill delivers throughwarnings.warnbut emits aFutureWarning. In v1.0 it silences the module warning, and thenum_warnsdefault changes from-1to1. Omitstreamfor today's delivery and passnum_warns=-1to keep a warning on every access.-
DeprecationWrapperInfo.empty_mappingandidentity_mappingwarn withFutureWarning. Reading the deprecated aliases now emitsFutureWarningon every access instead ofDeprecationWarning, and raises under fatal mode. Readempty_args_mappingandidentity_args_mappinginstead. -
read_only=Trueproxies block six more methods.sort,reverse,popitem,difference_update,intersection_updateandsymmetric_difference_updatenow raiseAttributeErrorinstead of changing the wrapped list, dict or set. The guarded names go from 10 to 16, and a custom method with one of these names is blocked too. - A proxy with a callable
targetandargs_mappingshares one warning budget per call.deprecated_classanddeprecated_instanceemit one call-level warning per call instead of one per renamed keyword, and its message names the replacement rather than each renamed keyword. A test that counted or matched one warning per renamed keyword now changes. - Audit reports a function bound under several names under its own public name. When an alias used to sort first, the row and its finding id carried the alias. A name-based allowlist,
--ignorepattern or committed snapshot keyed on that alias needs the function's own name instead.
Coming from v0.13.x🔗
- A function
deprecated_instancestored as a class attribute now binds like a method, and only plain functions do.- Instance access passes
selfto the wrapped function; usestaticmethod(deprecated_instance(...))for static-style access. - A
functools.partial, bound method, builtin or Cython binding callable is served unbound and silent instead. A deprecatedpartialclass attribute is therefore no longer bound by Python.
- Instance access passes
-
functools.partial,partialmethodandsingledispatchmethodsources now raiseTypeErrorat decoration. This includes a named partial (given a__name__throughfunctools.update_wrapper) that 0.14 accepted. Wrap the object in a plaindefthat calls it and decorate thatdef. -
An operand after
--is always a path, never the legacy positional version.pydeprecate expiry -- src/pkg 2.0now treats2.0as a second path instead of reading it as the version, and exits2when no such path exists. Pass--version 2.0. - A second positional version on
expiry,allandstatusis deprecated. With two positionals, the second is a path first. It is read as a version only when it names no path or findable module and parses as one; that spelling prints a notice on stderr and stops working in v1.0. Pass--versioninstead; passing both exits2. - The empty
cliextra is removed. Thepydeprecatecommand needs no dependency, so replacepyDeprecate[cli]with the base package, or withpyDeprecate[audit]when you use the audit extras.pip install 'pyDeprecate[cli]'still installs, with pip's warning that the extra does not exist.
- v0.14 ships
py.typed, so type checkers now read pyDeprecate's own types instead of treating every object asAny. Runtime behavior is unchanged; only checker output moves. Old: DeprecationProxy[New] = deprecated_class(target=New, ...)(Cls)no longer type-checks. A call-formdeprecated_class(...)alias is typed as the class it forwards to (type[New]with a classtarget, otherwise the wrapped class), so drop the annotation.DeprecationProxy[T]remains the annotation fordeprecated_instance()proxies.- Old names accepted only through
args_mapping/attrs_mappingare reported on call-form aliases ascall-arg/attr-defined. The decorator form already did this under mypy. To keep such call sites type-checking during the migration window, choose either approach:- Keep the old names in a legacy class body (decorator form).
- Wrap the alias in
cast(DeprecationProxy[New], ...);isinstanceagainst the alias then stops type-checking.
- Proxy-only attributes such as
__wrapped__and__deprecation_config__are invisible ontype[New]. Read them withget_deprecation_config(Old)orinspect.unwrap(Old). -
Setting
__deprecated__on a deprecated proxy now keeps the marker on the proxy. Deleting it no longer removes the wrapped object's own marker; reading it after deletion raisesAttributeError.copy.copy,copy.deepcopy, andpicklekeep a PEP 702 message written onto the proxy. -
Calls that need no forwarding preserve the caller's positional and keyword argument form. A call that needs no forwarding, rename or extra argument reaches the source exactly as made.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
*args, which stay positional. - A custom stream that raises no longer leaves warning bookkeeping or emission context stuck. On a deprecated proxy, a warning that fails to deliver does not spend the warning budget. A decorated function still spends it.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
- Warnings that reported a pyDeprecate frame now point at the caller. Call-time warnings already named the user's call site. The remaining ones, notably the inner warning of a stacked deprecation chain, now carry the caller's line and module too. A warning filter keyed on
module="deprecate"that matched those warnings no longer does. Those warnings therefore surface, and raise under-W error. Key filters on the calling module instead. - Async proxy warnings are emitted when the underlying awaitable or async iterator is obtained. A later failure or exhaustion during
awaitor__anext__still consumes the warning budget.- If the warning itself fails, a coroutine the wrapped call created is closed. A coroutine the wrapped object holds as an attribute, or is itself, is left usable.
next()on a deprecated proxy now warns before the wrapped iterator advances, so a failed warning consumes no item. Calling the proxy also warns first, as@deprecateddoes. Other synchronous operations still warn only after success.- In-place operators and
defaultdictsubscripts keep their effect if delivery fails.
- A custom
streamis called exactly once, with its signature read before the call. A stream that declares**kwargsreceivesstacklevel=and must accept or drop it. Forward it towarnings.warnorlogging.warning;print(msg, **kwargs)raisesTypeError. Declaredef sink(msg)to receive the message alone. A bare(*args, **kwargs)functools.wrapspass-through is judged by the callable it wraps, also when afunctools.partialbinds it. A stream whose only parameter is namedstacklevelreceives the message alone. skip_ifnow covers item and in-place writes. Withskip_ifactive,proxy[key] = value,del proxy[key]and in-place operators write to the wrapped object. The read-only guard does not apply. A fatal proxy (as_exception=True) raisesDeprecatedErrorbefore a subscript, iteration or mapped attribute read touches the wrapped object.- Deprecated generators warn on the first iteration, not at the call. A deprecated generator function keeps
inspect.isgeneratorfunction. A deprecated async-generator function keepsinspect.isasyncgenfunction, so pytestyieldfixtures run their setup and teardown. The warning, thenum_warnsbudget,skip_if, argument binding and anas_exception/as_exceptions()error now resolve on the firstnext()/__anext__(). A generator that is never iterated never warns. Movepytest.warns()andpytest.raises()around the first iteration, and keepas_exceptions()active at that step. - An empty-string
args_mappingvalue keeps the argument. Under@deprecated,args_mapping={"old_arg": ""}now passesold_argthrough under its old name, asdeprecated_classalways did. A**kwargstarget therefore receives it; onlyNonedrops an argument. Map the argument toNoneif you relied on""dropping it. - Proxies carry only the protocols of the wrapped object or its replacement. A deprecated
dictis no longercallable(), anIterator,os.PathLike,AwaitableorAsyncIterable. A protocol the object disables stays disabled.type(proxy) is _DeprecatedProxyis nowFalse; useisinstance(proxy, DeprecationProxy). The generated proxy subclasses cannot be pickled by reference. - Forwarding to a
classmethodchecks the source's shape at decoration. Any receiver name works (klass,mcs).- These source shapes raise
TypeErrorat decoration:- A source with no leading positional parameter raises the error.
- A source with a later parameter named like the target's receiver raises the error.
- A static or plain source given a non-class first argument raises
TypeErrorbefore warning.
- These source shapes raise
- CLI arguments follow
argparse.- Spellings only the Fire-based CLI accepted exit
2:- A quoted literal such as
--version '"0.10"'exits2. - A list literal in
--excludeexits2; pass comma-separated patterns. - A table in
--min-graceexits2; set it inpyproject.toml. --path=pkgexits2.- Short flags such as
-rexit2. - An empty
--report-json=exits2. - Abbreviated option names exit
2. - Before v0.16, a second positional path exits
2; since v0.16 every subcommand takes several paths.
- A quoted literal such as
- A boolean flag given a value accepts only
true,false,1or0. Use the bare flag or--no-<flag>otherwise.
- Spellings only the Fire-based CLI accepted exit
- CLI exit codes changed.
checkandallexit1on misconfigured targets and inner-order@property @deprecatedwrappers, which used to pass. A scan error or internal error exits3instead of1, and--exit-zeromasks neither2nor3.- These inputs exit
2:- A single
.pyfile exits2. - A directory holding several packages exits
2. - A name that is neither a path nor an importable module exits
2.
- A single
- Check how CI steps treat
2and3.
- These inputs exit
deprecated_module(stream=None)warns at the call. An explicitstream=Nonestill delivers throughwarnings.warnbut emits aFutureWarning. In v1.0 it silences the module warning, and thenum_warnsdefault changes from-1to1. Omitstreamfor today's delivery and passnum_warns=-1to keep a warning on every access.-
DeprecationWrapperInfo.empty_mappingandidentity_mappingwarn withFutureWarning. Reading the deprecated aliases now emitsFutureWarningon every access instead ofDeprecationWarning, and raises under fatal mode. Readempty_args_mappingandidentity_args_mappinginstead. -
read_only=Trueproxies block six more methods.sort,reverse,popitem,difference_update,intersection_updateandsymmetric_difference_updatenow raiseAttributeErrorinstead of changing the wrapped list, dict or set. The guarded names go from 10 to 16, and a custom method with one of these names is blocked too. - A proxy with a callable
targetandargs_mappingshares one warning budget per call.deprecated_classanddeprecated_instanceemit one call-level warning per call instead of one per renamed keyword, and its message names the replacement rather than each renamed keyword. A test that counted or matched one warning per renamed keyword now changes. - Audit reports a function bound under several names under its own public name. When an alias used to sort first, the row and its finding id carried the alias. A name-based allowlist,
--ignorepattern or committed snapshot keyed on that alias needs the function's own name instead.
Coming from v0.12.x🔗
-
__deprecated__is now a plain PEP 702-conformant message string, not theDeprecationConfigobject. The config object moved to__deprecation_config__.- Code reading
func.__deprecated__.target,.deprecated_in,.args_mapping, or any other config field now gets a plainstr. So does code checkingisinstance(func.__deprecated__, DeprecationConfig). It either raisesAttributeErroror evaluatesFalse. - Replace direct reads with the public
get_deprecation_config(obj)helper. It also falls back to a legacy__deprecated__-as-config layout for objects built by a pyDeprecate release before v0.13. This affects every wrapper kind — functions, methods, class proxies (deprecated_class), instance proxies (deprecated_instance), and modules (deprecated_module).
- Code reading
-
A function
deprecated_instancestored as a class attribute now binds like a method, and only plain functions do.- Instance access passes
selfto the wrapped function; usestaticmethod(deprecated_instance(...))for static-style access. - A
functools.partial, bound method, builtin or Cython binding callable is served unbound and silent instead. A deprecatedpartialclass attribute is therefore no longer bound by Python.
- Instance access passes
-
functools.partial,partialmethodandsingledispatchmethodsources now raiseTypeErrorat decoration. This includes a named partial (given a__name__throughfunctools.update_wrapper) that 0.14 accepted. Wrap the object in a plaindefthat calls it and decorate thatdef. -
An operand after
--is always a path, never the legacy positional version.pydeprecate expiry -- src/pkg 2.0now treats2.0as a second path instead of reading it as the version, and exits2when no such path exists. Pass--version 2.0. - A second positional version on
expiry,allandstatusis deprecated. With two positionals, the second is a path first. It is read as a version only when it names no path or findable module and parses as one; that spelling prints a notice on stderr and stops working in v1.0. Pass--versioninstead; passing both exits2. - The empty
cliextra is removed. Thepydeprecatecommand needs no dependency, so replacepyDeprecate[cli]with the base package, or withpyDeprecate[audit]when you use the audit extras.pip install 'pyDeprecate[cli]'still installs, with pip's warning that the extra does not exist.
-
Griffe's
RuntimeDocstringsextension now scopes its docstring-replacement guard to pyDeprecate's own__deprecation_config__metadata (get_deprecation_config(obj) is not None). This replaces a bare truthiness check on__deprecated__. A foreign object decorated only with the stdlib'swarnings.deprecated/typing_extensions.deprecatedpreviously passed that truthy check too. Such an object has a string-valued__deprecated__and no pyDeprecate metadata. It no longer passes the check, since it was never meant to be replaced. -
v0.14 ships
py.typed, so type checkers now read pyDeprecate's own types instead of treating every object asAny. Runtime behavior is unchanged; only checker output moves. Old: DeprecationProxy[New] = deprecated_class(target=New, ...)(Cls)no longer type-checks. A call-formdeprecated_class(...)alias is typed as the class it forwards to (type[New]with a classtarget, otherwise the wrapped class), so drop the annotation.DeprecationProxy[T]remains the annotation fordeprecated_instance()proxies.- Old names accepted only through
args_mapping/attrs_mappingare reported on call-form aliases ascall-arg/attr-defined. The decorator form already did this under mypy. To keep such call sites type-checking during the migration window, choose either approach:- Keep the old names in a legacy class body (decorator form).
- Wrap the alias in
cast(DeprecationProxy[New], ...);isinstanceagainst the alias then stops type-checking.
- Proxy-only attributes such as
__wrapped__and__deprecation_config__are invisible ontype[New]. Read them withget_deprecation_config(Old)orinspect.unwrap(Old). -
Setting
__deprecated__on a deprecated proxy now keeps the marker on the proxy. Deleting it no longer removes the wrapped object's own marker; reading it after deletion raisesAttributeError.copy.copy,copy.deepcopy, andpicklekeep a PEP 702 message written onto the proxy. -
Calls that need no forwarding preserve the caller's positional and keyword argument form. A call that needs no forwarding, rename or extra argument reaches the source exactly as made.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
*args, which stay positional. - A custom stream that raises no longer leaves warning bookkeeping or emission context stuck. On a deprecated proxy, a warning that fails to deliver does not spend the warning budget. A decorated function still spends it.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
- Warnings that reported a pyDeprecate frame now point at the caller. Call-time warnings already named the user's call site. The remaining ones, notably the inner warning of a stacked deprecation chain, now carry the caller's line and module too. A warning filter keyed on
module="deprecate"that matched those warnings no longer does. Those warnings therefore surface, and raise under-W error. Key filters on the calling module instead. - Async proxy warnings are emitted when the underlying awaitable or async iterator is obtained. A later failure or exhaustion during
awaitor__anext__still consumes the warning budget.- If the warning itself fails, a coroutine the wrapped call created is closed. A coroutine the wrapped object holds as an attribute, or is itself, is left usable.
next()on a deprecated proxy now warns before the wrapped iterator advances, so a failed warning consumes no item. Calling the proxy also warns first, as@deprecateddoes. Other synchronous operations still warn only after success.- In-place operators and
defaultdictsubscripts keep their effect if delivery fails.
- A custom
streamis called exactly once, with its signature read before the call. A stream that declares**kwargsreceivesstacklevel=and must accept or drop it. Forward it towarnings.warnorlogging.warning;print(msg, **kwargs)raisesTypeError. Declaredef sink(msg)to receive the message alone. A bare(*args, **kwargs)functools.wrapspass-through is judged by the callable it wraps, also when afunctools.partialbinds it. A stream whose only parameter is namedstacklevelreceives the message alone. skip_ifnow covers item and in-place writes. Withskip_ifactive,proxy[key] = value,del proxy[key]and in-place operators write to the wrapped object. The read-only guard does not apply. A fatal proxy (as_exception=True) raisesDeprecatedErrorbefore a subscript, iteration or mapped attribute read touches the wrapped object.- Deprecated generators warn on the first iteration, not at the call. A deprecated generator function keeps
inspect.isgeneratorfunction. A deprecated async-generator function keepsinspect.isasyncgenfunction, so pytestyieldfixtures run their setup and teardown. The warning, thenum_warnsbudget,skip_if, argument binding and anas_exception/as_exceptions()error now resolve on the firstnext()/__anext__(). A generator that is never iterated never warns. Movepytest.warns()andpytest.raises()around the first iteration, and keepas_exceptions()active at that step. - An empty-string
args_mappingvalue keeps the argument. Under@deprecated,args_mapping={"old_arg": ""}now passesold_argthrough under its old name, asdeprecated_classalways did. A**kwargstarget therefore receives it; onlyNonedrops an argument. Map the argument toNoneif you relied on""dropping it. - Proxies carry only the protocols of the wrapped object or its replacement. A deprecated
dictis no longercallable(), anIterator,os.PathLike,AwaitableorAsyncIterable. A protocol the object disables stays disabled.type(proxy) is _DeprecatedProxyis nowFalse; useisinstance(proxy, DeprecationProxy). The generated proxy subclasses cannot be pickled by reference. - Forwarding to a
classmethodchecks the source's shape at decoration. Any receiver name works (klass,mcs).- These source shapes raise
TypeErrorat decoration:- A source with no leading positional parameter raises the error.
- A source with a later parameter named like the target's receiver raises the error.
- A static or plain source given a non-class first argument raises
TypeErrorbefore warning.
- These source shapes raise
- CLI arguments follow
argparse.- Spellings only the Fire-based CLI accepted exit
2:- A quoted literal such as
--version '"0.10"'exits2. - A list literal in
--excludeexits2; pass comma-separated patterns. - A table in
--min-graceexits2; set it inpyproject.toml. --path=pkgexits2.- Short flags such as
-rexit2. - An empty
--report-json=exits2. - Abbreviated option names exit
2. - Before v0.16, a second positional path exits
2; since v0.16 every subcommand takes several paths.
- A quoted literal such as
- A boolean flag given a value accepts only
true,false,1or0. Use the bare flag or--no-<flag>otherwise.
- Spellings only the Fire-based CLI accepted exit
- CLI exit codes changed.
checkandallexit1on misconfigured targets and inner-order@property @deprecatedwrappers, which used to pass. A scan error or internal error exits3instead of1, and--exit-zeromasks neither2nor3.- These inputs exit
2:- A single
.pyfile exits2. - A directory holding several packages exits
2. - A name that is neither a path nor an importable module exits
2.
- A single
- Check how CI steps treat
2and3.
- These inputs exit
deprecated_module(stream=None)warns at the call. An explicitstream=Nonestill delivers throughwarnings.warnbut emits aFutureWarning. In v1.0 it silences the module warning, and thenum_warnsdefault changes from-1to1. Omitstreamfor today's delivery and passnum_warns=-1to keep a warning on every access.-
DeprecationWrapperInfo.empty_mappingandidentity_mappingwarn withFutureWarning. Reading the deprecated aliases now emitsFutureWarningon every access instead ofDeprecationWarning, and raises under fatal mode. Readempty_args_mappingandidentity_args_mappinginstead. -
read_only=Trueproxies block six more methods.sort,reverse,popitem,difference_update,intersection_updateandsymmetric_difference_updatenow raiseAttributeErrorinstead of changing the wrapped list, dict or set. The guarded names go from 10 to 16, and a custom method with one of these names is blocked too. - A proxy with a callable
targetandargs_mappingshares one warning budget per call.deprecated_classanddeprecated_instanceemit one call-level warning per call instead of one per renamed keyword, and its message names the replacement rather than each renamed keyword. A test that counted or matched one warning per renamed keyword now changes. - Audit reports a function bound under several names under its own public name. When an alias used to sort first, the row and its finding id carried the alias. A name-based allowlist,
--ignorepattern or committed snapshot keyed on that alias needs the function's own name instead.
Coming from v0.11.x🔗
@deprecated(target=TargetMode.ATTRS_REMAP)now raisesTypeErrorfor a class source. It already raised for functions.ATTRS_REMAPneeds the class-onlyattrs_mappingkeyword, which the common front door does not expose. A class source therefore previously built a proxy that remapped nothing. Usedeprecated_class(attrs_mapping=...).-
Rename
template_mgstomessage_templateondeprecated(),deprecated_callable(),deprecated_class(), anddeprecated_instance(). The typo remains a warning alias until v1.0; supplying both names raisesTypeError. -
__deprecated__is now a plain PEP 702-conformant message string, not theDeprecationConfigobject. The config object moved to__deprecation_config__.- Code reading
func.__deprecated__.target,.deprecated_in,.args_mapping, or any other config field now gets a plainstr. So does code checkingisinstance(func.__deprecated__, DeprecationConfig). It either raisesAttributeErroror evaluatesFalse. - Replace direct reads with the public
get_deprecation_config(obj)helper. It also falls back to a legacy__deprecated__-as-config layout for objects built by a pyDeprecate release before v0.13. This affects every wrapper kind — functions, methods, class proxies (deprecated_class), instance proxies (deprecated_instance), and modules (deprecated_module).
- Code reading
-
A function
deprecated_instancestored as a class attribute now binds like a method, and only plain functions do.- Instance access passes
selfto the wrapped function; usestaticmethod(deprecated_instance(...))for static-style access. - A
functools.partial, bound method, builtin or Cython binding callable is served unbound and silent instead. A deprecatedpartialclass attribute is therefore no longer bound by Python.
- Instance access passes
-
functools.partial,partialmethodandsingledispatchmethodsources now raiseTypeErrorat decoration. This includes a named partial (given a__name__throughfunctools.update_wrapper) that 0.14 accepted. Wrap the object in a plaindefthat calls it and decorate thatdef. -
An operand after
--is always a path, never the legacy positional version.pydeprecate expiry -- src/pkg 2.0now treats2.0as a second path instead of reading it as the version, and exits2when no such path exists. Pass--version 2.0. - A second positional version on
expiry,allandstatusis deprecated. With two positionals, the second is a path first. It is read as a version only when it names no path or findable module and parses as one; that spelling prints a notice on stderr and stops working in v1.0. Pass--versioninstead; passing both exits2. - The empty
cliextra is removed. Thepydeprecatecommand needs no dependency, so replacepyDeprecate[cli]with the base package, or withpyDeprecate[audit]when you use the audit extras.pip install 'pyDeprecate[cli]'still installs, with pip's warning that the extra does not exist.
@deprecatednow defaults toTargetMode.AUTO. It resolves at decoration time: a function/class withargs_mappingbecomesARGS_REMAP; a source without a mapping becomes warn-only.AUTOis never stored inDeprecationConfig. Do not pass it explicitly because it exists only as the front-door default.- Existing
@deprecateduse on a class remains supported; no code change or decorator rewrite is required. It permanently delegates todeprecated_class()and emits one informationalUserWarningper module-qualified class.stream=Nonesuppresses the notice. Only the notice, not backward support or delegation, is removed in v1.0. message_templateandskip_ifsupplied through@deprecatedon a class now reach the proxy.message_templatewas previously dropped on that path.- Non-callable sources now raise a direct
TypeErrorpointing users todeprecated_instance()instead of failing later on__name__. -
Explicit
target=TargetMode.NOTIFYtogether with a mapping still emitsUserWarning, staysNOTIFY, leaves the mapping inert, and is marked misconfigured. This is unchanged from v0.11.0, and aTypeErrorin v1.0. What changed is that an omittedtargetno longer lands here: it auto-resolves instead. Omittargetto infer remapping, or select the matching remap mode explicitly. -
Griffe's
RuntimeDocstringsextension now scopes its docstring-replacement guard to pyDeprecate's own__deprecation_config__metadata (get_deprecation_config(obj) is not None). This replaces a bare truthiness check on__deprecated__. A foreign object decorated only with the stdlib'swarnings.deprecated/typing_extensions.deprecatedpreviously passed that truthy check too. Such an object has a string-valued__deprecated__and no pyDeprecate metadata. It no longer passes the check, since it was never meant to be replaced. -
v0.14 ships
py.typed, so type checkers now read pyDeprecate's own types instead of treating every object asAny. Runtime behavior is unchanged; only checker output moves. Old: DeprecationProxy[New] = deprecated_class(target=New, ...)(Cls)no longer type-checks. A call-formdeprecated_class(...)alias is typed as the class it forwards to (type[New]with a classtarget, otherwise the wrapped class), so drop the annotation.DeprecationProxy[T]remains the annotation fordeprecated_instance()proxies.- Old names accepted only through
args_mapping/attrs_mappingare reported on call-form aliases ascall-arg/attr-defined. The decorator form already did this under mypy. To keep such call sites type-checking during the migration window, choose either approach:- Keep the old names in a legacy class body (decorator form).
- Wrap the alias in
cast(DeprecationProxy[New], ...);isinstanceagainst the alias then stops type-checking.
- Proxy-only attributes such as
__wrapped__and__deprecation_config__are invisible ontype[New]. Read them withget_deprecation_config(Old)orinspect.unwrap(Old). -
Setting
__deprecated__on a deprecated proxy now keeps the marker on the proxy. Deleting it no longer removes the wrapped object's own marker; reading it after deletion raisesAttributeError.copy.copy,copy.deepcopy, andpicklekeep a PEP 702 message written onto the proxy. -
Calls that need no forwarding preserve the caller's positional and keyword argument form. A call that needs no forwarding, rename or extra argument reaches the source exactly as made.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
*args, which stay positional. - A custom stream that raises no longer leaves warning bookkeeping or emission context stuck. On a deprecated proxy, a warning that fails to deliver does not spend the warning budget. A decorated function still spends it.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
- Warnings that reported a pyDeprecate frame now point at the caller. Call-time warnings already named the user's call site. The remaining ones, notably the inner warning of a stacked deprecation chain, now carry the caller's line and module too. A warning filter keyed on
module="deprecate"that matched those warnings no longer does. Those warnings therefore surface, and raise under-W error. Key filters on the calling module instead. - Async proxy warnings are emitted when the underlying awaitable or async iterator is obtained. A later failure or exhaustion during
awaitor__anext__still consumes the warning budget.- If the warning itself fails, a coroutine the wrapped call created is closed. A coroutine the wrapped object holds as an attribute, or is itself, is left usable.
next()on a deprecated proxy now warns before the wrapped iterator advances, so a failed warning consumes no item. Calling the proxy also warns first, as@deprecateddoes. Other synchronous operations still warn only after success.- In-place operators and
defaultdictsubscripts keep their effect if delivery fails.
- A custom
streamis called exactly once, with its signature read before the call. A stream that declares**kwargsreceivesstacklevel=and must accept or drop it. Forward it towarnings.warnorlogging.warning;print(msg, **kwargs)raisesTypeError. Declaredef sink(msg)to receive the message alone. A bare(*args, **kwargs)functools.wrapspass-through is judged by the callable it wraps, also when afunctools.partialbinds it. A stream whose only parameter is namedstacklevelreceives the message alone. skip_ifnow covers item and in-place writes. Withskip_ifactive,proxy[key] = value,del proxy[key]and in-place operators write to the wrapped object. The read-only guard does not apply. A fatal proxy (as_exception=True) raisesDeprecatedErrorbefore a subscript, iteration or mapped attribute read touches the wrapped object.- Deprecated generators warn on the first iteration, not at the call. A deprecated generator function keeps
inspect.isgeneratorfunction. A deprecated async-generator function keepsinspect.isasyncgenfunction, so pytestyieldfixtures run their setup and teardown. The warning, thenum_warnsbudget,skip_if, argument binding and anas_exception/as_exceptions()error now resolve on the firstnext()/__anext__(). A generator that is never iterated never warns. Movepytest.warns()andpytest.raises()around the first iteration, and keepas_exceptions()active at that step. - An empty-string
args_mappingvalue keeps the argument. Under@deprecated,args_mapping={"old_arg": ""}now passesold_argthrough under its old name, asdeprecated_classalways did. A**kwargstarget therefore receives it; onlyNonedrops an argument. Map the argument toNoneif you relied on""dropping it. - Proxies carry only the protocols of the wrapped object or its replacement. A deprecated
dictis no longercallable(), anIterator,os.PathLike,AwaitableorAsyncIterable. A protocol the object disables stays disabled.type(proxy) is _DeprecatedProxyis nowFalse; useisinstance(proxy, DeprecationProxy). The generated proxy subclasses cannot be pickled by reference. - Forwarding to a
classmethodchecks the source's shape at decoration. Any receiver name works (klass,mcs).- These source shapes raise
TypeErrorat decoration:- A source with no leading positional parameter raises the error.
- A source with a later parameter named like the target's receiver raises the error.
- A static or plain source given a non-class first argument raises
TypeErrorbefore warning.
- These source shapes raise
- CLI arguments follow
argparse.- Spellings only the Fire-based CLI accepted exit
2:- A quoted literal such as
--version '"0.10"'exits2. - A list literal in
--excludeexits2; pass comma-separated patterns. - A table in
--min-graceexits2; set it inpyproject.toml. --path=pkgexits2.- Short flags such as
-rexit2. - An empty
--report-json=exits2. - Abbreviated option names exit
2. - Before v0.16, a second positional path exits
2; since v0.16 every subcommand takes several paths.
- A quoted literal such as
- A boolean flag given a value accepts only
true,false,1or0. Use the bare flag or--no-<flag>otherwise.
- Spellings only the Fire-based CLI accepted exit
- CLI exit codes changed.
checkandallexit1on misconfigured targets and inner-order@property @deprecatedwrappers, which used to pass. A scan error or internal error exits3instead of1, and--exit-zeromasks neither2nor3.- These inputs exit
2:- A single
.pyfile exits2. - A directory holding several packages exits
2. - A name that is neither a path nor an importable module exits
2.
- A single
- Check how CI steps treat
2and3.
- These inputs exit
deprecated_module(stream=None)warns at the call. An explicitstream=Nonestill delivers throughwarnings.warnbut emits aFutureWarning. In v1.0 it silences the module warning, and thenum_warnsdefault changes from-1to1. Omitstreamfor today's delivery and passnum_warns=-1to keep a warning on every access.-
DeprecationWrapperInfo.empty_mappingandidentity_mappingwarn withFutureWarning. Reading the deprecated aliases now emitsFutureWarningon every access instead ofDeprecationWarning, and raises under fatal mode. Readempty_args_mappingandidentity_args_mappinginstead. -
read_only=Trueproxies block six more methods.sort,reverse,popitem,difference_update,intersection_updateandsymmetric_difference_updatenow raiseAttributeErrorinstead of changing the wrapped list, dict or set. The guarded names go from 10 to 16, and a custom method with one of these names is blocked too. - A proxy with a callable
targetandargs_mappingshares one warning budget per call.deprecated_classanddeprecated_instanceemit one call-level warning per call instead of one per renamed keyword, and its message names the replacement rather than each renamed keyword. A test that counted or matched one warning per renamed keyword now changes. - Audit reports a function bound under several names under its own public name. When an alias used to sort first, the row and its finding id carried the alias. A name-based allowlist,
--ignorepattern or committed snapshot keyed on that alias needs the function's own name instead.
Coming from v0.10.x🔗
- Update proxy detection.
proxy.__class__reports the wrapped object's type forisinstancetransparency. Usetype(proxy)when you need to detect_DeprecatedProxyitself. - Do not use an instance proxy as the second argument to
isinstance()orissubclass(). This misuse now raisesTypeErrorinstead of returningFalse. Class-alias proxies remain valid there. - Review expiry CI scope.
validate_deprecation_expiry()now defaults toinclude_members=True, so expired methods, constructors, descriptors, and properties can newly fail the gate. Passinclude_members=Falseonly when the old narrower scope is intentional. - Fix invalid
remove_inversions. An unparsableremove_innow emitsUserWarningduring batch expiry instead of being skipped silently. - Fix misspelled CLI flags. Unknown flags now fail instead of being silently ignored.
-
Use named
%fields in custom message templates. Bare%sor%dconversions now raiseValueErrorwhen the decorator is applied. -
@deprecated(target=TargetMode.ATTRS_REMAP)now raisesTypeErrorfor a class source. It already raised for functions.ATTRS_REMAPneeds the class-onlyattrs_mappingkeyword, which the common front door does not expose. A class source therefore previously built a proxy that remapped nothing. Usedeprecated_class(attrs_mapping=...). -
Rename
template_mgstomessage_templateondeprecated(),deprecated_callable(),deprecated_class(), anddeprecated_instance(). The typo remains a warning alias until v1.0; supplying both names raisesTypeError. -
__deprecated__is now a plain PEP 702-conformant message string, not theDeprecationConfigobject. The config object moved to__deprecation_config__.- Code reading
func.__deprecated__.target,.deprecated_in,.args_mapping, or any other config field now gets a plainstr. So does code checkingisinstance(func.__deprecated__, DeprecationConfig). It either raisesAttributeErroror evaluatesFalse. - Replace direct reads with the public
get_deprecation_config(obj)helper. It also falls back to a legacy__deprecated__-as-config layout for objects built by a pyDeprecate release before v0.13. This affects every wrapper kind — functions, methods, class proxies (deprecated_class), instance proxies (deprecated_instance), and modules (deprecated_module).
- Code reading
-
A function
deprecated_instancestored as a class attribute now binds like a method, and only plain functions do.- Instance access passes
selfto the wrapped function; usestaticmethod(deprecated_instance(...))for static-style access. - A
functools.partial, bound method, builtin or Cython binding callable is served unbound and silent instead. A deprecatedpartialclass attribute is therefore no longer bound by Python.
- Instance access passes
-
functools.partial,partialmethodandsingledispatchmethodsources now raiseTypeErrorat decoration. This includes a named partial (given a__name__throughfunctools.update_wrapper) that 0.14 accepted. Wrap the object in a plaindefthat calls it and decorate thatdef. -
An operand after
--is always a path, never the legacy positional version.pydeprecate expiry -- src/pkg 2.0now treats2.0as a second path instead of reading it as the version, and exits2when no such path exists. Pass--version 2.0. - A second positional version on
expiry,allandstatusis deprecated. With two positionals, the second is a path first. It is read as a version only when it names no path or findable module and parses as one; that spelling prints a notice on stderr and stops working in v1.0. Pass--versioninstead; passing both exits2. - The empty
cliextra is removed. Thepydeprecatecommand needs no dependency, so replacepyDeprecate[cli]with the base package, or withpyDeprecate[audit]when you use the audit extras.pip install 'pyDeprecate[cli]'still installs, with pip's warning that the extra does not exist.
repr(),str(), equality, and hashing on a target-forwarding proxy now reflect the active target rather than the deprecated source.- In-place operators such as
proxy += 1rebind the name to the unwrapped result. Later uses are silent; avoid in-place operators if the proxy must retain its warning budget. args_mapping,args_extra, andattrs_mappingare copied at decoration time. Mutating the original dict later no longer changes forwarding behavior.- Constructing an
attrs_mapping-only class proxy is now silent; only access to a listed deprecated attribute warns. - Concurrent calls now respect exactly the configured
num_warnsbudget. Tests that accidentally relied on one warning per racing thread will see fewer warnings. -
Recursive audits can change counts and rows in both directions. They now:
- They deduplicate re-exports.
- They include deprecated private and dunder members.
- They warn and skip submodules that fail to import.
- They ignore unrelated foreign objects that raise during metadata probing.
-
@deprecatednow defaults toTargetMode.AUTO. It resolves at decoration time: a function/class withargs_mappingbecomesARGS_REMAP; a source without a mapping becomes warn-only.AUTOis never stored inDeprecationConfig. Do not pass it explicitly because it exists only as the front-door default. - Existing
@deprecateduse on a class remains supported; no code change or decorator rewrite is required. It permanently delegates todeprecated_class()and emits one informationalUserWarningper module-qualified class.stream=Nonesuppresses the notice. Only the notice, not backward support or delegation, is removed in v1.0. message_templateandskip_ifsupplied through@deprecatedon a class now reach the proxy.message_templatewas previously dropped on that path.- Non-callable sources now raise a direct
TypeErrorpointing users todeprecated_instance()instead of failing later on__name__. -
Explicit
target=TargetMode.NOTIFYtogether with a mapping still emitsUserWarning, staysNOTIFY, leaves the mapping inert, and is marked misconfigured. This is unchanged from v0.11.0, and aTypeErrorin v1.0. What changed is that an omittedtargetno longer lands here: it auto-resolves instead. Omittargetto infer remapping, or select the matching remap mode explicitly. -
Griffe's
RuntimeDocstringsextension now scopes its docstring-replacement guard to pyDeprecate's own__deprecation_config__metadata (get_deprecation_config(obj) is not None). This replaces a bare truthiness check on__deprecated__. A foreign object decorated only with the stdlib'swarnings.deprecated/typing_extensions.deprecatedpreviously passed that truthy check too. Such an object has a string-valued__deprecated__and no pyDeprecate metadata. It no longer passes the check, since it was never meant to be replaced. -
v0.14 ships
py.typed, so type checkers now read pyDeprecate's own types instead of treating every object asAny. Runtime behavior is unchanged; only checker output moves. Old: DeprecationProxy[New] = deprecated_class(target=New, ...)(Cls)no longer type-checks. A call-formdeprecated_class(...)alias is typed as the class it forwards to (type[New]with a classtarget, otherwise the wrapped class), so drop the annotation.DeprecationProxy[T]remains the annotation fordeprecated_instance()proxies.- Old names accepted only through
args_mapping/attrs_mappingare reported on call-form aliases ascall-arg/attr-defined. The decorator form already did this under mypy. To keep such call sites type-checking during the migration window, choose either approach:- Keep the old names in a legacy class body (decorator form).
- Wrap the alias in
cast(DeprecationProxy[New], ...);isinstanceagainst the alias then stops type-checking.
- Proxy-only attributes such as
__wrapped__and__deprecation_config__are invisible ontype[New]. Read them withget_deprecation_config(Old)orinspect.unwrap(Old). -
Setting
__deprecated__on a deprecated proxy now keeps the marker on the proxy. Deleting it no longer removes the wrapped object's own marker; reading it after deletion raisesAttributeError.copy.copy,copy.deepcopy, andpicklekeep a PEP 702 message written onto the proxy. -
Calls that need no forwarding preserve the caller's positional and keyword argument form. A call that needs no forwarding, rename or extra argument reaches the source exactly as made.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
*args, which stay positional. - A custom stream that raises no longer leaves warning bookkeeping or emission context stuck. On a deprecated proxy, a warning that fails to deliver does not spend the warning budget. A decorated function still spends it.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
- Warnings that reported a pyDeprecate frame now point at the caller. Call-time warnings already named the user's call site. The remaining ones, notably the inner warning of a stacked deprecation chain, now carry the caller's line and module too. A warning filter keyed on
module="deprecate"that matched those warnings no longer does. Those warnings therefore surface, and raise under-W error. Key filters on the calling module instead. - Async proxy warnings are emitted when the underlying awaitable or async iterator is obtained. A later failure or exhaustion during
awaitor__anext__still consumes the warning budget.- If the warning itself fails, a coroutine the wrapped call created is closed. A coroutine the wrapped object holds as an attribute, or is itself, is left usable.
next()on a deprecated proxy now warns before the wrapped iterator advances, so a failed warning consumes no item. Calling the proxy also warns first, as@deprecateddoes. Other synchronous operations still warn only after success.- In-place operators and
defaultdictsubscripts keep their effect if delivery fails.
- A custom
streamis called exactly once, with its signature read before the call. A stream that declares**kwargsreceivesstacklevel=and must accept or drop it. Forward it towarnings.warnorlogging.warning;print(msg, **kwargs)raisesTypeError. Declaredef sink(msg)to receive the message alone. A bare(*args, **kwargs)functools.wrapspass-through is judged by the callable it wraps, also when afunctools.partialbinds it. A stream whose only parameter is namedstacklevelreceives the message alone. skip_ifnow covers item and in-place writes. Withskip_ifactive,proxy[key] = value,del proxy[key]and in-place operators write to the wrapped object. The read-only guard does not apply. A fatal proxy (as_exception=True) raisesDeprecatedErrorbefore a subscript, iteration or mapped attribute read touches the wrapped object.- Deprecated generators warn on the first iteration, not at the call. A deprecated generator function keeps
inspect.isgeneratorfunction. A deprecated async-generator function keepsinspect.isasyncgenfunction, so pytestyieldfixtures run their setup and teardown. The warning, thenum_warnsbudget,skip_if, argument binding and anas_exception/as_exceptions()error now resolve on the firstnext()/__anext__(). A generator that is never iterated never warns. Movepytest.warns()andpytest.raises()around the first iteration, and keepas_exceptions()active at that step. - An empty-string
args_mappingvalue keeps the argument. Under@deprecated,args_mapping={"old_arg": ""}now passesold_argthrough under its old name, asdeprecated_classalways did. A**kwargstarget therefore receives it; onlyNonedrops an argument. Map the argument toNoneif you relied on""dropping it. - Proxies carry only the protocols of the wrapped object or its replacement. A deprecated
dictis no longercallable(), anIterator,os.PathLike,AwaitableorAsyncIterable. A protocol the object disables stays disabled.type(proxy) is _DeprecatedProxyis nowFalse; useisinstance(proxy, DeprecationProxy). The generated proxy subclasses cannot be pickled by reference. - Forwarding to a
classmethodchecks the source's shape at decoration. Any receiver name works (klass,mcs).- These source shapes raise
TypeErrorat decoration:- A source with no leading positional parameter raises the error.
- A source with a later parameter named like the target's receiver raises the error.
- A static or plain source given a non-class first argument raises
TypeErrorbefore warning.
- These source shapes raise
- CLI arguments follow
argparse.- Spellings only the Fire-based CLI accepted exit
2:- A quoted literal such as
--version '"0.10"'exits2. - A list literal in
--excludeexits2; pass comma-separated patterns. - A table in
--min-graceexits2; set it inpyproject.toml. --path=pkgexits2.- Short flags such as
-rexit2. - An empty
--report-json=exits2. - Abbreviated option names exit
2. - Before v0.16, a second positional path exits
2; since v0.16 every subcommand takes several paths.
- A quoted literal such as
- A boolean flag given a value accepts only
true,false,1or0. Use the bare flag or--no-<flag>otherwise.
- Spellings only the Fire-based CLI accepted exit
- CLI exit codes changed.
checkandallexit1on misconfigured targets and inner-order@property @deprecatedwrappers, which used to pass. A scan error or internal error exits3instead of1, and--exit-zeromasks neither2nor3.- These inputs exit
2:- A single
.pyfile exits2. - A directory holding several packages exits
2. - A name that is neither a path nor an importable module exits
2.
- A single
- Check how CI steps treat
2and3.
- These inputs exit
deprecated_module(stream=None)warns at the call. An explicitstream=Nonestill delivers throughwarnings.warnbut emits aFutureWarning. In v1.0 it silences the module warning, and thenum_warnsdefault changes from-1to1. Omitstreamfor today's delivery and passnum_warns=-1to keep a warning on every access.-
DeprecationWrapperInfo.empty_mappingandidentity_mappingwarn withFutureWarning. Reading the deprecated aliases now emitsFutureWarningon every access instead ofDeprecationWarning, and raises under fatal mode. Readempty_args_mappingandidentity_args_mappinginstead. -
read_only=Trueproxies block six more methods.sort,reverse,popitem,difference_update,intersection_updateandsymmetric_difference_updatenow raiseAttributeErrorinstead of changing the wrapped list, dict or set. The guarded names go from 10 to 16, and a custom method with one of these names is blocked too. - A proxy with a callable
targetandargs_mappingshares one warning budget per call.deprecated_classanddeprecated_instanceemit one call-level warning per call instead of one per renamed keyword, and its message names the replacement rather than each renamed keyword. A test that counted or matched one warning per renamed keyword now changes. - Audit reports a function bound under several names under its own public name. When an alias used to sort first, the row and its finding id carried the alias. A name-based allowlist,
--ignorepattern or committed snapshot keyed on that alias needs the function's own name instead.
Coming from v0.9.x🔗
-
Outer-order deprecated properties now warn on read, write, and delete. Under
filterwarnings=error::FutureWarning, a setter or deleter that was previously silent now raises. If only reads should warn, keep inner order (@propertyoutside@deprecated) or decorate onlyfget. -
Update proxy detection.
proxy.__class__reports the wrapped object's type forisinstancetransparency. Usetype(proxy)when you need to detect_DeprecatedProxyitself. - Do not use an instance proxy as the second argument to
isinstance()orissubclass(). This misuse now raisesTypeErrorinstead of returningFalse. Class-alias proxies remain valid there. - Review expiry CI scope.
validate_deprecation_expiry()now defaults toinclude_members=True, so expired methods, constructors, descriptors, and properties can newly fail the gate. Passinclude_members=Falseonly when the old narrower scope is intentional. - Fix invalid
remove_inversions. An unparsableremove_innow emitsUserWarningduring batch expiry instead of being skipped silently. - Fix misspelled CLI flags. Unknown flags now fail instead of being silently ignored.
-
Use named
%fields in custom message templates. Bare%sor%dconversions now raiseValueErrorwhen the decorator is applied. -
@deprecated(target=TargetMode.ATTRS_REMAP)now raisesTypeErrorfor a class source. It already raised for functions.ATTRS_REMAPneeds the class-onlyattrs_mappingkeyword, which the common front door does not expose. A class source therefore previously built a proxy that remapped nothing. Usedeprecated_class(attrs_mapping=...). -
Rename
template_mgstomessage_templateondeprecated(),deprecated_callable(),deprecated_class(), anddeprecated_instance(). The typo remains a warning alias until v1.0; supplying both names raisesTypeError. -
__deprecated__is now a plain PEP 702-conformant message string, not theDeprecationConfigobject. The config object moved to__deprecation_config__.- Code reading
func.__deprecated__.target,.deprecated_in,.args_mapping, or any other config field now gets a plainstr. So does code checkingisinstance(func.__deprecated__, DeprecationConfig). It either raisesAttributeErroror evaluatesFalse. - Replace direct reads with the public
get_deprecation_config(obj)helper. It also falls back to a legacy__deprecated__-as-config layout for objects built by a pyDeprecate release before v0.13. This affects every wrapper kind — functions, methods, class proxies (deprecated_class), instance proxies (deprecated_instance), and modules (deprecated_module).
- Code reading
-
A function
deprecated_instancestored as a class attribute now binds like a method, and only plain functions do.- Instance access passes
selfto the wrapped function; usestaticmethod(deprecated_instance(...))for static-style access. - A
functools.partial, bound method, builtin or Cython binding callable is served unbound and silent instead. A deprecatedpartialclass attribute is therefore no longer bound by Python.
- Instance access passes
-
functools.partial,partialmethodandsingledispatchmethodsources now raiseTypeErrorat decoration. This includes a named partial (given a__name__throughfunctools.update_wrapper) that 0.14 accepted. Wrap the object in a plaindefthat calls it and decorate thatdef. -
An operand after
--is always a path, never the legacy positional version.pydeprecate expiry -- src/pkg 2.0now treats2.0as a second path instead of reading it as the version, and exits2when no such path exists. Pass--version 2.0. - A second positional version on
expiry,allandstatusis deprecated. With two positionals, the second is a path first. It is read as a version only when it names no path or findable module and parses as one; that spelling prints a notice on stderr and stops working in v1.0. Pass--versioninstead; passing both exits2. - The empty
cliextra is removed. Thepydeprecatecommand needs no dependency, so replacepyDeprecate[cli]with the base package, or withpyDeprecate[audit]when you use the audit extras.pip install 'pyDeprecate[cli]'still installs, with pip's warning that the extra does not exist.
- When a caller supplies both deprecated and replacement keyword names, the explicit replacement value now wins regardless of call-site order.
-
Circular callable-target chains now raise a named
RuntimeErrorinstead of ending inRecursionError. -
repr(),str(), equality, and hashing on a target-forwarding proxy now reflect the active target rather than the deprecated source. - In-place operators such as
proxy += 1rebind the name to the unwrapped result. Later uses are silent; avoid in-place operators if the proxy must retain its warning budget. args_mapping,args_extra, andattrs_mappingare copied at decoration time. Mutating the original dict later no longer changes forwarding behavior.- Constructing an
attrs_mapping-only class proxy is now silent; only access to a listed deprecated attribute warns. - Concurrent calls now respect exactly the configured
num_warnsbudget. Tests that accidentally relied on one warning per racing thread will see fewer warnings. -
Recursive audits can change counts and rows in both directions. They now:
- They deduplicate re-exports.
- They include deprecated private and dunder members.
- They warn and skip submodules that fail to import.
- They ignore unrelated foreign objects that raise during metadata probing.
-
@deprecatednow defaults toTargetMode.AUTO. It resolves at decoration time: a function/class withargs_mappingbecomesARGS_REMAP; a source without a mapping becomes warn-only.AUTOis never stored inDeprecationConfig. Do not pass it explicitly because it exists only as the front-door default. - Existing
@deprecateduse on a class remains supported; no code change or decorator rewrite is required. It permanently delegates todeprecated_class()and emits one informationalUserWarningper module-qualified class.stream=Nonesuppresses the notice. Only the notice, not backward support or delegation, is removed in v1.0. message_templateandskip_ifsupplied through@deprecatedon a class now reach the proxy.message_templatewas previously dropped on that path.- Non-callable sources now raise a direct
TypeErrorpointing users todeprecated_instance()instead of failing later on__name__. -
Explicit
target=TargetMode.NOTIFYtogether with a mapping still emitsUserWarning, staysNOTIFY, leaves the mapping inert, and is marked misconfigured. This is unchanged from v0.11.0, and aTypeErrorin v1.0. What changed is that an omittedtargetno longer lands here: it auto-resolves instead. Omittargetto infer remapping, or select the matching remap mode explicitly. -
Griffe's
RuntimeDocstringsextension now scopes its docstring-replacement guard to pyDeprecate's own__deprecation_config__metadata (get_deprecation_config(obj) is not None). This replaces a bare truthiness check on__deprecated__. A foreign object decorated only with the stdlib'swarnings.deprecated/typing_extensions.deprecatedpreviously passed that truthy check too. Such an object has a string-valued__deprecated__and no pyDeprecate metadata. It no longer passes the check, since it was never meant to be replaced. -
v0.14 ships
py.typed, so type checkers now read pyDeprecate's own types instead of treating every object asAny. Runtime behavior is unchanged; only checker output moves. Old: DeprecationProxy[New] = deprecated_class(target=New, ...)(Cls)no longer type-checks. A call-formdeprecated_class(...)alias is typed as the class it forwards to (type[New]with a classtarget, otherwise the wrapped class), so drop the annotation.DeprecationProxy[T]remains the annotation fordeprecated_instance()proxies.- Old names accepted only through
args_mapping/attrs_mappingare reported on call-form aliases ascall-arg/attr-defined. The decorator form already did this under mypy. To keep such call sites type-checking during the migration window, choose either approach:- Keep the old names in a legacy class body (decorator form).
- Wrap the alias in
cast(DeprecationProxy[New], ...);isinstanceagainst the alias then stops type-checking.
- Proxy-only attributes such as
__wrapped__and__deprecation_config__are invisible ontype[New]. Read them withget_deprecation_config(Old)orinspect.unwrap(Old). -
Setting
__deprecated__on a deprecated proxy now keeps the marker on the proxy. Deleting it no longer removes the wrapped object's own marker; reading it after deletion raisesAttributeError.copy.copy,copy.deepcopy, andpicklekeep a PEP 702 message written onto the proxy. -
Calls that need no forwarding preserve the caller's positional and keyword argument form. A call that needs no forwarding, rename or extra argument reaches the source exactly as made.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
*args, which stay positional. - A custom stream that raises no longer leaves warning bookkeeping or emission context stuck. On a deprecated proxy, a warning that fails to deliver does not spend the warning budget. A decorated function still spends it.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
- Warnings that reported a pyDeprecate frame now point at the caller. Call-time warnings already named the user's call site. The remaining ones, notably the inner warning of a stacked deprecation chain, now carry the caller's line and module too. A warning filter keyed on
module="deprecate"that matched those warnings no longer does. Those warnings therefore surface, and raise under-W error. Key filters on the calling module instead. - Async proxy warnings are emitted when the underlying awaitable or async iterator is obtained. A later failure or exhaustion during
awaitor__anext__still consumes the warning budget.- If the warning itself fails, a coroutine the wrapped call created is closed. A coroutine the wrapped object holds as an attribute, or is itself, is left usable.
next()on a deprecated proxy now warns before the wrapped iterator advances, so a failed warning consumes no item. Calling the proxy also warns first, as@deprecateddoes. Other synchronous operations still warn only after success.- In-place operators and
defaultdictsubscripts keep their effect if delivery fails.
- A custom
streamis called exactly once, with its signature read before the call. A stream that declares**kwargsreceivesstacklevel=and must accept or drop it. Forward it towarnings.warnorlogging.warning;print(msg, **kwargs)raisesTypeError. Declaredef sink(msg)to receive the message alone. A bare(*args, **kwargs)functools.wrapspass-through is judged by the callable it wraps, also when afunctools.partialbinds it. A stream whose only parameter is namedstacklevelreceives the message alone. skip_ifnow covers item and in-place writes. Withskip_ifactive,proxy[key] = value,del proxy[key]and in-place operators write to the wrapped object. The read-only guard does not apply. A fatal proxy (as_exception=True) raisesDeprecatedErrorbefore a subscript, iteration or mapped attribute read touches the wrapped object.- Deprecated generators warn on the first iteration, not at the call. A deprecated generator function keeps
inspect.isgeneratorfunction. A deprecated async-generator function keepsinspect.isasyncgenfunction, so pytestyieldfixtures run their setup and teardown. The warning, thenum_warnsbudget,skip_if, argument binding and anas_exception/as_exceptions()error now resolve on the firstnext()/__anext__(). A generator that is never iterated never warns. Movepytest.warns()andpytest.raises()around the first iteration, and keepas_exceptions()active at that step. - An empty-string
args_mappingvalue keeps the argument. Under@deprecated,args_mapping={"old_arg": ""}now passesold_argthrough under its old name, asdeprecated_classalways did. A**kwargstarget therefore receives it; onlyNonedrops an argument. Map the argument toNoneif you relied on""dropping it. - Proxies carry only the protocols of the wrapped object or its replacement. A deprecated
dictis no longercallable(), anIterator,os.PathLike,AwaitableorAsyncIterable. A protocol the object disables stays disabled.type(proxy) is _DeprecatedProxyis nowFalse; useisinstance(proxy, DeprecationProxy). The generated proxy subclasses cannot be pickled by reference. - Forwarding to a
classmethodchecks the source's shape at decoration. Any receiver name works (klass,mcs).- These source shapes raise
TypeErrorat decoration:- A source with no leading positional parameter raises the error.
- A source with a later parameter named like the target's receiver raises the error.
- A static or plain source given a non-class first argument raises
TypeErrorbefore warning.
- These source shapes raise
- CLI arguments follow
argparse.- Spellings only the Fire-based CLI accepted exit
2:- A quoted literal such as
--version '"0.10"'exits2. - A list literal in
--excludeexits2; pass comma-separated patterns. - A table in
--min-graceexits2; set it inpyproject.toml. --path=pkgexits2.- Short flags such as
-rexit2. - An empty
--report-json=exits2. - Abbreviated option names exit
2. - Before v0.16, a second positional path exits
2; since v0.16 every subcommand takes several paths.
- A quoted literal such as
- A boolean flag given a value accepts only
true,false,1or0. Use the bare flag or--no-<flag>otherwise.
- Spellings only the Fire-based CLI accepted exit
- CLI exit codes changed.
checkandallexit1on misconfigured targets and inner-order@property @deprecatedwrappers, which used to pass. A scan error or internal error exits3instead of1, and--exit-zeromasks neither2nor3.- These inputs exit
2:- A single
.pyfile exits2. - A directory holding several packages exits
2. - A name that is neither a path nor an importable module exits
2.
- A single
- Check how CI steps treat
2and3.
- These inputs exit
deprecated_module(stream=None)warns at the call. An explicitstream=Nonestill delivers throughwarnings.warnbut emits aFutureWarning. In v1.0 it silences the module warning, and thenum_warnsdefault changes from-1to1. Omitstreamfor today's delivery and passnum_warns=-1to keep a warning on every access.-
DeprecationWrapperInfo.empty_mappingandidentity_mappingwarn withFutureWarning. Reading the deprecated aliases now emitsFutureWarningon every access instead ofDeprecationWarning, and raises under fatal mode. Readempty_args_mappingandidentity_args_mappinginstead. -
read_only=Trueproxies block six more methods.sort,reverse,popitem,difference_update,intersection_updateandsymmetric_difference_updatenow raiseAttributeErrorinstead of changing the wrapped list, dict or set. The guarded names go from 10 to 16, and a custom method with one of these names is blocked too. - A proxy with a callable
targetandargs_mappingshares one warning budget per call.deprecated_classanddeprecated_instanceemit one call-level warning per call instead of one per renamed keyword, and its message names the replacement rather than each renamed keyword. A test that counted or matched one warning per renamed keyword now changes. - Audit reports a function bound under several names under its own public name. When an alias used to sort first, the row and its finding id carried the alias. A name-based allowlist,
--ignorepattern or committed snapshot keyed on that alias needs the function's own name instead.
Coming from v0.8.x🔗
- Rename the CLI flag
--skip_errorsto--exit-zeroin everycheck,expiry,chains, andallcommand. The old flag is rejected.--exit_zeroremains an underscore alias, but the dashed spelling is canonical. -
Fix unsupported stacked decorators. Six shapes, including callable-over-callable, now emit
UserWarningat decoration time and becomeTypeErrorin v1.0. The supported lifecycle stack is outerARGS_REMAPplus innerNOTIFY. -
Outer-order deprecated properties now warn on read, write, and delete. Under
filterwarnings=error::FutureWarning, a setter or deleter that was previously silent now raises. If only reads should warn, keep inner order (@propertyoutside@deprecated) or decorate onlyfget. -
Update proxy detection.
proxy.__class__reports the wrapped object's type forisinstancetransparency. Usetype(proxy)when you need to detect_DeprecatedProxyitself. - Do not use an instance proxy as the second argument to
isinstance()orissubclass(). This misuse now raisesTypeErrorinstead of returningFalse. Class-alias proxies remain valid there. - Review expiry CI scope.
validate_deprecation_expiry()now defaults toinclude_members=True, so expired methods, constructors, descriptors, and properties can newly fail the gate. Passinclude_members=Falseonly when the old narrower scope is intentional. - Fix invalid
remove_inversions. An unparsableremove_innow emitsUserWarningduring batch expiry instead of being skipped silently. - Fix misspelled CLI flags. Unknown flags now fail instead of being silently ignored.
-
Use named
%fields in custom message templates. Bare%sor%dconversions now raiseValueErrorwhen the decorator is applied. -
@deprecated(target=TargetMode.ATTRS_REMAP)now raisesTypeErrorfor a class source. It already raised for functions.ATTRS_REMAPneeds the class-onlyattrs_mappingkeyword, which the common front door does not expose. A class source therefore previously built a proxy that remapped nothing. Usedeprecated_class(attrs_mapping=...). -
Rename
template_mgstomessage_templateondeprecated(),deprecated_callable(),deprecated_class(), anddeprecated_instance(). The typo remains a warning alias until v1.0; supplying both names raisesTypeError. -
__deprecated__is now a plain PEP 702-conformant message string, not theDeprecationConfigobject. The config object moved to__deprecation_config__.- Code reading
func.__deprecated__.target,.deprecated_in,.args_mapping, or any other config field now gets a plainstr. So does code checkingisinstance(func.__deprecated__, DeprecationConfig). It either raisesAttributeErroror evaluatesFalse. - Replace direct reads with the public
get_deprecation_config(obj)helper. It also falls back to a legacy__deprecated__-as-config layout for objects built by a pyDeprecate release before v0.13. This affects every wrapper kind — functions, methods, class proxies (deprecated_class), instance proxies (deprecated_instance), and modules (deprecated_module).
- Code reading
-
A function
deprecated_instancestored as a class attribute now binds like a method, and only plain functions do.- Instance access passes
selfto the wrapped function; usestaticmethod(deprecated_instance(...))for static-style access. - A
functools.partial, bound method, builtin or Cython binding callable is served unbound and silent instead. A deprecatedpartialclass attribute is therefore no longer bound by Python.
- Instance access passes
-
functools.partial,partialmethodandsingledispatchmethodsources now raiseTypeErrorat decoration. This includes a named partial (given a__name__throughfunctools.update_wrapper) that 0.14 accepted. Wrap the object in a plaindefthat calls it and decorate thatdef. -
An operand after
--is always a path, never the legacy positional version.pydeprecate expiry -- src/pkg 2.0now treats2.0as a second path instead of reading it as the version, and exits2when no such path exists. Pass--version 2.0. - A second positional version on
expiry,allandstatusis deprecated. With two positionals, the second is a path first. It is read as a version only when it names no path or findable module and parses as one; that spelling prints a notice on stderr and stops working in v1.0. Pass--versioninstead; passing both exits2. - The empty
cliextra is removed. Thepydeprecatecommand needs no dependency, so replacepyDeprecate[cli]with the base package, or withpyDeprecate[audit]when you use the audit extras.pip install 'pyDeprecate[cli]'still installs, with pip's warning that the extra does not exist.
- CLI scans suppress only warnings from
deprecate.*; third-party warnings are now visible. CI that treats all warnings as errors may start failing on dependencies imported during a scan. -
Audit code sees the supported
ARGS_REMAP + NOTIFYchain asChainType.STACKED, notChainType.TARGET. -
When a caller supplies both deprecated and replacement keyword names, the explicit replacement value now wins regardless of call-site order.
-
Circular callable-target chains now raise a named
RuntimeErrorinstead of ending inRecursionError. -
repr(),str(), equality, and hashing on a target-forwarding proxy now reflect the active target rather than the deprecated source. - In-place operators such as
proxy += 1rebind the name to the unwrapped result. Later uses are silent; avoid in-place operators if the proxy must retain its warning budget. args_mapping,args_extra, andattrs_mappingare copied at decoration time. Mutating the original dict later no longer changes forwarding behavior.- Constructing an
attrs_mapping-only class proxy is now silent; only access to a listed deprecated attribute warns. - Concurrent calls now respect exactly the configured
num_warnsbudget. Tests that accidentally relied on one warning per racing thread will see fewer warnings. -
Recursive audits can change counts and rows in both directions. They now:
- They deduplicate re-exports.
- They include deprecated private and dunder members.
- They warn and skip submodules that fail to import.
- They ignore unrelated foreign objects that raise during metadata probing.
-
@deprecatednow defaults toTargetMode.AUTO. It resolves at decoration time: a function/class withargs_mappingbecomesARGS_REMAP; a source without a mapping becomes warn-only.AUTOis never stored inDeprecationConfig. Do not pass it explicitly because it exists only as the front-door default. - Existing
@deprecateduse on a class remains supported; no code change or decorator rewrite is required. It permanently delegates todeprecated_class()and emits one informationalUserWarningper module-qualified class.stream=Nonesuppresses the notice. Only the notice, not backward support or delegation, is removed in v1.0. message_templateandskip_ifsupplied through@deprecatedon a class now reach the proxy.message_templatewas previously dropped on that path.- Non-callable sources now raise a direct
TypeErrorpointing users todeprecated_instance()instead of failing later on__name__. -
Explicit
target=TargetMode.NOTIFYtogether with a mapping still emitsUserWarning, staysNOTIFY, leaves the mapping inert, and is marked misconfigured. This is unchanged from v0.11.0, and aTypeErrorin v1.0. What changed is that an omittedtargetno longer lands here: it auto-resolves instead. Omittargetto infer remapping, or select the matching remap mode explicitly. -
Griffe's
RuntimeDocstringsextension now scopes its docstring-replacement guard to pyDeprecate's own__deprecation_config__metadata (get_deprecation_config(obj) is not None). This replaces a bare truthiness check on__deprecated__. A foreign object decorated only with the stdlib'swarnings.deprecated/typing_extensions.deprecatedpreviously passed that truthy check too. Such an object has a string-valued__deprecated__and no pyDeprecate metadata. It no longer passes the check, since it was never meant to be replaced. -
v0.14 ships
py.typed, so type checkers now read pyDeprecate's own types instead of treating every object asAny. Runtime behavior is unchanged; only checker output moves. Old: DeprecationProxy[New] = deprecated_class(target=New, ...)(Cls)no longer type-checks. A call-formdeprecated_class(...)alias is typed as the class it forwards to (type[New]with a classtarget, otherwise the wrapped class), so drop the annotation.DeprecationProxy[T]remains the annotation fordeprecated_instance()proxies.- Old names accepted only through
args_mapping/attrs_mappingare reported on call-form aliases ascall-arg/attr-defined. The decorator form already did this under mypy. To keep such call sites type-checking during the migration window, choose either approach:- Keep the old names in a legacy class body (decorator form).
- Wrap the alias in
cast(DeprecationProxy[New], ...);isinstanceagainst the alias then stops type-checking.
- Proxy-only attributes such as
__wrapped__and__deprecation_config__are invisible ontype[New]. Read them withget_deprecation_config(Old)orinspect.unwrap(Old). -
Setting
__deprecated__on a deprecated proxy now keeps the marker on the proxy. Deleting it no longer removes the wrapped object's own marker; reading it after deletion raisesAttributeError.copy.copy,copy.deepcopy, andpicklekeep a PEP 702 message written onto the proxy. -
Calls that need no forwarding preserve the caller's positional and keyword argument form. A call that needs no forwarding, rename or extra argument reaches the source exactly as made.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
*args, which stay positional. - A custom stream that raises no longer leaves warning bookkeeping or emission context stuck. On a deprecated proxy, a warning that fails to deliver does not spend the warning budget. A decorated function still spends it.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
- Warnings that reported a pyDeprecate frame now point at the caller. Call-time warnings already named the user's call site. The remaining ones, notably the inner warning of a stacked deprecation chain, now carry the caller's line and module too. A warning filter keyed on
module="deprecate"that matched those warnings no longer does. Those warnings therefore surface, and raise under-W error. Key filters on the calling module instead. - Async proxy warnings are emitted when the underlying awaitable or async iterator is obtained. A later failure or exhaustion during
awaitor__anext__still consumes the warning budget.- If the warning itself fails, a coroutine the wrapped call created is closed. A coroutine the wrapped object holds as an attribute, or is itself, is left usable.
next()on a deprecated proxy now warns before the wrapped iterator advances, so a failed warning consumes no item. Calling the proxy also warns first, as@deprecateddoes. Other synchronous operations still warn only after success.- In-place operators and
defaultdictsubscripts keep their effect if delivery fails.
- A custom
streamis called exactly once, with its signature read before the call. A stream that declares**kwargsreceivesstacklevel=and must accept or drop it. Forward it towarnings.warnorlogging.warning;print(msg, **kwargs)raisesTypeError. Declaredef sink(msg)to receive the message alone. A bare(*args, **kwargs)functools.wrapspass-through is judged by the callable it wraps, also when afunctools.partialbinds it. A stream whose only parameter is namedstacklevelreceives the message alone. skip_ifnow covers item and in-place writes. Withskip_ifactive,proxy[key] = value,del proxy[key]and in-place operators write to the wrapped object. The read-only guard does not apply. A fatal proxy (as_exception=True) raisesDeprecatedErrorbefore a subscript, iteration or mapped attribute read touches the wrapped object.- Deprecated generators warn on the first iteration, not at the call. A deprecated generator function keeps
inspect.isgeneratorfunction. A deprecated async-generator function keepsinspect.isasyncgenfunction, so pytestyieldfixtures run their setup and teardown. The warning, thenum_warnsbudget,skip_if, argument binding and anas_exception/as_exceptions()error now resolve on the firstnext()/__anext__(). A generator that is never iterated never warns. Movepytest.warns()andpytest.raises()around the first iteration, and keepas_exceptions()active at that step. - An empty-string
args_mappingvalue keeps the argument. Under@deprecated,args_mapping={"old_arg": ""}now passesold_argthrough under its old name, asdeprecated_classalways did. A**kwargstarget therefore receives it; onlyNonedrops an argument. Map the argument toNoneif you relied on""dropping it. - Proxies carry only the protocols of the wrapped object or its replacement. A deprecated
dictis no longercallable(), anIterator,os.PathLike,AwaitableorAsyncIterable. A protocol the object disables stays disabled.type(proxy) is _DeprecatedProxyis nowFalse; useisinstance(proxy, DeprecationProxy). The generated proxy subclasses cannot be pickled by reference. - Forwarding to a
classmethodchecks the source's shape at decoration. Any receiver name works (klass,mcs).- These source shapes raise
TypeErrorat decoration:- A source with no leading positional parameter raises the error.
- A source with a later parameter named like the target's receiver raises the error.
- A static or plain source given a non-class first argument raises
TypeErrorbefore warning.
- These source shapes raise
- CLI arguments follow
argparse.- Spellings only the Fire-based CLI accepted exit
2:- A quoted literal such as
--version '"0.10"'exits2. - A list literal in
--excludeexits2; pass comma-separated patterns. - A table in
--min-graceexits2; set it inpyproject.toml. --path=pkgexits2.- Short flags such as
-rexit2. - An empty
--report-json=exits2. - Abbreviated option names exit
2. - Before v0.16, a second positional path exits
2; since v0.16 every subcommand takes several paths.
- A quoted literal such as
- A boolean flag given a value accepts only
true,false,1or0. Use the bare flag or--no-<flag>otherwise.
- Spellings only the Fire-based CLI accepted exit
- CLI exit codes changed.
checkandallexit1on misconfigured targets and inner-order@property @deprecatedwrappers, which used to pass. A scan error or internal error exits3instead of1, and--exit-zeromasks neither2nor3.- These inputs exit
2:- A single
.pyfile exits2. - A directory holding several packages exits
2. - A name that is neither a path nor an importable module exits
2.
- A single
- Check how CI steps treat
2and3.
- These inputs exit
deprecated_module(stream=None)warns at the call. An explicitstream=Nonestill delivers throughwarnings.warnbut emits aFutureWarning. In v1.0 it silences the module warning, and thenum_warnsdefault changes from-1to1. Omitstreamfor today's delivery and passnum_warns=-1to keep a warning on every access.-
DeprecationWrapperInfo.empty_mappingandidentity_mappingwarn withFutureWarning. Reading the deprecated aliases now emitsFutureWarningon every access instead ofDeprecationWarning, and raises under fatal mode. Readempty_args_mappingandidentity_args_mappinginstead. -
read_only=Trueproxies block six more methods.sort,reverse,popitem,difference_update,intersection_updateandsymmetric_difference_updatenow raiseAttributeErrorinstead of changing the wrapped list, dict or set. The guarded names go from 10 to 16, and a custom method with one of these names is blocked too. - A proxy with a callable
targetandargs_mappingshares one warning budget per call.deprecated_classanddeprecated_instanceemit one call-level warning per call instead of one per renamed keyword, and its message names the replacement rather than each renamed keyword. A test that counted or matched one warning per renamed keyword now changes. - Audit reports a function bound under several names under its own public name. When an alias used to sort first, the row and its finding id carried the alias. A name-based allowlist,
--ignorepattern or committed snapshot keyed on that alias needs the function's own name instead.
Coming from v0.7.x🔗
- Replace
target=NonewithTargetMode.NOTIFYor omittargetfor a warn-only decorator. - Replace
target=TruewithTargetMode.ARGS_REMAP. - Replace
DeprecationWrapperInfo.empty_mappingwithempty_args_mapping, andidentity_mappingwithidentity_args_mapping. The old properties warn and are removed in v1.0. - If code inspects
wrapper.__deprecated__.target, compare with aTargetMode, callable, orNone.DeprecationConfig.targetstores a normalized value, never legacyTrueorFalse. -
Update external documentation bookmarks from flat paths such as
/pyDeprecate/troubleshooting.htmlto the versioned/pyDeprecate/stable/troubleshooting.htmllayout. -
Rename the CLI flag
--skip_errorsto--exit-zeroin everycheck,expiry,chains, andallcommand. The old flag is rejected.--exit_zeroremains an underscore alias, but the dashed spelling is canonical. -
Fix unsupported stacked decorators. Six shapes, including callable-over-callable, now emit
UserWarningat decoration time and becomeTypeErrorin v1.0. The supported lifecycle stack is outerARGS_REMAPplus innerNOTIFY. -
Outer-order deprecated properties now warn on read, write, and delete. Under
filterwarnings=error::FutureWarning, a setter or deleter that was previously silent now raises. If only reads should warn, keep inner order (@propertyoutside@deprecated) or decorate onlyfget. -
Update proxy detection.
proxy.__class__reports the wrapped object's type forisinstancetransparency. Usetype(proxy)when you need to detect_DeprecatedProxyitself. - Do not use an instance proxy as the second argument to
isinstance()orissubclass(). This misuse now raisesTypeErrorinstead of returningFalse. Class-alias proxies remain valid there. - Review expiry CI scope.
validate_deprecation_expiry()now defaults toinclude_members=True, so expired methods, constructors, descriptors, and properties can newly fail the gate. Passinclude_members=Falseonly when the old narrower scope is intentional. - Fix invalid
remove_inversions. An unparsableremove_innow emitsUserWarningduring batch expiry instead of being skipped silently. - Fix misspelled CLI flags. Unknown flags now fail instead of being silently ignored.
-
Use named
%fields in custom message templates. Bare%sor%dconversions now raiseValueErrorwhen the decorator is applied. -
@deprecated(target=TargetMode.ATTRS_REMAP)now raisesTypeErrorfor a class source. It already raised for functions.ATTRS_REMAPneeds the class-onlyattrs_mappingkeyword, which the common front door does not expose. A class source therefore previously built a proxy that remapped nothing. Usedeprecated_class(attrs_mapping=...). -
Rename
template_mgstomessage_templateondeprecated(),deprecated_callable(),deprecated_class(), anddeprecated_instance(). The typo remains a warning alias until v1.0; supplying both names raisesTypeError. -
__deprecated__is now a plain PEP 702-conformant message string, not theDeprecationConfigobject. The config object moved to__deprecation_config__.- Code reading
func.__deprecated__.target,.deprecated_in,.args_mapping, or any other config field now gets a plainstr. So does code checkingisinstance(func.__deprecated__, DeprecationConfig). It either raisesAttributeErroror evaluatesFalse. - Replace direct reads with the public
get_deprecation_config(obj)helper. It also falls back to a legacy__deprecated__-as-config layout for objects built by a pyDeprecate release before v0.13. This affects every wrapper kind — functions, methods, class proxies (deprecated_class), instance proxies (deprecated_instance), and modules (deprecated_module).
- Code reading
-
A function
deprecated_instancestored as a class attribute now binds like a method, and only plain functions do.- Instance access passes
selfto the wrapped function; usestaticmethod(deprecated_instance(...))for static-style access. - A
functools.partial, bound method, builtin or Cython binding callable is served unbound and silent instead. A deprecatedpartialclass attribute is therefore no longer bound by Python.
- Instance access passes
-
functools.partial,partialmethodandsingledispatchmethodsources now raiseTypeErrorat decoration. This includes a named partial (given a__name__throughfunctools.update_wrapper) that 0.14 accepted. Wrap the object in a plaindefthat calls it and decorate thatdef. -
An operand after
--is always a path, never the legacy positional version.pydeprecate expiry -- src/pkg 2.0now treats2.0as a second path instead of reading it as the version, and exits2when no such path exists. Pass--version 2.0. - A second positional version on
expiry,allandstatusis deprecated. With two positionals, the second is a path first. It is read as a version only when it names no path or findable module and parses as one; that spelling prints a notice on stderr and stops working in v1.0. Pass--versioninstead; passing both exits2. - The empty
cliextra is removed. Thepydeprecatecommand needs no dependency, so replacepyDeprecate[cli]with the base package, or withpyDeprecate[audit]when you use the audit extras.pip install 'pyDeprecate[cli]'still installs, with pip's warning that the extra does not exist.
- Omitting
deprecated_inon a function or method emitsUserWarningat decoration time. Add the version as part of every deprecation lifecycle. ARGS_REMAPwithoutargs_mapping,NOTIFYwithargs_mappingorargs_extra, and invalidtarget=Falsenow warn immediately. These are migration failures, not harmless diagnostics; correct them before v1.0.-
Omitting
targetis the canonical warn-only form. Its v0.12 default isTargetMode.AUTO, which resolves toNOTIFYwhen no mapping is present, so the user-visible result is unchanged. -
CLI scans suppress only warnings from
deprecate.*; third-party warnings are now visible. CI that treats all warnings as errors may start failing on dependencies imported during a scan. -
Audit code sees the supported
ARGS_REMAP + NOTIFYchain asChainType.STACKED, notChainType.TARGET. -
When a caller supplies both deprecated and replacement keyword names, the explicit replacement value now wins regardless of call-site order.
-
Circular callable-target chains now raise a named
RuntimeErrorinstead of ending inRecursionError. -
repr(),str(), equality, and hashing on a target-forwarding proxy now reflect the active target rather than the deprecated source. - In-place operators such as
proxy += 1rebind the name to the unwrapped result. Later uses are silent; avoid in-place operators if the proxy must retain its warning budget. args_mapping,args_extra, andattrs_mappingare copied at decoration time. Mutating the original dict later no longer changes forwarding behavior.- Constructing an
attrs_mapping-only class proxy is now silent; only access to a listed deprecated attribute warns. - Concurrent calls now respect exactly the configured
num_warnsbudget. Tests that accidentally relied on one warning per racing thread will see fewer warnings. -
Recursive audits can change counts and rows in both directions. They now:
- They deduplicate re-exports.
- They include deprecated private and dunder members.
- They warn and skip submodules that fail to import.
- They ignore unrelated foreign objects that raise during metadata probing.
-
@deprecatednow defaults toTargetMode.AUTO. It resolves at decoration time: a function/class withargs_mappingbecomesARGS_REMAP; a source without a mapping becomes warn-only.AUTOis never stored inDeprecationConfig. Do not pass it explicitly because it exists only as the front-door default. - Existing
@deprecateduse on a class remains supported; no code change or decorator rewrite is required. It permanently delegates todeprecated_class()and emits one informationalUserWarningper module-qualified class.stream=Nonesuppresses the notice. Only the notice, not backward support or delegation, is removed in v1.0. message_templateandskip_ifsupplied through@deprecatedon a class now reach the proxy.message_templatewas previously dropped on that path.- Non-callable sources now raise a direct
TypeErrorpointing users todeprecated_instance()instead of failing later on__name__. -
Explicit
target=TargetMode.NOTIFYtogether with a mapping still emitsUserWarning, staysNOTIFY, leaves the mapping inert, and is marked misconfigured. This is unchanged from v0.11.0, and aTypeErrorin v1.0. What changed is that an omittedtargetno longer lands here: it auto-resolves instead. Omittargetto infer remapping, or select the matching remap mode explicitly. -
Griffe's
RuntimeDocstringsextension now scopes its docstring-replacement guard to pyDeprecate's own__deprecation_config__metadata (get_deprecation_config(obj) is not None). This replaces a bare truthiness check on__deprecated__. A foreign object decorated only with the stdlib'swarnings.deprecated/typing_extensions.deprecatedpreviously passed that truthy check too. Such an object has a string-valued__deprecated__and no pyDeprecate metadata. It no longer passes the check, since it was never meant to be replaced. -
v0.14 ships
py.typed, so type checkers now read pyDeprecate's own types instead of treating every object asAny. Runtime behavior is unchanged; only checker output moves. Old: DeprecationProxy[New] = deprecated_class(target=New, ...)(Cls)no longer type-checks. A call-formdeprecated_class(...)alias is typed as the class it forwards to (type[New]with a classtarget, otherwise the wrapped class), so drop the annotation.DeprecationProxy[T]remains the annotation fordeprecated_instance()proxies.- Old names accepted only through
args_mapping/attrs_mappingare reported on call-form aliases ascall-arg/attr-defined. The decorator form already did this under mypy. To keep such call sites type-checking during the migration window, choose either approach:- Keep the old names in a legacy class body (decorator form).
- Wrap the alias in
cast(DeprecationProxy[New], ...);isinstanceagainst the alias then stops type-checking.
- Proxy-only attributes such as
__wrapped__and__deprecation_config__are invisible ontype[New]. Read them withget_deprecation_config(Old)orinspect.unwrap(Old). -
Setting
__deprecated__on a deprecated proxy now keeps the marker on the proxy. Deleting it no longer removes the wrapped object's own marker; reading it after deletion raisesAttributeError.copy.copy,copy.deepcopy, andpicklekeep a PEP 702 message written onto the proxy. -
Calls that need no forwarding preserve the caller's positional and keyword argument form. A call that needs no forwarding, rename or extra argument reaches the source exactly as made.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
*args, which stay positional. - A custom stream that raises no longer leaves warning bookkeeping or emission context stuck. On a deprecated proxy, a warning that fails to deliver does not spend the warning budget. A decorated function still spends it.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
- Warnings that reported a pyDeprecate frame now point at the caller. Call-time warnings already named the user's call site. The remaining ones, notably the inner warning of a stacked deprecation chain, now carry the caller's line and module too. A warning filter keyed on
module="deprecate"that matched those warnings no longer does. Those warnings therefore surface, and raise under-W error. Key filters on the calling module instead. - Async proxy warnings are emitted when the underlying awaitable or async iterator is obtained. A later failure or exhaustion during
awaitor__anext__still consumes the warning budget.- If the warning itself fails, a coroutine the wrapped call created is closed. A coroutine the wrapped object holds as an attribute, or is itself, is left usable.
next()on a deprecated proxy now warns before the wrapped iterator advances, so a failed warning consumes no item. Calling the proxy also warns first, as@deprecateddoes. Other synchronous operations still warn only after success.- In-place operators and
defaultdictsubscripts keep their effect if delivery fails.
- A custom
streamis called exactly once, with its signature read before the call. A stream that declares**kwargsreceivesstacklevel=and must accept or drop it. Forward it towarnings.warnorlogging.warning;print(msg, **kwargs)raisesTypeError. Declaredef sink(msg)to receive the message alone. A bare(*args, **kwargs)functools.wrapspass-through is judged by the callable it wraps, also when afunctools.partialbinds it. A stream whose only parameter is namedstacklevelreceives the message alone. skip_ifnow covers item and in-place writes. Withskip_ifactive,proxy[key] = value,del proxy[key]and in-place operators write to the wrapped object. The read-only guard does not apply. A fatal proxy (as_exception=True) raisesDeprecatedErrorbefore a subscript, iteration or mapped attribute read touches the wrapped object.- Deprecated generators warn on the first iteration, not at the call. A deprecated generator function keeps
inspect.isgeneratorfunction. A deprecated async-generator function keepsinspect.isasyncgenfunction, so pytestyieldfixtures run their setup and teardown. The warning, thenum_warnsbudget,skip_if, argument binding and anas_exception/as_exceptions()error now resolve on the firstnext()/__anext__(). A generator that is never iterated never warns. Movepytest.warns()andpytest.raises()around the first iteration, and keepas_exceptions()active at that step. - An empty-string
args_mappingvalue keeps the argument. Under@deprecated,args_mapping={"old_arg": ""}now passesold_argthrough under its old name, asdeprecated_classalways did. A**kwargstarget therefore receives it; onlyNonedrops an argument. Map the argument toNoneif you relied on""dropping it. - Proxies carry only the protocols of the wrapped object or its replacement. A deprecated
dictis no longercallable(), anIterator,os.PathLike,AwaitableorAsyncIterable. A protocol the object disables stays disabled.type(proxy) is _DeprecatedProxyis nowFalse; useisinstance(proxy, DeprecationProxy). The generated proxy subclasses cannot be pickled by reference. - Forwarding to a
classmethodchecks the source's shape at decoration. Any receiver name works (klass,mcs).- These source shapes raise
TypeErrorat decoration:- A source with no leading positional parameter raises the error.
- A source with a later parameter named like the target's receiver raises the error.
- A static or plain source given a non-class first argument raises
TypeErrorbefore warning.
- These source shapes raise
- CLI arguments follow
argparse.- Spellings only the Fire-based CLI accepted exit
2:- A quoted literal such as
--version '"0.10"'exits2. - A list literal in
--excludeexits2; pass comma-separated patterns. - A table in
--min-graceexits2; set it inpyproject.toml. --path=pkgexits2.- Short flags such as
-rexit2. - An empty
--report-json=exits2. - Abbreviated option names exit
2. - Before v0.16, a second positional path exits
2; since v0.16 every subcommand takes several paths.
- A quoted literal such as
- A boolean flag given a value accepts only
true,false,1or0. Use the bare flag or--no-<flag>otherwise.
- Spellings only the Fire-based CLI accepted exit
- CLI exit codes changed.
checkandallexit1on misconfigured targets and inner-order@property @deprecatedwrappers, which used to pass. A scan error or internal error exits3instead of1, and--exit-zeromasks neither2nor3.- These inputs exit
2:- A single
.pyfile exits2. - A directory holding several packages exits
2. - A name that is neither a path nor an importable module exits
2.
- A single
- Check how CI steps treat
2and3.
- These inputs exit
deprecated_module(stream=None)warns at the call. An explicitstream=Nonestill delivers throughwarnings.warnbut emits aFutureWarning. In v1.0 it silences the module warning, and thenum_warnsdefault changes from-1to1. Omitstreamfor today's delivery and passnum_warns=-1to keep a warning on every access.-
DeprecationWrapperInfo.empty_mappingandidentity_mappingwarn withFutureWarning. Reading the deprecated aliases now emitsFutureWarningon every access instead ofDeprecationWarning, and raises under fatal mode. Readempty_args_mappingandidentity_args_mappinginstead. -
read_only=Trueproxies block six more methods.sort,reverse,popitem,difference_update,intersection_updateandsymmetric_difference_updatenow raiseAttributeErrorinstead of changing the wrapped list, dict or set. The guarded names go from 10 to 16, and a custom method with one of these names is blocked too. - A proxy with a callable
targetandargs_mappingshares one warning budget per call.deprecated_classanddeprecated_instanceemit one call-level warning per call instead of one per renamed keyword, and its message names the replacement rather than each renamed keyword. A test that counted or matched one warning per renamed keyword now changes. - Audit reports a function bound under several names under its own public name. When an alias used to sort first, the row and its finding id carried the alias. A name-based allowlist,
--ignorepattern or committed snapshot keyed on that alias needs the function's own name instead.
Coming from v0.6.x🔗
- Replace
target=NonewithTargetMode.NOTIFYor omittargetfor a warn-only decorator. - Replace
target=TruewithTargetMode.ARGS_REMAP. - Replace
DeprecationWrapperInfo.empty_mappingwithempty_args_mapping, andidentity_mappingwithidentity_args_mapping. The old properties warn and are removed in v1.0. - If code inspects
wrapper.__deprecated__.target, compare with aTargetMode, callable, orNone.DeprecationConfig.targetstores a normalized value, never legacyTrueorFalse. -
Update external documentation bookmarks from flat paths such as
/pyDeprecate/troubleshooting.htmlto the versioned/pyDeprecate/stable/troubleshooting.htmllayout. -
Rename the CLI flag
--skip_errorsto--exit-zeroin everycheck,expiry,chains, andallcommand. The old flag is rejected.--exit_zeroremains an underscore alias, but the dashed spelling is canonical. -
Fix unsupported stacked decorators. Six shapes, including callable-over-callable, now emit
UserWarningat decoration time and becomeTypeErrorin v1.0. The supported lifecycle stack is outerARGS_REMAPplus innerNOTIFY. -
Outer-order deprecated properties now warn on read, write, and delete. Under
filterwarnings=error::FutureWarning, a setter or deleter that was previously silent now raises. If only reads should warn, keep inner order (@propertyoutside@deprecated) or decorate onlyfget. -
Update proxy detection.
proxy.__class__reports the wrapped object's type forisinstancetransparency. Usetype(proxy)when you need to detect_DeprecatedProxyitself. - Do not use an instance proxy as the second argument to
isinstance()orissubclass(). This misuse now raisesTypeErrorinstead of returningFalse. Class-alias proxies remain valid there. - Review expiry CI scope.
validate_deprecation_expiry()now defaults toinclude_members=True, so expired methods, constructors, descriptors, and properties can newly fail the gate. Passinclude_members=Falseonly when the old narrower scope is intentional. - Fix invalid
remove_inversions. An unparsableremove_innow emitsUserWarningduring batch expiry instead of being skipped silently. - Fix misspelled CLI flags. Unknown flags now fail instead of being silently ignored.
-
Use named
%fields in custom message templates. Bare%sor%dconversions now raiseValueErrorwhen the decorator is applied. -
@deprecated(target=TargetMode.ATTRS_REMAP)now raisesTypeErrorfor a class source. It already raised for functions.ATTRS_REMAPneeds the class-onlyattrs_mappingkeyword, which the common front door does not expose. A class source therefore previously built a proxy that remapped nothing. Usedeprecated_class(attrs_mapping=...). -
Rename
template_mgstomessage_templateondeprecated(),deprecated_callable(),deprecated_class(), anddeprecated_instance(). The typo remains a warning alias until v1.0; supplying both names raisesTypeError. -
__deprecated__is now a plain PEP 702-conformant message string, not theDeprecationConfigobject. The config object moved to__deprecation_config__.- Code reading
func.__deprecated__.target,.deprecated_in,.args_mapping, or any other config field now gets a plainstr. So does code checkingisinstance(func.__deprecated__, DeprecationConfig). It either raisesAttributeErroror evaluatesFalse. - Replace direct reads with the public
get_deprecation_config(obj)helper. It also falls back to a legacy__deprecated__-as-config layout for objects built by a pyDeprecate release before v0.13. This affects every wrapper kind — functions, methods, class proxies (deprecated_class), instance proxies (deprecated_instance), and modules (deprecated_module).
- Code reading
-
A function
deprecated_instancestored as a class attribute now binds like a method, and only plain functions do.- Instance access passes
selfto the wrapped function; usestaticmethod(deprecated_instance(...))for static-style access. - A
functools.partial, bound method, builtin or Cython binding callable is served unbound and silent instead. A deprecatedpartialclass attribute is therefore no longer bound by Python.
- Instance access passes
-
functools.partial,partialmethodandsingledispatchmethodsources now raiseTypeErrorat decoration. This includes a named partial (given a__name__throughfunctools.update_wrapper) that 0.14 accepted. Wrap the object in a plaindefthat calls it and decorate thatdef. -
An operand after
--is always a path, never the legacy positional version.pydeprecate expiry -- src/pkg 2.0now treats2.0as a second path instead of reading it as the version, and exits2when no such path exists. Pass--version 2.0. - A second positional version on
expiry,allandstatusis deprecated. With two positionals, the second is a path first. It is read as a version only when it names no path or findable module and parses as one; that spelling prints a notice on stderr and stops working in v1.0. Pass--versioninstead; passing both exits2. - The empty
cliextra is removed. Thepydeprecatecommand needs no dependency, so replacepyDeprecate[cli]with the base package, or withpyDeprecate[audit]when you use the audit extras.pip install 'pyDeprecate[cli]'still installs, with pip's warning that the extra does not exist.
- Omitting
deprecated_inon a function or method emitsUserWarningat decoration time. Add the version as part of every deprecation lifecycle. ARGS_REMAPwithoutargs_mapping,NOTIFYwithargs_mappingorargs_extra, and invalidtarget=Falsenow warn immediately. These are migration failures, not harmless diagnostics; correct them before v1.0.-
Omitting
targetis the canonical warn-only form. Its v0.12 default isTargetMode.AUTO, which resolves toNOTIFYwhen no mapping is present, so the user-visible result is unchanged. -
CLI scans suppress only warnings from
deprecate.*; third-party warnings are now visible. CI that treats all warnings as errors may start failing on dependencies imported during a scan. -
Audit code sees the supported
ARGS_REMAP + NOTIFYchain asChainType.STACKED, notChainType.TARGET. -
When a caller supplies both deprecated and replacement keyword names, the explicit replacement value now wins regardless of call-site order.
-
Circular callable-target chains now raise a named
RuntimeErrorinstead of ending inRecursionError. -
repr(),str(), equality, and hashing on a target-forwarding proxy now reflect the active target rather than the deprecated source. - In-place operators such as
proxy += 1rebind the name to the unwrapped result. Later uses are silent; avoid in-place operators if the proxy must retain its warning budget. args_mapping,args_extra, andattrs_mappingare copied at decoration time. Mutating the original dict later no longer changes forwarding behavior.- Constructing an
attrs_mapping-only class proxy is now silent; only access to a listed deprecated attribute warns. - Concurrent calls now respect exactly the configured
num_warnsbudget. Tests that accidentally relied on one warning per racing thread will see fewer warnings. -
Recursive audits can change counts and rows in both directions. They now:
- They deduplicate re-exports.
- They include deprecated private and dunder members.
- They warn and skip submodules that fail to import.
- They ignore unrelated foreign objects that raise during metadata probing.
-
@deprecatednow defaults toTargetMode.AUTO. It resolves at decoration time: a function/class withargs_mappingbecomesARGS_REMAP; a source without a mapping becomes warn-only.AUTOis never stored inDeprecationConfig. Do not pass it explicitly because it exists only as the front-door default. - Existing
@deprecateduse on a class remains supported; no code change or decorator rewrite is required. It permanently delegates todeprecated_class()and emits one informationalUserWarningper module-qualified class.stream=Nonesuppresses the notice. Only the notice, not backward support or delegation, is removed in v1.0. message_templateandskip_ifsupplied through@deprecatedon a class now reach the proxy.message_templatewas previously dropped on that path.- Non-callable sources now raise a direct
TypeErrorpointing users todeprecated_instance()instead of failing later on__name__. -
Explicit
target=TargetMode.NOTIFYtogether with a mapping still emitsUserWarning, staysNOTIFY, leaves the mapping inert, and is marked misconfigured. This is unchanged from v0.11.0, and aTypeErrorin v1.0. What changed is that an omittedtargetno longer lands here: it auto-resolves instead. Omittargetto infer remapping, or select the matching remap mode explicitly. -
Griffe's
RuntimeDocstringsextension now scopes its docstring-replacement guard to pyDeprecate's own__deprecation_config__metadata (get_deprecation_config(obj) is not None). This replaces a bare truthiness check on__deprecated__. A foreign object decorated only with the stdlib'swarnings.deprecated/typing_extensions.deprecatedpreviously passed that truthy check too. Such an object has a string-valued__deprecated__and no pyDeprecate metadata. It no longer passes the check, since it was never meant to be replaced. -
v0.14 ships
py.typed, so type checkers now read pyDeprecate's own types instead of treating every object asAny. Runtime behavior is unchanged; only checker output moves. Old: DeprecationProxy[New] = deprecated_class(target=New, ...)(Cls)no longer type-checks. A call-formdeprecated_class(...)alias is typed as the class it forwards to (type[New]with a classtarget, otherwise the wrapped class), so drop the annotation.DeprecationProxy[T]remains the annotation fordeprecated_instance()proxies.- Old names accepted only through
args_mapping/attrs_mappingare reported on call-form aliases ascall-arg/attr-defined. The decorator form already did this under mypy. To keep such call sites type-checking during the migration window, choose either approach:- Keep the old names in a legacy class body (decorator form).
- Wrap the alias in
cast(DeprecationProxy[New], ...);isinstanceagainst the alias then stops type-checking.
- Proxy-only attributes such as
__wrapped__and__deprecation_config__are invisible ontype[New]. Read them withget_deprecation_config(Old)orinspect.unwrap(Old). -
Setting
__deprecated__on a deprecated proxy now keeps the marker on the proxy. Deleting it no longer removes the wrapped object's own marker; reading it after deletion raisesAttributeError.copy.copy,copy.deepcopy, andpicklekeep a PEP 702 message written onto the proxy. -
Calls that need no forwarding preserve the caller's positional and keyword argument form. A call that needs no forwarding, rename or extra argument reaches the source exactly as made.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
*args, which stay positional. - A custom stream that raises no longer leaves warning bookkeeping or emission context stuck. On a deprecated proxy, a warning that fails to deliver does not spend the warning budget. A decorated function still spends it.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
- Warnings that reported a pyDeprecate frame now point at the caller. Call-time warnings already named the user's call site. The remaining ones, notably the inner warning of a stacked deprecation chain, now carry the caller's line and module too. A warning filter keyed on
module="deprecate"that matched those warnings no longer does. Those warnings therefore surface, and raise under-W error. Key filters on the calling module instead. - Async proxy warnings are emitted when the underlying awaitable or async iterator is obtained. A later failure or exhaustion during
awaitor__anext__still consumes the warning budget.- If the warning itself fails, a coroutine the wrapped call created is closed. A coroutine the wrapped object holds as an attribute, or is itself, is left usable.
next()on a deprecated proxy now warns before the wrapped iterator advances, so a failed warning consumes no item. Calling the proxy also warns first, as@deprecateddoes. Other synchronous operations still warn only after success.- In-place operators and
defaultdictsubscripts keep their effect if delivery fails.
- A custom
streamis called exactly once, with its signature read before the call. A stream that declares**kwargsreceivesstacklevel=and must accept or drop it. Forward it towarnings.warnorlogging.warning;print(msg, **kwargs)raisesTypeError. Declaredef sink(msg)to receive the message alone. A bare(*args, **kwargs)functools.wrapspass-through is judged by the callable it wraps, also when afunctools.partialbinds it. A stream whose only parameter is namedstacklevelreceives the message alone. skip_ifnow covers item and in-place writes. Withskip_ifactive,proxy[key] = value,del proxy[key]and in-place operators write to the wrapped object. The read-only guard does not apply. A fatal proxy (as_exception=True) raisesDeprecatedErrorbefore a subscript, iteration or mapped attribute read touches the wrapped object.- Deprecated generators warn on the first iteration, not at the call. A deprecated generator function keeps
inspect.isgeneratorfunction. A deprecated async-generator function keepsinspect.isasyncgenfunction, so pytestyieldfixtures run their setup and teardown. The warning, thenum_warnsbudget,skip_if, argument binding and anas_exception/as_exceptions()error now resolve on the firstnext()/__anext__(). A generator that is never iterated never warns. Movepytest.warns()andpytest.raises()around the first iteration, and keepas_exceptions()active at that step. - An empty-string
args_mappingvalue keeps the argument. Under@deprecated,args_mapping={"old_arg": ""}now passesold_argthrough under its old name, asdeprecated_classalways did. A**kwargstarget therefore receives it; onlyNonedrops an argument. Map the argument toNoneif you relied on""dropping it. - Proxies carry only the protocols of the wrapped object or its replacement. A deprecated
dictis no longercallable(), anIterator,os.PathLike,AwaitableorAsyncIterable. A protocol the object disables stays disabled.type(proxy) is _DeprecatedProxyis nowFalse; useisinstance(proxy, DeprecationProxy). The generated proxy subclasses cannot be pickled by reference. - Forwarding to a
classmethodchecks the source's shape at decoration. Any receiver name works (klass,mcs).- These source shapes raise
TypeErrorat decoration:- A source with no leading positional parameter raises the error.
- A source with a later parameter named like the target's receiver raises the error.
- A static or plain source given a non-class first argument raises
TypeErrorbefore warning.
- These source shapes raise
- CLI arguments follow
argparse.- Spellings only the Fire-based CLI accepted exit
2:- A quoted literal such as
--version '"0.10"'exits2. - A list literal in
--excludeexits2; pass comma-separated patterns. - A table in
--min-graceexits2; set it inpyproject.toml. --path=pkgexits2.- Short flags such as
-rexit2. - An empty
--report-json=exits2. - Abbreviated option names exit
2. - Before v0.16, a second positional path exits
2; since v0.16 every subcommand takes several paths.
- A quoted literal such as
- A boolean flag given a value accepts only
true,false,1or0. Use the bare flag or--no-<flag>otherwise.
- Spellings only the Fire-based CLI accepted exit
- CLI exit codes changed.
checkandallexit1on misconfigured targets and inner-order@property @deprecatedwrappers, which used to pass. A scan error or internal error exits3instead of1, and--exit-zeromasks neither2nor3.- These inputs exit
2:- A single
.pyfile exits2. - A directory holding several packages exits
2. - A name that is neither a path nor an importable module exits
2.
- A single
- Check how CI steps treat
2and3.
- These inputs exit
deprecated_module(stream=None)warns at the call. An explicitstream=Nonestill delivers throughwarnings.warnbut emits aFutureWarning. In v1.0 it silences the module warning, and thenum_warnsdefault changes from-1to1. Omitstreamfor today's delivery and passnum_warns=-1to keep a warning on every access.-
DeprecationWrapperInfo.empty_mappingandidentity_mappingwarn withFutureWarning. Reading the deprecated aliases now emitsFutureWarningon every access instead ofDeprecationWarning, and raises under fatal mode. Readempty_args_mappingandidentity_args_mappinginstead. -
read_only=Trueproxies block six more methods.sort,reverse,popitem,difference_update,intersection_updateandsymmetric_difference_updatenow raiseAttributeErrorinstead of changing the wrapped list, dict or set. The guarded names go from 10 to 16, and a custom method with one of these names is blocked too. - A proxy with a callable
targetandargs_mappingshares one warning budget per call.deprecated_classanddeprecated_instanceemit one call-level warning per call instead of one per renamed keyword, and its message names the replacement rather than each renamed keyword. A test that counted or matched one warning per renamed keyword now changes. - Audit reports a function bound under several names under its own public name. When an alias used to sort first, the row and its finding id carried the alias. A name-based allowlist,
--ignorepattern or committed snapshot keyed on that alias needs the function's own name instead.
Coming from v0.5.x🔗
-
Fix cross-class method forwarding. Passing a class target to a non-
__init__instance method now raisesTypeErrorat decoration time instead of forwarding aselfof the wrong type. -
Replace API names deprecated until v1.0:
Deprecated API Replacement find_deprecated_callablesfind_deprecation_wrappersvalidate_deprecated_callablevalidate_deprecation_wrapperDeprecatedCallableInfoDeprecationWrapperInfono_warning_callassert_no_warnings -
Replace
target=NonewithTargetMode.NOTIFYor omittargetfor a warn-only decorator. - Replace
target=TruewithTargetMode.ARGS_REMAP. - Replace
DeprecationWrapperInfo.empty_mappingwithempty_args_mapping, andidentity_mappingwithidentity_args_mapping. The old properties warn and are removed in v1.0. - If code inspects
wrapper.__deprecated__.target, compare with aTargetMode, callable, orNone.DeprecationConfig.targetstores a normalized value, never legacyTrueorFalse. -
Update external documentation bookmarks from flat paths such as
/pyDeprecate/troubleshooting.htmlto the versioned/pyDeprecate/stable/troubleshooting.htmllayout. -
Rename the CLI flag
--skip_errorsto--exit-zeroin everycheck,expiry,chains, andallcommand. The old flag is rejected.--exit_zeroremains an underscore alias, but the dashed spelling is canonical. -
Fix unsupported stacked decorators. Six shapes, including callable-over-callable, now emit
UserWarningat decoration time and becomeTypeErrorin v1.0. The supported lifecycle stack is outerARGS_REMAPplus innerNOTIFY. -
Outer-order deprecated properties now warn on read, write, and delete. Under
filterwarnings=error::FutureWarning, a setter or deleter that was previously silent now raises. If only reads should warn, keep inner order (@propertyoutside@deprecated) or decorate onlyfget. -
Update proxy detection.
proxy.__class__reports the wrapped object's type forisinstancetransparency. Usetype(proxy)when you need to detect_DeprecatedProxyitself. - Do not use an instance proxy as the second argument to
isinstance()orissubclass(). This misuse now raisesTypeErrorinstead of returningFalse. Class-alias proxies remain valid there. - Review expiry CI scope.
validate_deprecation_expiry()now defaults toinclude_members=True, so expired methods, constructors, descriptors, and properties can newly fail the gate. Passinclude_members=Falseonly when the old narrower scope is intentional. - Fix invalid
remove_inversions. An unparsableremove_innow emitsUserWarningduring batch expiry instead of being skipped silently. - Fix misspelled CLI flags. Unknown flags now fail instead of being silently ignored.
-
Use named
%fields in custom message templates. Bare%sor%dconversions now raiseValueErrorwhen the decorator is applied. -
@deprecated(target=TargetMode.ATTRS_REMAP)now raisesTypeErrorfor a class source. It already raised for functions.ATTRS_REMAPneeds the class-onlyattrs_mappingkeyword, which the common front door does not expose. A class source therefore previously built a proxy that remapped nothing. Usedeprecated_class(attrs_mapping=...). -
Rename
template_mgstomessage_templateondeprecated(),deprecated_callable(),deprecated_class(), anddeprecated_instance(). The typo remains a warning alias until v1.0; supplying both names raisesTypeError. -
__deprecated__is now a plain PEP 702-conformant message string, not theDeprecationConfigobject. The config object moved to__deprecation_config__.- Code reading
func.__deprecated__.target,.deprecated_in,.args_mapping, or any other config field now gets a plainstr. So does code checkingisinstance(func.__deprecated__, DeprecationConfig). It either raisesAttributeErroror evaluatesFalse. - Replace direct reads with the public
get_deprecation_config(obj)helper. It also falls back to a legacy__deprecated__-as-config layout for objects built by a pyDeprecate release before v0.13. This affects every wrapper kind — functions, methods, class proxies (deprecated_class), instance proxies (deprecated_instance), and modules (deprecated_module).
- Code reading
-
A function
deprecated_instancestored as a class attribute now binds like a method, and only plain functions do.- Instance access passes
selfto the wrapped function; usestaticmethod(deprecated_instance(...))for static-style access. - A
functools.partial, bound method, builtin or Cython binding callable is served unbound and silent instead. A deprecatedpartialclass attribute is therefore no longer bound by Python.
- Instance access passes
-
functools.partial,partialmethodandsingledispatchmethodsources now raiseTypeErrorat decoration. This includes a named partial (given a__name__throughfunctools.update_wrapper) that 0.14 accepted. Wrap the object in a plaindefthat calls it and decorate thatdef. -
An operand after
--is always a path, never the legacy positional version.pydeprecate expiry -- src/pkg 2.0now treats2.0as a second path instead of reading it as the version, and exits2when no such path exists. Pass--version 2.0. - A second positional version on
expiry,allandstatusis deprecated. With two positionals, the second is a path first. It is read as a version only when it names no path or findable module and parses as one; that spelling prints a notice on stderr and stops working in v1.0. Pass--versioninstead; passing both exits2. - The empty
cliextra is removed. Thepydeprecatecommand needs no dependency, so replacepyDeprecate[cli]with the base package, or withpyDeprecate[audit]when you use the audit extras.pip install 'pyDeprecate[cli]'still installs, with pip's warning that the extra does not exist.
-
Across the v0.6.x line, backward support for
@deprecatedon a class was restored through delegation todeprecated_class(). Existing class decorators need no rewrite for v0.12; delegation remains permanent and only its informational notice is scheduled for removal. -
Omitting
deprecated_inon a function or method emitsUserWarningat decoration time. Add the version as part of every deprecation lifecycle. ARGS_REMAPwithoutargs_mapping,NOTIFYwithargs_mappingorargs_extra, and invalidtarget=Falsenow warn immediately. These are migration failures, not harmless diagnostics; correct them before v1.0.-
Omitting
targetis the canonical warn-only form. Its v0.12 default isTargetMode.AUTO, which resolves toNOTIFYwhen no mapping is present, so the user-visible result is unchanged. -
CLI scans suppress only warnings from
deprecate.*; third-party warnings are now visible. CI that treats all warnings as errors may start failing on dependencies imported during a scan. -
Audit code sees the supported
ARGS_REMAP + NOTIFYchain asChainType.STACKED, notChainType.TARGET. -
When a caller supplies both deprecated and replacement keyword names, the explicit replacement value now wins regardless of call-site order.
-
Circular callable-target chains now raise a named
RuntimeErrorinstead of ending inRecursionError. -
repr(),str(), equality, and hashing on a target-forwarding proxy now reflect the active target rather than the deprecated source. - In-place operators such as
proxy += 1rebind the name to the unwrapped result. Later uses are silent; avoid in-place operators if the proxy must retain its warning budget. args_mapping,args_extra, andattrs_mappingare copied at decoration time. Mutating the original dict later no longer changes forwarding behavior.- Constructing an
attrs_mapping-only class proxy is now silent; only access to a listed deprecated attribute warns. - Concurrent calls now respect exactly the configured
num_warnsbudget. Tests that accidentally relied on one warning per racing thread will see fewer warnings. -
Recursive audits can change counts and rows in both directions. They now:
- They deduplicate re-exports.
- They include deprecated private and dunder members.
- They warn and skip submodules that fail to import.
- They ignore unrelated foreign objects that raise during metadata probing.
-
@deprecatednow defaults toTargetMode.AUTO. It resolves at decoration time: a function/class withargs_mappingbecomesARGS_REMAP; a source without a mapping becomes warn-only.AUTOis never stored inDeprecationConfig. Do not pass it explicitly because it exists only as the front-door default. - Existing
@deprecateduse on a class remains supported; no code change or decorator rewrite is required. It permanently delegates todeprecated_class()and emits one informationalUserWarningper module-qualified class.stream=Nonesuppresses the notice. Only the notice, not backward support or delegation, is removed in v1.0. message_templateandskip_ifsupplied through@deprecatedon a class now reach the proxy.message_templatewas previously dropped on that path.- Non-callable sources now raise a direct
TypeErrorpointing users todeprecated_instance()instead of failing later on__name__. -
Explicit
target=TargetMode.NOTIFYtogether with a mapping still emitsUserWarning, staysNOTIFY, leaves the mapping inert, and is marked misconfigured. This is unchanged from v0.11.0, and aTypeErrorin v1.0. What changed is that an omittedtargetno longer lands here: it auto-resolves instead. Omittargetto infer remapping, or select the matching remap mode explicitly. -
Griffe's
RuntimeDocstringsextension now scopes its docstring-replacement guard to pyDeprecate's own__deprecation_config__metadata (get_deprecation_config(obj) is not None). This replaces a bare truthiness check on__deprecated__. A foreign object decorated only with the stdlib'swarnings.deprecated/typing_extensions.deprecatedpreviously passed that truthy check too. Such an object has a string-valued__deprecated__and no pyDeprecate metadata. It no longer passes the check, since it was never meant to be replaced. -
v0.14 ships
py.typed, so type checkers now read pyDeprecate's own types instead of treating every object asAny. Runtime behavior is unchanged; only checker output moves. Old: DeprecationProxy[New] = deprecated_class(target=New, ...)(Cls)no longer type-checks. A call-formdeprecated_class(...)alias is typed as the class it forwards to (type[New]with a classtarget, otherwise the wrapped class), so drop the annotation.DeprecationProxy[T]remains the annotation fordeprecated_instance()proxies.- Old names accepted only through
args_mapping/attrs_mappingare reported on call-form aliases ascall-arg/attr-defined. The decorator form already did this under mypy. To keep such call sites type-checking during the migration window, choose either approach:- Keep the old names in a legacy class body (decorator form).
- Wrap the alias in
cast(DeprecationProxy[New], ...);isinstanceagainst the alias then stops type-checking.
- Proxy-only attributes such as
__wrapped__and__deprecation_config__are invisible ontype[New]. Read them withget_deprecation_config(Old)orinspect.unwrap(Old). -
Setting
__deprecated__on a deprecated proxy now keeps the marker on the proxy. Deleting it no longer removes the wrapped object's own marker; reading it after deletion raisesAttributeError.copy.copy,copy.deepcopy, andpicklekeep a PEP 702 message written onto the proxy. -
Calls that need no forwarding preserve the caller's positional and keyword argument form. A call that needs no forwarding, rename or extra argument reaches the source exactly as made.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
*args, which stay positional. - A custom stream that raises no longer leaves warning bookkeeping or emission context stuck. On a deprecated proxy, a warning that fails to deliver does not spend the warning budget. A decorated function still spends it.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
- Warnings that reported a pyDeprecate frame now point at the caller. Call-time warnings already named the user's call site. The remaining ones, notably the inner warning of a stacked deprecation chain, now carry the caller's line and module too. A warning filter keyed on
module="deprecate"that matched those warnings no longer does. Those warnings therefore surface, and raise under-W error. Key filters on the calling module instead. - Async proxy warnings are emitted when the underlying awaitable or async iterator is obtained. A later failure or exhaustion during
awaitor__anext__still consumes the warning budget.- If the warning itself fails, a coroutine the wrapped call created is closed. A coroutine the wrapped object holds as an attribute, or is itself, is left usable.
next()on a deprecated proxy now warns before the wrapped iterator advances, so a failed warning consumes no item. Calling the proxy also warns first, as@deprecateddoes. Other synchronous operations still warn only after success.- In-place operators and
defaultdictsubscripts keep their effect if delivery fails.
- A custom
streamis called exactly once, with its signature read before the call. A stream that declares**kwargsreceivesstacklevel=and must accept or drop it. Forward it towarnings.warnorlogging.warning;print(msg, **kwargs)raisesTypeError. Declaredef sink(msg)to receive the message alone. A bare(*args, **kwargs)functools.wrapspass-through is judged by the callable it wraps, also when afunctools.partialbinds it. A stream whose only parameter is namedstacklevelreceives the message alone. skip_ifnow covers item and in-place writes. Withskip_ifactive,proxy[key] = value,del proxy[key]and in-place operators write to the wrapped object. The read-only guard does not apply. A fatal proxy (as_exception=True) raisesDeprecatedErrorbefore a subscript, iteration or mapped attribute read touches the wrapped object.- Deprecated generators warn on the first iteration, not at the call. A deprecated generator function keeps
inspect.isgeneratorfunction. A deprecated async-generator function keepsinspect.isasyncgenfunction, so pytestyieldfixtures run their setup and teardown. The warning, thenum_warnsbudget,skip_if, argument binding and anas_exception/as_exceptions()error now resolve on the firstnext()/__anext__(). A generator that is never iterated never warns. Movepytest.warns()andpytest.raises()around the first iteration, and keepas_exceptions()active at that step. - An empty-string
args_mappingvalue keeps the argument. Under@deprecated,args_mapping={"old_arg": ""}now passesold_argthrough under its old name, asdeprecated_classalways did. A**kwargstarget therefore receives it; onlyNonedrops an argument. Map the argument toNoneif you relied on""dropping it. - Proxies carry only the protocols of the wrapped object or its replacement. A deprecated
dictis no longercallable(), anIterator,os.PathLike,AwaitableorAsyncIterable. A protocol the object disables stays disabled.type(proxy) is _DeprecatedProxyis nowFalse; useisinstance(proxy, DeprecationProxy). The generated proxy subclasses cannot be pickled by reference. - Forwarding to a
classmethodchecks the source's shape at decoration. Any receiver name works (klass,mcs).- These source shapes raise
TypeErrorat decoration:- A source with no leading positional parameter raises the error.
- A source with a later parameter named like the target's receiver raises the error.
- A static or plain source given a non-class first argument raises
TypeErrorbefore warning.
- These source shapes raise
- CLI arguments follow
argparse.- Spellings only the Fire-based CLI accepted exit
2:- A quoted literal such as
--version '"0.10"'exits2. - A list literal in
--excludeexits2; pass comma-separated patterns. - A table in
--min-graceexits2; set it inpyproject.toml. --path=pkgexits2.- Short flags such as
-rexit2. - An empty
--report-json=exits2. - Abbreviated option names exit
2. - Before v0.16, a second positional path exits
2; since v0.16 every subcommand takes several paths.
- A quoted literal such as
- A boolean flag given a value accepts only
true,false,1or0. Use the bare flag or--no-<flag>otherwise.
- Spellings only the Fire-based CLI accepted exit
- CLI exit codes changed.
checkandallexit1on misconfigured targets and inner-order@property @deprecatedwrappers, which used to pass. A scan error or internal error exits3instead of1, and--exit-zeromasks neither2nor3.- These inputs exit
2:- A single
.pyfile exits2. - A directory holding several packages exits
2. - A name that is neither a path nor an importable module exits
2.
- A single
- Check how CI steps treat
2and3.
- These inputs exit
deprecated_module(stream=None)warns at the call. An explicitstream=Nonestill delivers throughwarnings.warnbut emits aFutureWarning. In v1.0 it silences the module warning, and thenum_warnsdefault changes from-1to1. Omitstreamfor today's delivery and passnum_warns=-1to keep a warning on every access.-
DeprecationWrapperInfo.empty_mappingandidentity_mappingwarn withFutureWarning. Reading the deprecated aliases now emitsFutureWarningon every access instead ofDeprecationWarning, and raises under fatal mode. Readempty_args_mappingandidentity_args_mappinginstead. -
read_only=Trueproxies block six more methods.sort,reverse,popitem,difference_update,intersection_updateandsymmetric_difference_updatenow raiseAttributeErrorinstead of changing the wrapped list, dict or set. The guarded names go from 10 to 16, and a custom method with one of these names is blocked too. - A proxy with a callable
targetandargs_mappingshares one warning budget per call.deprecated_classanddeprecated_instanceemit one call-level warning per call instead of one per renamed keyword, and its message names the replacement rather than each renamed keyword. A test that counted or matched one warning per renamed keyword now changes. - Audit reports a function bound under several names under its own public name. When an alias used to sort first, the row and its finding id carried the alias. A name-based allowlist,
--ignorepattern or committed snapshot keyed on that alias needs the function's own name instead.
Coming from v0.4.x🔗
-
Fix cross-class method forwarding. Passing a class target to a non-
__init__instance method now raisesTypeErrorat decoration time instead of forwarding aselfof the wrong type. -
Replace API names deprecated until v1.0:
Deprecated API Replacement find_deprecated_callablesfind_deprecation_wrappersvalidate_deprecated_callablevalidate_deprecation_wrapperDeprecatedCallableInfoDeprecationWrapperInfono_warning_callassert_no_warnings -
Replace
target=NonewithTargetMode.NOTIFYor omittargetfor a warn-only decorator. - Replace
target=TruewithTargetMode.ARGS_REMAP. - Replace
DeprecationWrapperInfo.empty_mappingwithempty_args_mapping, andidentity_mappingwithidentity_args_mapping. The old properties warn and are removed in v1.0. - If code inspects
wrapper.__deprecated__.target, compare with aTargetMode, callable, orNone.DeprecationConfig.targetstores a normalized value, never legacyTrueorFalse. -
Update external documentation bookmarks from flat paths such as
/pyDeprecate/troubleshooting.htmlto the versioned/pyDeprecate/stable/troubleshooting.htmllayout. -
Rename the CLI flag
--skip_errorsto--exit-zeroin everycheck,expiry,chains, andallcommand. The old flag is rejected.--exit_zeroremains an underscore alias, but the dashed spelling is canonical. -
Fix unsupported stacked decorators. Six shapes, including callable-over-callable, now emit
UserWarningat decoration time and becomeTypeErrorin v1.0. The supported lifecycle stack is outerARGS_REMAPplus innerNOTIFY. -
Outer-order deprecated properties now warn on read, write, and delete. Under
filterwarnings=error::FutureWarning, a setter or deleter that was previously silent now raises. If only reads should warn, keep inner order (@propertyoutside@deprecated) or decorate onlyfget. -
Update proxy detection.
proxy.__class__reports the wrapped object's type forisinstancetransparency. Usetype(proxy)when you need to detect_DeprecatedProxyitself. - Do not use an instance proxy as the second argument to
isinstance()orissubclass(). This misuse now raisesTypeErrorinstead of returningFalse. Class-alias proxies remain valid there. - Review expiry CI scope.
validate_deprecation_expiry()now defaults toinclude_members=True, so expired methods, constructors, descriptors, and properties can newly fail the gate. Passinclude_members=Falseonly when the old narrower scope is intentional. - Fix invalid
remove_inversions. An unparsableremove_innow emitsUserWarningduring batch expiry instead of being skipped silently. - Fix misspelled CLI flags. Unknown flags now fail instead of being silently ignored.
-
Use named
%fields in custom message templates. Bare%sor%dconversions now raiseValueErrorwhen the decorator is applied. -
@deprecated(target=TargetMode.ATTRS_REMAP)now raisesTypeErrorfor a class source. It already raised for functions.ATTRS_REMAPneeds the class-onlyattrs_mappingkeyword, which the common front door does not expose. A class source therefore previously built a proxy that remapped nothing. Usedeprecated_class(attrs_mapping=...). -
Rename
template_mgstomessage_templateondeprecated(),deprecated_callable(),deprecated_class(), anddeprecated_instance(). The typo remains a warning alias until v1.0; supplying both names raisesTypeError. -
__deprecated__is now a plain PEP 702-conformant message string, not theDeprecationConfigobject. The config object moved to__deprecation_config__.- Code reading
func.__deprecated__.target,.deprecated_in,.args_mapping, or any other config field now gets a plainstr. So does code checkingisinstance(func.__deprecated__, DeprecationConfig). It either raisesAttributeErroror evaluatesFalse. - Replace direct reads with the public
get_deprecation_config(obj)helper. It also falls back to a legacy__deprecated__-as-config layout for objects built by a pyDeprecate release before v0.13. This affects every wrapper kind — functions, methods, class proxies (deprecated_class), instance proxies (deprecated_instance), and modules (deprecated_module).
- Code reading
-
A function
deprecated_instancestored as a class attribute now binds like a method, and only plain functions do.- Instance access passes
selfto the wrapped function; usestaticmethod(deprecated_instance(...))for static-style access. - A
functools.partial, bound method, builtin or Cython binding callable is served unbound and silent instead. A deprecatedpartialclass attribute is therefore no longer bound by Python.
- Instance access passes
-
functools.partial,partialmethodandsingledispatchmethodsources now raiseTypeErrorat decoration. This includes a named partial (given a__name__throughfunctools.update_wrapper) that 0.14 accepted. Wrap the object in a plaindefthat calls it and decorate thatdef. -
An operand after
--is always a path, never the legacy positional version.pydeprecate expiry -- src/pkg 2.0now treats2.0as a second path instead of reading it as the version, and exits2when no such path exists. Pass--version 2.0. - A second positional version on
expiry,allandstatusis deprecated. With two positionals, the second is a path first. It is read as a version only when it names no path or findable module and parses as one; that spelling prints a notice on stderr and stops working in v1.0. Pass--versioninstead; passing both exits2. - The empty
cliextra is removed. Thepydeprecatecommand needs no dependency, so replacepyDeprecate[cli]with the base package, or withpyDeprecate[audit]when you use the audit extras.pip install 'pyDeprecate[cli]'still installs, with pip's warning that the extra does not exist.
-
Across the v0.6.x line, backward support for
@deprecatedon a class was restored through delegation todeprecated_class(). Existing class decorators need no rewrite for v0.12; delegation remains permanent and only its informational notice is scheduled for removal. -
Omitting
deprecated_inon a function or method emitsUserWarningat decoration time. Add the version as part of every deprecation lifecycle. ARGS_REMAPwithoutargs_mapping,NOTIFYwithargs_mappingorargs_extra, and invalidtarget=Falsenow warn immediately. These are migration failures, not harmless diagnostics; correct them before v1.0.-
Omitting
targetis the canonical warn-only form. Its v0.12 default isTargetMode.AUTO, which resolves toNOTIFYwhen no mapping is present, so the user-visible result is unchanged. -
CLI scans suppress only warnings from
deprecate.*; third-party warnings are now visible. CI that treats all warnings as errors may start failing on dependencies imported during a scan. -
Audit code sees the supported
ARGS_REMAP + NOTIFYchain asChainType.STACKED, notChainType.TARGET. -
When a caller supplies both deprecated and replacement keyword names, the explicit replacement value now wins regardless of call-site order.
-
Circular callable-target chains now raise a named
RuntimeErrorinstead of ending inRecursionError. -
repr(),str(), equality, and hashing on a target-forwarding proxy now reflect the active target rather than the deprecated source. - In-place operators such as
proxy += 1rebind the name to the unwrapped result. Later uses are silent; avoid in-place operators if the proxy must retain its warning budget. args_mapping,args_extra, andattrs_mappingare copied at decoration time. Mutating the original dict later no longer changes forwarding behavior.- Constructing an
attrs_mapping-only class proxy is now silent; only access to a listed deprecated attribute warns. - Concurrent calls now respect exactly the configured
num_warnsbudget. Tests that accidentally relied on one warning per racing thread will see fewer warnings. -
Recursive audits can change counts and rows in both directions. They now:
- They deduplicate re-exports.
- They include deprecated private and dunder members.
- They warn and skip submodules that fail to import.
- They ignore unrelated foreign objects that raise during metadata probing.
-
@deprecatednow defaults toTargetMode.AUTO. It resolves at decoration time: a function/class withargs_mappingbecomesARGS_REMAP; a source without a mapping becomes warn-only.AUTOis never stored inDeprecationConfig. Do not pass it explicitly because it exists only as the front-door default. - Existing
@deprecateduse on a class remains supported; no code change or decorator rewrite is required. It permanently delegates todeprecated_class()and emits one informationalUserWarningper module-qualified class.stream=Nonesuppresses the notice. Only the notice, not backward support or delegation, is removed in v1.0. message_templateandskip_ifsupplied through@deprecatedon a class now reach the proxy.message_templatewas previously dropped on that path.- Non-callable sources now raise a direct
TypeErrorpointing users todeprecated_instance()instead of failing later on__name__. -
Explicit
target=TargetMode.NOTIFYtogether with a mapping still emitsUserWarning, staysNOTIFY, leaves the mapping inert, and is marked misconfigured. This is unchanged from v0.11.0, and aTypeErrorin v1.0. What changed is that an omittedtargetno longer lands here: it auto-resolves instead. Omittargetto infer remapping, or select the matching remap mode explicitly. -
Griffe's
RuntimeDocstringsextension now scopes its docstring-replacement guard to pyDeprecate's own__deprecation_config__metadata (get_deprecation_config(obj) is not None). This replaces a bare truthiness check on__deprecated__. A foreign object decorated only with the stdlib'swarnings.deprecated/typing_extensions.deprecatedpreviously passed that truthy check too. Such an object has a string-valued__deprecated__and no pyDeprecate metadata. It no longer passes the check, since it was never meant to be replaced. -
v0.14 ships
py.typed, so type checkers now read pyDeprecate's own types instead of treating every object asAny. Runtime behavior is unchanged; only checker output moves. Old: DeprecationProxy[New] = deprecated_class(target=New, ...)(Cls)no longer type-checks. A call-formdeprecated_class(...)alias is typed as the class it forwards to (type[New]with a classtarget, otherwise the wrapped class), so drop the annotation.DeprecationProxy[T]remains the annotation fordeprecated_instance()proxies.- Old names accepted only through
args_mapping/attrs_mappingare reported on call-form aliases ascall-arg/attr-defined. The decorator form already did this under mypy. To keep such call sites type-checking during the migration window, choose either approach:- Keep the old names in a legacy class body (decorator form).
- Wrap the alias in
cast(DeprecationProxy[New], ...);isinstanceagainst the alias then stops type-checking.
- Proxy-only attributes such as
__wrapped__and__deprecation_config__are invisible ontype[New]. Read them withget_deprecation_config(Old)orinspect.unwrap(Old). -
Setting
__deprecated__on a deprecated proxy now keeps the marker on the proxy. Deleting it no longer removes the wrapped object's own marker; reading it after deletion raisesAttributeError.copy.copy,copy.deepcopy, andpicklekeep a PEP 702 message written onto the proxy. -
Calls that need no forwarding preserve the caller's positional and keyword argument form. A call that needs no forwarding, rename or extra argument reaches the source exactly as made.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
*args, which stay positional. - A custom stream that raises no longer leaves warning bookkeeping or emission context stuck. On a deprecated proxy, a warning that fails to deliver does not spend the warning budget. A decorated function still spends it.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
- Warnings that reported a pyDeprecate frame now point at the caller. Call-time warnings already named the user's call site. The remaining ones, notably the inner warning of a stacked deprecation chain, now carry the caller's line and module too. A warning filter keyed on
module="deprecate"that matched those warnings no longer does. Those warnings therefore surface, and raise under-W error. Key filters on the calling module instead. - Async proxy warnings are emitted when the underlying awaitable or async iterator is obtained. A later failure or exhaustion during
awaitor__anext__still consumes the warning budget.- If the warning itself fails, a coroutine the wrapped call created is closed. A coroutine the wrapped object holds as an attribute, or is itself, is left usable.
next()on a deprecated proxy now warns before the wrapped iterator advances, so a failed warning consumes no item. Calling the proxy also warns first, as@deprecateddoes. Other synchronous operations still warn only after success.- In-place operators and
defaultdictsubscripts keep their effect if delivery fails.
- A custom
streamis called exactly once, with its signature read before the call. A stream that declares**kwargsreceivesstacklevel=and must accept or drop it. Forward it towarnings.warnorlogging.warning;print(msg, **kwargs)raisesTypeError. Declaredef sink(msg)to receive the message alone. A bare(*args, **kwargs)functools.wrapspass-through is judged by the callable it wraps, also when afunctools.partialbinds it. A stream whose only parameter is namedstacklevelreceives the message alone. skip_ifnow covers item and in-place writes. Withskip_ifactive,proxy[key] = value,del proxy[key]and in-place operators write to the wrapped object. The read-only guard does not apply. A fatal proxy (as_exception=True) raisesDeprecatedErrorbefore a subscript, iteration or mapped attribute read touches the wrapped object.- Deprecated generators warn on the first iteration, not at the call. A deprecated generator function keeps
inspect.isgeneratorfunction. A deprecated async-generator function keepsinspect.isasyncgenfunction, so pytestyieldfixtures run their setup and teardown. The warning, thenum_warnsbudget,skip_if, argument binding and anas_exception/as_exceptions()error now resolve on the firstnext()/__anext__(). A generator that is never iterated never warns. Movepytest.warns()andpytest.raises()around the first iteration, and keepas_exceptions()active at that step. - An empty-string
args_mappingvalue keeps the argument. Under@deprecated,args_mapping={"old_arg": ""}now passesold_argthrough under its old name, asdeprecated_classalways did. A**kwargstarget therefore receives it; onlyNonedrops an argument. Map the argument toNoneif you relied on""dropping it. - Proxies carry only the protocols of the wrapped object or its replacement. A deprecated
dictis no longercallable(), anIterator,os.PathLike,AwaitableorAsyncIterable. A protocol the object disables stays disabled.type(proxy) is _DeprecatedProxyis nowFalse; useisinstance(proxy, DeprecationProxy). The generated proxy subclasses cannot be pickled by reference. - Forwarding to a
classmethodchecks the source's shape at decoration. Any receiver name works (klass,mcs).- These source shapes raise
TypeErrorat decoration:- A source with no leading positional parameter raises the error.
- A source with a later parameter named like the target's receiver raises the error.
- A static or plain source given a non-class first argument raises
TypeErrorbefore warning.
- These source shapes raise
- CLI arguments follow
argparse.- Spellings only the Fire-based CLI accepted exit
2:- A quoted literal such as
--version '"0.10"'exits2. - A list literal in
--excludeexits2; pass comma-separated patterns. - A table in
--min-graceexits2; set it inpyproject.toml. --path=pkgexits2.- Short flags such as
-rexit2. - An empty
--report-json=exits2. - Abbreviated option names exit
2. - Before v0.16, a second positional path exits
2; since v0.16 every subcommand takes several paths.
- A quoted literal such as
- A boolean flag given a value accepts only
true,false,1or0. Use the bare flag or--no-<flag>otherwise.
- Spellings only the Fire-based CLI accepted exit
- CLI exit codes changed.
checkandallexit1on misconfigured targets and inner-order@property @deprecatedwrappers, which used to pass. A scan error or internal error exits3instead of1, and--exit-zeromasks neither2nor3.- These inputs exit
2:- A single
.pyfile exits2. - A directory holding several packages exits
2. - A name that is neither a path nor an importable module exits
2.
- A single
- Check how CI steps treat
2and3.
- These inputs exit
deprecated_module(stream=None)warns at the call. An explicitstream=Nonestill delivers throughwarnings.warnbut emits aFutureWarning. In v1.0 it silences the module warning, and thenum_warnsdefault changes from-1to1. Omitstreamfor today's delivery and passnum_warns=-1to keep a warning on every access.-
DeprecationWrapperInfo.empty_mappingandidentity_mappingwarn withFutureWarning. Reading the deprecated aliases now emitsFutureWarningon every access instead ofDeprecationWarning, and raises under fatal mode. Readempty_args_mappingandidentity_args_mappinginstead. -
read_only=Trueproxies block six more methods.sort,reverse,popitem,difference_update,intersection_updateandsymmetric_difference_updatenow raiseAttributeErrorinstead of changing the wrapped list, dict or set. The guarded names go from 10 to 16, and a custom method with one of these names is blocked too. - A proxy with a callable
targetandargs_mappingshares one warning budget per call.deprecated_classanddeprecated_instanceemit one call-level warning per call instead of one per renamed keyword, and its message names the replacement rather than each renamed keyword. A test that counted or matched one warning per renamed keyword now changes. - Audit reports a function bound under several names under its own public name. When an alias used to sort first, the row and its finding id carried the alias. A name-based allowlist,
--ignorepattern or committed snapshot keyed on that alias needs the function's own name instead.
Coming from v0.3.x🔗
- Update warning filters and assertions from
DeprecationWarningtoFutureWarning. Application users now see the warnings under Python's default filters. - Run on Python 3.9 or newer. Python 3.8 support was removed.
-
Review the license change from MIT to Apache-2.0 if your distribution or compliance process records dependency licenses.
-
Fix cross-class method forwarding. Passing a class target to a non-
__init__instance method now raisesTypeErrorat decoration time instead of forwarding aselfof the wrong type. -
Replace API names deprecated until v1.0:
Deprecated API Replacement find_deprecated_callablesfind_deprecation_wrappersvalidate_deprecated_callablevalidate_deprecation_wrapperDeprecatedCallableInfoDeprecationWrapperInfono_warning_callassert_no_warnings -
Replace
target=NonewithTargetMode.NOTIFYor omittargetfor a warn-only decorator. - Replace
target=TruewithTargetMode.ARGS_REMAP. - Replace
DeprecationWrapperInfo.empty_mappingwithempty_args_mapping, andidentity_mappingwithidentity_args_mapping. The old properties warn and are removed in v1.0. - If code inspects
wrapper.__deprecated__.target, compare with aTargetMode, callable, orNone.DeprecationConfig.targetstores a normalized value, never legacyTrueorFalse. -
Update external documentation bookmarks from flat paths such as
/pyDeprecate/troubleshooting.htmlto the versioned/pyDeprecate/stable/troubleshooting.htmllayout. -
Rename the CLI flag
--skip_errorsto--exit-zeroin everycheck,expiry,chains, andallcommand. The old flag is rejected.--exit_zeroremains an underscore alias, but the dashed spelling is canonical. -
Fix unsupported stacked decorators. Six shapes, including callable-over-callable, now emit
UserWarningat decoration time and becomeTypeErrorin v1.0. The supported lifecycle stack is outerARGS_REMAPplus innerNOTIFY. -
Outer-order deprecated properties now warn on read, write, and delete. Under
filterwarnings=error::FutureWarning, a setter or deleter that was previously silent now raises. If only reads should warn, keep inner order (@propertyoutside@deprecated) or decorate onlyfget. -
Update proxy detection.
proxy.__class__reports the wrapped object's type forisinstancetransparency. Usetype(proxy)when you need to detect_DeprecatedProxyitself. - Do not use an instance proxy as the second argument to
isinstance()orissubclass(). This misuse now raisesTypeErrorinstead of returningFalse. Class-alias proxies remain valid there. - Review expiry CI scope.
validate_deprecation_expiry()now defaults toinclude_members=True, so expired methods, constructors, descriptors, and properties can newly fail the gate. Passinclude_members=Falseonly when the old narrower scope is intentional. - Fix invalid
remove_inversions. An unparsableremove_innow emitsUserWarningduring batch expiry instead of being skipped silently. - Fix misspelled CLI flags. Unknown flags now fail instead of being silently ignored.
-
Use named
%fields in custom message templates. Bare%sor%dconversions now raiseValueErrorwhen the decorator is applied. -
@deprecated(target=TargetMode.ATTRS_REMAP)now raisesTypeErrorfor a class source. It already raised for functions.ATTRS_REMAPneeds the class-onlyattrs_mappingkeyword, which the common front door does not expose. A class source therefore previously built a proxy that remapped nothing. Usedeprecated_class(attrs_mapping=...). -
Rename
template_mgstomessage_templateondeprecated(),deprecated_callable(),deprecated_class(), anddeprecated_instance(). The typo remains a warning alias until v1.0; supplying both names raisesTypeError. -
__deprecated__is now a plain PEP 702-conformant message string, not theDeprecationConfigobject. The config object moved to__deprecation_config__.- Code reading
func.__deprecated__.target,.deprecated_in,.args_mapping, or any other config field now gets a plainstr. So does code checkingisinstance(func.__deprecated__, DeprecationConfig). It either raisesAttributeErroror evaluatesFalse. - Replace direct reads with the public
get_deprecation_config(obj)helper. It also falls back to a legacy__deprecated__-as-config layout for objects built by a pyDeprecate release before v0.13. This affects every wrapper kind — functions, methods, class proxies (deprecated_class), instance proxies (deprecated_instance), and modules (deprecated_module).
- Code reading
-
A function
deprecated_instancestored as a class attribute now binds like a method, and only plain functions do.- Instance access passes
selfto the wrapped function; usestaticmethod(deprecated_instance(...))for static-style access. - A
functools.partial, bound method, builtin or Cython binding callable is served unbound and silent instead. A deprecatedpartialclass attribute is therefore no longer bound by Python.
- Instance access passes
-
functools.partial,partialmethodandsingledispatchmethodsources now raiseTypeErrorat decoration. This includes a named partial (given a__name__throughfunctools.update_wrapper) that 0.14 accepted. Wrap the object in a plaindefthat calls it and decorate thatdef. -
An operand after
--is always a path, never the legacy positional version.pydeprecate expiry -- src/pkg 2.0now treats2.0as a second path instead of reading it as the version, and exits2when no such path exists. Pass--version 2.0. - A second positional version on
expiry,allandstatusis deprecated. With two positionals, the second is a path first. It is read as a version only when it names no path or findable module and parses as one; that spelling prints a notice on stderr and stops working in v1.0. Pass--versioninstead; passing both exits2. - The empty
cliextra is removed. Thepydeprecatecommand needs no dependency, so replacepyDeprecate[cli]with the base package, or withpyDeprecate[audit]when you use the audit extras.pip install 'pyDeprecate[cli]'still installs, with pip's warning that the extra does not exist.
-
Mapping errors now include the originating class or function name. Tests that assert complete error strings may need updated expected text.
-
Across the v0.6.x line, backward support for
@deprecatedon a class was restored through delegation todeprecated_class(). Existing class decorators need no rewrite for v0.12; delegation remains permanent and only its informational notice is scheduled for removal. -
Omitting
deprecated_inon a function or method emitsUserWarningat decoration time. Add the version as part of every deprecation lifecycle. ARGS_REMAPwithoutargs_mapping,NOTIFYwithargs_mappingorargs_extra, and invalidtarget=Falsenow warn immediately. These are migration failures, not harmless diagnostics; correct them before v1.0.-
Omitting
targetis the canonical warn-only form. Its v0.12 default isTargetMode.AUTO, which resolves toNOTIFYwhen no mapping is present, so the user-visible result is unchanged. -
CLI scans suppress only warnings from
deprecate.*; third-party warnings are now visible. CI that treats all warnings as errors may start failing on dependencies imported during a scan. -
Audit code sees the supported
ARGS_REMAP + NOTIFYchain asChainType.STACKED, notChainType.TARGET. -
When a caller supplies both deprecated and replacement keyword names, the explicit replacement value now wins regardless of call-site order.
-
Circular callable-target chains now raise a named
RuntimeErrorinstead of ending inRecursionError. -
repr(),str(), equality, and hashing on a target-forwarding proxy now reflect the active target rather than the deprecated source. - In-place operators such as
proxy += 1rebind the name to the unwrapped result. Later uses are silent; avoid in-place operators if the proxy must retain its warning budget. args_mapping,args_extra, andattrs_mappingare copied at decoration time. Mutating the original dict later no longer changes forwarding behavior.- Constructing an
attrs_mapping-only class proxy is now silent; only access to a listed deprecated attribute warns. - Concurrent calls now respect exactly the configured
num_warnsbudget. Tests that accidentally relied on one warning per racing thread will see fewer warnings. -
Recursive audits can change counts and rows in both directions. They now:
- They deduplicate re-exports.
- They include deprecated private and dunder members.
- They warn and skip submodules that fail to import.
- They ignore unrelated foreign objects that raise during metadata probing.
-
@deprecatednow defaults toTargetMode.AUTO. It resolves at decoration time: a function/class withargs_mappingbecomesARGS_REMAP; a source without a mapping becomes warn-only.AUTOis never stored inDeprecationConfig. Do not pass it explicitly because it exists only as the front-door default. - Existing
@deprecateduse on a class remains supported; no code change or decorator rewrite is required. It permanently delegates todeprecated_class()and emits one informationalUserWarningper module-qualified class.stream=Nonesuppresses the notice. Only the notice, not backward support or delegation, is removed in v1.0. message_templateandskip_ifsupplied through@deprecatedon a class now reach the proxy.message_templatewas previously dropped on that path.- Non-callable sources now raise a direct
TypeErrorpointing users todeprecated_instance()instead of failing later on__name__. -
Explicit
target=TargetMode.NOTIFYtogether with a mapping still emitsUserWarning, staysNOTIFY, leaves the mapping inert, and is marked misconfigured. This is unchanged from v0.11.0, and aTypeErrorin v1.0. What changed is that an omittedtargetno longer lands here: it auto-resolves instead. Omittargetto infer remapping, or select the matching remap mode explicitly. -
Griffe's
RuntimeDocstringsextension now scopes its docstring-replacement guard to pyDeprecate's own__deprecation_config__metadata (get_deprecation_config(obj) is not None). This replaces a bare truthiness check on__deprecated__. A foreign object decorated only with the stdlib'swarnings.deprecated/typing_extensions.deprecatedpreviously passed that truthy check too. Such an object has a string-valued__deprecated__and no pyDeprecate metadata. It no longer passes the check, since it was never meant to be replaced. -
v0.14 ships
py.typed, so type checkers now read pyDeprecate's own types instead of treating every object asAny. Runtime behavior is unchanged; only checker output moves. Old: DeprecationProxy[New] = deprecated_class(target=New, ...)(Cls)no longer type-checks. A call-formdeprecated_class(...)alias is typed as the class it forwards to (type[New]with a classtarget, otherwise the wrapped class), so drop the annotation.DeprecationProxy[T]remains the annotation fordeprecated_instance()proxies.- Old names accepted only through
args_mapping/attrs_mappingare reported on call-form aliases ascall-arg/attr-defined. The decorator form already did this under mypy. To keep such call sites type-checking during the migration window, choose either approach:- Keep the old names in a legacy class body (decorator form).
- Wrap the alias in
cast(DeprecationProxy[New], ...);isinstanceagainst the alias then stops type-checking.
- Proxy-only attributes such as
__wrapped__and__deprecation_config__are invisible ontype[New]. Read them withget_deprecation_config(Old)orinspect.unwrap(Old). -
Setting
__deprecated__on a deprecated proxy now keeps the marker on the proxy. Deleting it no longer removes the wrapped object's own marker; reading it after deletion raisesAttributeError.copy.copy,copy.deepcopy, andpicklekeep a PEP 702 message written onto the proxy. -
Calls that need no forwarding preserve the caller's positional and keyword argument form. A call that needs no forwarding, rename or extra argument reaches the source exactly as made.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
*args, which stay positional. - A custom stream that raises no longer leaves warning bookkeeping or emission context stuck. On a deprecated proxy, a warning that fails to deliver does not spend the warning budget. A decorated function still spends it.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
- Warnings that reported a pyDeprecate frame now point at the caller. Call-time warnings already named the user's call site. The remaining ones, notably the inner warning of a stacked deprecation chain, now carry the caller's line and module too. A warning filter keyed on
module="deprecate"that matched those warnings no longer does. Those warnings therefore surface, and raise under-W error. Key filters on the calling module instead. - Async proxy warnings are emitted when the underlying awaitable or async iterator is obtained. A later failure or exhaustion during
awaitor__anext__still consumes the warning budget.- If the warning itself fails, a coroutine the wrapped call created is closed. A coroutine the wrapped object holds as an attribute, or is itself, is left usable.
next()on a deprecated proxy now warns before the wrapped iterator advances, so a failed warning consumes no item. Calling the proxy also warns first, as@deprecateddoes. Other synchronous operations still warn only after success.- In-place operators and
defaultdictsubscripts keep their effect if delivery fails.
- A custom
streamis called exactly once, with its signature read before the call. A stream that declares**kwargsreceivesstacklevel=and must accept or drop it. Forward it towarnings.warnorlogging.warning;print(msg, **kwargs)raisesTypeError. Declaredef sink(msg)to receive the message alone. A bare(*args, **kwargs)functools.wrapspass-through is judged by the callable it wraps, also when afunctools.partialbinds it. A stream whose only parameter is namedstacklevelreceives the message alone. skip_ifnow covers item and in-place writes. Withskip_ifactive,proxy[key] = value,del proxy[key]and in-place operators write to the wrapped object. The read-only guard does not apply. A fatal proxy (as_exception=True) raisesDeprecatedErrorbefore a subscript, iteration or mapped attribute read touches the wrapped object.- Deprecated generators warn on the first iteration, not at the call. A deprecated generator function keeps
inspect.isgeneratorfunction. A deprecated async-generator function keepsinspect.isasyncgenfunction, so pytestyieldfixtures run their setup and teardown. The warning, thenum_warnsbudget,skip_if, argument binding and anas_exception/as_exceptions()error now resolve on the firstnext()/__anext__(). A generator that is never iterated never warns. Movepytest.warns()andpytest.raises()around the first iteration, and keepas_exceptions()active at that step. - An empty-string
args_mappingvalue keeps the argument. Under@deprecated,args_mapping={"old_arg": ""}now passesold_argthrough under its old name, asdeprecated_classalways did. A**kwargstarget therefore receives it; onlyNonedrops an argument. Map the argument toNoneif you relied on""dropping it. - Proxies carry only the protocols of the wrapped object or its replacement. A deprecated
dictis no longercallable(), anIterator,os.PathLike,AwaitableorAsyncIterable. A protocol the object disables stays disabled.type(proxy) is _DeprecatedProxyis nowFalse; useisinstance(proxy, DeprecationProxy). The generated proxy subclasses cannot be pickled by reference. - Forwarding to a
classmethodchecks the source's shape at decoration. Any receiver name works (klass,mcs).- These source shapes raise
TypeErrorat decoration:- A source with no leading positional parameter raises the error.
- A source with a later parameter named like the target's receiver raises the error.
- A static or plain source given a non-class first argument raises
TypeErrorbefore warning.
- These source shapes raise
- CLI arguments follow
argparse.- Spellings only the Fire-based CLI accepted exit
2:- A quoted literal such as
--version '"0.10"'exits2. - A list literal in
--excludeexits2; pass comma-separated patterns. - A table in
--min-graceexits2; set it inpyproject.toml. --path=pkgexits2.- Short flags such as
-rexit2. - An empty
--report-json=exits2. - Abbreviated option names exit
2. - Before v0.16, a second positional path exits
2; since v0.16 every subcommand takes several paths.
- A quoted literal such as
- A boolean flag given a value accepts only
true,false,1or0. Use the bare flag or--no-<flag>otherwise.
- Spellings only the Fire-based CLI accepted exit
- CLI exit codes changed.
checkandallexit1on misconfigured targets and inner-order@property @deprecatedwrappers, which used to pass. A scan error or internal error exits3instead of1, and--exit-zeromasks neither2nor3.- These inputs exit
2:- A single
.pyfile exits2. - A directory holding several packages exits
2. - A name that is neither a path nor an importable module exits
2.
- A single
- Check how CI steps treat
2and3.
- These inputs exit
deprecated_module(stream=None)warns at the call. An explicitstream=Nonestill delivers throughwarnings.warnbut emits aFutureWarning. In v1.0 it silences the module warning, and thenum_warnsdefault changes from-1to1. Omitstreamfor today's delivery and passnum_warns=-1to keep a warning on every access.-
DeprecationWrapperInfo.empty_mappingandidentity_mappingwarn withFutureWarning. Reading the deprecated aliases now emitsFutureWarningon every access instead ofDeprecationWarning, and raises under fatal mode. Readempty_args_mappingandidentity_args_mappinginstead. -
read_only=Trueproxies block six more methods.sort,reverse,popitem,difference_update,intersection_updateandsymmetric_difference_updatenow raiseAttributeErrorinstead of changing the wrapped list, dict or set. The guarded names go from 10 to 16, and a custom method with one of these names is blocked too. - A proxy with a callable
targetandargs_mappingshares one warning budget per call.deprecated_classanddeprecated_instanceemit one call-level warning per call instead of one per renamed keyword, and its message names the replacement rather than each renamed keyword. A test that counted or matched one warning per renamed keyword now changes. - Audit reports a function bound under several names under its own public name. When an alias used to sort first, the row and its finding id carried the alias. A name-based allowlist,
--ignorepattern or committed snapshot keyed on that alias needs the function's own name instead.
Coming from v0.2.x🔗
- Update warning filters and assertions from
DeprecationWarningtoFutureWarning. Application users now see the warnings under Python's default filters. - Run on Python 3.9 or newer. Python 3.8 support was removed.
-
Review the license change from MIT to Apache-2.0 if your distribution or compliance process records dependency licenses.
-
Fix cross-class method forwarding. Passing a class target to a non-
__init__instance method now raisesTypeErrorat decoration time instead of forwarding aselfof the wrong type. -
Replace API names deprecated until v1.0:
Deprecated API Replacement find_deprecated_callablesfind_deprecation_wrappersvalidate_deprecated_callablevalidate_deprecation_wrapperDeprecatedCallableInfoDeprecationWrapperInfono_warning_callassert_no_warnings -
Replace
target=NonewithTargetMode.NOTIFYor omittargetfor a warn-only decorator. - Replace
target=TruewithTargetMode.ARGS_REMAP. - Replace
DeprecationWrapperInfo.empty_mappingwithempty_args_mapping, andidentity_mappingwithidentity_args_mapping. The old properties warn and are removed in v1.0. - If code inspects
wrapper.__deprecated__.target, compare with aTargetMode, callable, orNone.DeprecationConfig.targetstores a normalized value, never legacyTrueorFalse. -
Update external documentation bookmarks from flat paths such as
/pyDeprecate/troubleshooting.htmlto the versioned/pyDeprecate/stable/troubleshooting.htmllayout. -
Rename the CLI flag
--skip_errorsto--exit-zeroin everycheck,expiry,chains, andallcommand. The old flag is rejected.--exit_zeroremains an underscore alias, but the dashed spelling is canonical. -
Fix unsupported stacked decorators. Six shapes, including callable-over-callable, now emit
UserWarningat decoration time and becomeTypeErrorin v1.0. The supported lifecycle stack is outerARGS_REMAPplus innerNOTIFY. -
Outer-order deprecated properties now warn on read, write, and delete. Under
filterwarnings=error::FutureWarning, a setter or deleter that was previously silent now raises. If only reads should warn, keep inner order (@propertyoutside@deprecated) or decorate onlyfget. -
Update proxy detection.
proxy.__class__reports the wrapped object's type forisinstancetransparency. Usetype(proxy)when you need to detect_DeprecatedProxyitself. - Do not use an instance proxy as the second argument to
isinstance()orissubclass(). This misuse now raisesTypeErrorinstead of returningFalse. Class-alias proxies remain valid there. - Review expiry CI scope.
validate_deprecation_expiry()now defaults toinclude_members=True, so expired methods, constructors, descriptors, and properties can newly fail the gate. Passinclude_members=Falseonly when the old narrower scope is intentional. - Fix invalid
remove_inversions. An unparsableremove_innow emitsUserWarningduring batch expiry instead of being skipped silently. - Fix misspelled CLI flags. Unknown flags now fail instead of being silently ignored.
-
Use named
%fields in custom message templates. Bare%sor%dconversions now raiseValueErrorwhen the decorator is applied. -
@deprecated(target=TargetMode.ATTRS_REMAP)now raisesTypeErrorfor a class source. It already raised for functions.ATTRS_REMAPneeds the class-onlyattrs_mappingkeyword, which the common front door does not expose. A class source therefore previously built a proxy that remapped nothing. Usedeprecated_class(attrs_mapping=...). -
Rename
template_mgstomessage_templateondeprecated(),deprecated_callable(),deprecated_class(), anddeprecated_instance(). The typo remains a warning alias until v1.0; supplying both names raisesTypeError. -
__deprecated__is now a plain PEP 702-conformant message string, not theDeprecationConfigobject. The config object moved to__deprecation_config__.- Code reading
func.__deprecated__.target,.deprecated_in,.args_mapping, or any other config field now gets a plainstr. So does code checkingisinstance(func.__deprecated__, DeprecationConfig). It either raisesAttributeErroror evaluatesFalse. - Replace direct reads with the public
get_deprecation_config(obj)helper. It also falls back to a legacy__deprecated__-as-config layout for objects built by a pyDeprecate release before v0.13. This affects every wrapper kind — functions, methods, class proxies (deprecated_class), instance proxies (deprecated_instance), and modules (deprecated_module).
- Code reading
-
A function
deprecated_instancestored as a class attribute now binds like a method, and only plain functions do.- Instance access passes
selfto the wrapped function; usestaticmethod(deprecated_instance(...))for static-style access. - A
functools.partial, bound method, builtin or Cython binding callable is served unbound and silent instead. A deprecatedpartialclass attribute is therefore no longer bound by Python.
- Instance access passes
-
functools.partial,partialmethodandsingledispatchmethodsources now raiseTypeErrorat decoration. This includes a named partial (given a__name__throughfunctools.update_wrapper) that 0.14 accepted. Wrap the object in a plaindefthat calls it and decorate thatdef. -
An operand after
--is always a path, never the legacy positional version.pydeprecate expiry -- src/pkg 2.0now treats2.0as a second path instead of reading it as the version, and exits2when no such path exists. Pass--version 2.0. - A second positional version on
expiry,allandstatusis deprecated. With two positionals, the second is a path first. It is read as a version only when it names no path or findable module and parses as one; that spelling prints a notice on stderr and stops working in v1.0. Pass--versioninstead; passing both exits2. - The empty
cliextra is removed. Thepydeprecatecommand needs no dependency, so replacepyDeprecate[cli]with the base package, or withpyDeprecate[audit]when you use the audit extras.pip install 'pyDeprecate[cli]'still installs, with pip's warning that the extra does not exist.
-
Mapping errors now include the originating class or function name. Tests that assert complete error strings may need updated expected text.
-
Across the v0.6.x line, backward support for
@deprecatedon a class was restored through delegation todeprecated_class(). Existing class decorators need no rewrite for v0.12; delegation remains permanent and only its informational notice is scheduled for removal. -
Omitting
deprecated_inon a function or method emitsUserWarningat decoration time. Add the version as part of every deprecation lifecycle. ARGS_REMAPwithoutargs_mapping,NOTIFYwithargs_mappingorargs_extra, and invalidtarget=Falsenow warn immediately. These are migration failures, not harmless diagnostics; correct them before v1.0.-
Omitting
targetis the canonical warn-only form. Its v0.12 default isTargetMode.AUTO, which resolves toNOTIFYwhen no mapping is present, so the user-visible result is unchanged. -
CLI scans suppress only warnings from
deprecate.*; third-party warnings are now visible. CI that treats all warnings as errors may start failing on dependencies imported during a scan. -
Audit code sees the supported
ARGS_REMAP + NOTIFYchain asChainType.STACKED, notChainType.TARGET. -
When a caller supplies both deprecated and replacement keyword names, the explicit replacement value now wins regardless of call-site order.
-
Circular callable-target chains now raise a named
RuntimeErrorinstead of ending inRecursionError. -
repr(),str(), equality, and hashing on a target-forwarding proxy now reflect the active target rather than the deprecated source. - In-place operators such as
proxy += 1rebind the name to the unwrapped result. Later uses are silent; avoid in-place operators if the proxy must retain its warning budget. args_mapping,args_extra, andattrs_mappingare copied at decoration time. Mutating the original dict later no longer changes forwarding behavior.- Constructing an
attrs_mapping-only class proxy is now silent; only access to a listed deprecated attribute warns. - Concurrent calls now respect exactly the configured
num_warnsbudget. Tests that accidentally relied on one warning per racing thread will see fewer warnings. -
Recursive audits can change counts and rows in both directions. They now:
- They deduplicate re-exports.
- They include deprecated private and dunder members.
- They warn and skip submodules that fail to import.
- They ignore unrelated foreign objects that raise during metadata probing.
-
@deprecatednow defaults toTargetMode.AUTO. It resolves at decoration time: a function/class withargs_mappingbecomesARGS_REMAP; a source without a mapping becomes warn-only.AUTOis never stored inDeprecationConfig. Do not pass it explicitly because it exists only as the front-door default. - Existing
@deprecateduse on a class remains supported; no code change or decorator rewrite is required. It permanently delegates todeprecated_class()and emits one informationalUserWarningper module-qualified class.stream=Nonesuppresses the notice. Only the notice, not backward support or delegation, is removed in v1.0. message_templateandskip_ifsupplied through@deprecatedon a class now reach the proxy.message_templatewas previously dropped on that path.- Non-callable sources now raise a direct
TypeErrorpointing users todeprecated_instance()instead of failing later on__name__. -
Explicit
target=TargetMode.NOTIFYtogether with a mapping still emitsUserWarning, staysNOTIFY, leaves the mapping inert, and is marked misconfigured. This is unchanged from v0.11.0, and aTypeErrorin v1.0. What changed is that an omittedtargetno longer lands here: it auto-resolves instead. Omittargetto infer remapping, or select the matching remap mode explicitly. -
Griffe's
RuntimeDocstringsextension now scopes its docstring-replacement guard to pyDeprecate's own__deprecation_config__metadata (get_deprecation_config(obj) is not None). This replaces a bare truthiness check on__deprecated__. A foreign object decorated only with the stdlib'swarnings.deprecated/typing_extensions.deprecatedpreviously passed that truthy check too. Such an object has a string-valued__deprecated__and no pyDeprecate metadata. It no longer passes the check, since it was never meant to be replaced. -
v0.14 ships
py.typed, so type checkers now read pyDeprecate's own types instead of treating every object asAny. Runtime behavior is unchanged; only checker output moves. Old: DeprecationProxy[New] = deprecated_class(target=New, ...)(Cls)no longer type-checks. A call-formdeprecated_class(...)alias is typed as the class it forwards to (type[New]with a classtarget, otherwise the wrapped class), so drop the annotation.DeprecationProxy[T]remains the annotation fordeprecated_instance()proxies.- Old names accepted only through
args_mapping/attrs_mappingare reported on call-form aliases ascall-arg/attr-defined. The decorator form already did this under mypy. To keep such call sites type-checking during the migration window, choose either approach:- Keep the old names in a legacy class body (decorator form).
- Wrap the alias in
cast(DeprecationProxy[New], ...);isinstanceagainst the alias then stops type-checking.
- Proxy-only attributes such as
__wrapped__and__deprecation_config__are invisible ontype[New]. Read them withget_deprecation_config(Old)orinspect.unwrap(Old). -
Setting
__deprecated__on a deprecated proxy now keeps the marker on the proxy. Deleting it no longer removes the wrapped object's own marker; reading it after deletion raisesAttributeError.copy.copy,copy.deepcopy, andpicklekeep a PEP 702 message written onto the proxy. -
Calls that need no forwarding preserve the caller's positional and keyword argument form. A call that needs no forwarding, rename or extra argument reaches the source exactly as made.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
*args, which stay positional. - A custom stream that raises no longer leaves warning bookkeeping or emission context stuck. On a deprecated proxy, a warning that fails to deliver does not spend the warning budget. A decorated function still spends it.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
- Warnings that reported a pyDeprecate frame now point at the caller. Call-time warnings already named the user's call site. The remaining ones, notably the inner warning of a stacked deprecation chain, now carry the caller's line and module too. A warning filter keyed on
module="deprecate"that matched those warnings no longer does. Those warnings therefore surface, and raise under-W error. Key filters on the calling module instead. - Async proxy warnings are emitted when the underlying awaitable or async iterator is obtained. A later failure or exhaustion during
awaitor__anext__still consumes the warning budget.- If the warning itself fails, a coroutine the wrapped call created is closed. A coroutine the wrapped object holds as an attribute, or is itself, is left usable.
next()on a deprecated proxy now warns before the wrapped iterator advances, so a failed warning consumes no item. Calling the proxy also warns first, as@deprecateddoes. Other synchronous operations still warn only after success.- In-place operators and
defaultdictsubscripts keep their effect if delivery fails.
- A custom
streamis called exactly once, with its signature read before the call. A stream that declares**kwargsreceivesstacklevel=and must accept or drop it. Forward it towarnings.warnorlogging.warning;print(msg, **kwargs)raisesTypeError. Declaredef sink(msg)to receive the message alone. A bare(*args, **kwargs)functools.wrapspass-through is judged by the callable it wraps, also when afunctools.partialbinds it. A stream whose only parameter is namedstacklevelreceives the message alone. skip_ifnow covers item and in-place writes. Withskip_ifactive,proxy[key] = value,del proxy[key]and in-place operators write to the wrapped object. The read-only guard does not apply. A fatal proxy (as_exception=True) raisesDeprecatedErrorbefore a subscript, iteration or mapped attribute read touches the wrapped object.- Deprecated generators warn on the first iteration, not at the call. A deprecated generator function keeps
inspect.isgeneratorfunction. A deprecated async-generator function keepsinspect.isasyncgenfunction, so pytestyieldfixtures run their setup and teardown. The warning, thenum_warnsbudget,skip_if, argument binding and anas_exception/as_exceptions()error now resolve on the firstnext()/__anext__(). A generator that is never iterated never warns. Movepytest.warns()andpytest.raises()around the first iteration, and keepas_exceptions()active at that step. - An empty-string
args_mappingvalue keeps the argument. Under@deprecated,args_mapping={"old_arg": ""}now passesold_argthrough under its old name, asdeprecated_classalways did. A**kwargstarget therefore receives it; onlyNonedrops an argument. Map the argument toNoneif you relied on""dropping it. - Proxies carry only the protocols of the wrapped object or its replacement. A deprecated
dictis no longercallable(), anIterator,os.PathLike,AwaitableorAsyncIterable. A protocol the object disables stays disabled.type(proxy) is _DeprecatedProxyis nowFalse; useisinstance(proxy, DeprecationProxy). The generated proxy subclasses cannot be pickled by reference. - Forwarding to a
classmethodchecks the source's shape at decoration. Any receiver name works (klass,mcs).- These source shapes raise
TypeErrorat decoration:- A source with no leading positional parameter raises the error.
- A source with a later parameter named like the target's receiver raises the error.
- A static or plain source given a non-class first argument raises
TypeErrorbefore warning.
- These source shapes raise
- CLI arguments follow
argparse.- Spellings only the Fire-based CLI accepted exit
2:- A quoted literal such as
--version '"0.10"'exits2. - A list literal in
--excludeexits2; pass comma-separated patterns. - A table in
--min-graceexits2; set it inpyproject.toml. --path=pkgexits2.- Short flags such as
-rexit2. - An empty
--report-json=exits2. - Abbreviated option names exit
2. - Before v0.16, a second positional path exits
2; since v0.16 every subcommand takes several paths.
- A quoted literal such as
- A boolean flag given a value accepts only
true,false,1or0. Use the bare flag or--no-<flag>otherwise.
- Spellings only the Fire-based CLI accepted exit
- CLI exit codes changed.
checkandallexit1on misconfigured targets and inner-order@property @deprecatedwrappers, which used to pass. A scan error or internal error exits3instead of1, and--exit-zeromasks neither2nor3.- These inputs exit
2:- A single
.pyfile exits2. - A directory holding several packages exits
2. - A name that is neither a path nor an importable module exits
2.
- A single
- Check how CI steps treat
2and3.
- These inputs exit
deprecated_module(stream=None)warns at the call. An explicitstream=Nonestill delivers throughwarnings.warnbut emits aFutureWarning. In v1.0 it silences the module warning, and thenum_warnsdefault changes from-1to1. Omitstreamfor today's delivery and passnum_warns=-1to keep a warning on every access.-
DeprecationWrapperInfo.empty_mappingandidentity_mappingwarn withFutureWarning. Reading the deprecated aliases now emitsFutureWarningon every access instead ofDeprecationWarning, and raises under fatal mode. Readempty_args_mappingandidentity_args_mappinginstead. -
read_only=Trueproxies block six more methods.sort,reverse,popitem,difference_update,intersection_updateandsymmetric_difference_updatenow raiseAttributeErrorinstead of changing the wrapped list, dict or set. The guarded names go from 10 to 16, and a custom method with one of these names is blocked too. - A proxy with a callable
targetandargs_mappingshares one warning budget per call.deprecated_classanddeprecated_instanceemit one call-level warning per call instead of one per renamed keyword, and its message names the replacement rather than each renamed keyword. A test that counted or matched one warning per renamed keyword now changes. - Audit reports a function bound under several names under its own public name. When an alias used to sort first, the row and its finding id carried the alias. A name-based allowlist,
--ignorepattern or committed snapshot keyed on that alias needs the function's own name instead.
Coming from v0.1.x🔗
- Update warning filters and assertions from
DeprecationWarningtoFutureWarning. Application users now see the warnings under Python's default filters. - Run on Python 3.9 or newer. Python 3.8 support was removed.
-
Review the license change from MIT to Apache-2.0 if your distribution or compliance process records dependency licenses.
-
Fix cross-class method forwarding. Passing a class target to a non-
__init__instance method now raisesTypeErrorat decoration time instead of forwarding aselfof the wrong type. -
Replace API names deprecated until v1.0:
Deprecated API Replacement find_deprecated_callablesfind_deprecation_wrappersvalidate_deprecated_callablevalidate_deprecation_wrapperDeprecatedCallableInfoDeprecationWrapperInfono_warning_callassert_no_warnings -
Replace
target=NonewithTargetMode.NOTIFYor omittargetfor a warn-only decorator. - Replace
target=TruewithTargetMode.ARGS_REMAP. - Replace
DeprecationWrapperInfo.empty_mappingwithempty_args_mapping, andidentity_mappingwithidentity_args_mapping. The old properties warn and are removed in v1.0. - If code inspects
wrapper.__deprecated__.target, compare with aTargetMode, callable, orNone.DeprecationConfig.targetstores a normalized value, never legacyTrueorFalse. -
Update external documentation bookmarks from flat paths such as
/pyDeprecate/troubleshooting.htmlto the versioned/pyDeprecate/stable/troubleshooting.htmllayout. -
Rename the CLI flag
--skip_errorsto--exit-zeroin everycheck,expiry,chains, andallcommand. The old flag is rejected.--exit_zeroremains an underscore alias, but the dashed spelling is canonical. -
Fix unsupported stacked decorators. Six shapes, including callable-over-callable, now emit
UserWarningat decoration time and becomeTypeErrorin v1.0. The supported lifecycle stack is outerARGS_REMAPplus innerNOTIFY. -
Outer-order deprecated properties now warn on read, write, and delete. Under
filterwarnings=error::FutureWarning, a setter or deleter that was previously silent now raises. If only reads should warn, keep inner order (@propertyoutside@deprecated) or decorate onlyfget. -
Update proxy detection.
proxy.__class__reports the wrapped object's type forisinstancetransparency. Usetype(proxy)when you need to detect_DeprecatedProxyitself. - Do not use an instance proxy as the second argument to
isinstance()orissubclass(). This misuse now raisesTypeErrorinstead of returningFalse. Class-alias proxies remain valid there. - Review expiry CI scope.
validate_deprecation_expiry()now defaults toinclude_members=True, so expired methods, constructors, descriptors, and properties can newly fail the gate. Passinclude_members=Falseonly when the old narrower scope is intentional. - Fix invalid
remove_inversions. An unparsableremove_innow emitsUserWarningduring batch expiry instead of being skipped silently. - Fix misspelled CLI flags. Unknown flags now fail instead of being silently ignored.
-
Use named
%fields in custom message templates. Bare%sor%dconversions now raiseValueErrorwhen the decorator is applied. -
@deprecated(target=TargetMode.ATTRS_REMAP)now raisesTypeErrorfor a class source. It already raised for functions.ATTRS_REMAPneeds the class-onlyattrs_mappingkeyword, which the common front door does not expose. A class source therefore previously built a proxy that remapped nothing. Usedeprecated_class(attrs_mapping=...). -
Rename
template_mgstomessage_templateondeprecated(),deprecated_callable(),deprecated_class(), anddeprecated_instance(). The typo remains a warning alias until v1.0; supplying both names raisesTypeError. -
__deprecated__is now a plain PEP 702-conformant message string, not theDeprecationConfigobject. The config object moved to__deprecation_config__.- Code reading
func.__deprecated__.target,.deprecated_in,.args_mapping, or any other config field now gets a plainstr. So does code checkingisinstance(func.__deprecated__, DeprecationConfig). It either raisesAttributeErroror evaluatesFalse. - Replace direct reads with the public
get_deprecation_config(obj)helper. It also falls back to a legacy__deprecated__-as-config layout for objects built by a pyDeprecate release before v0.13. This affects every wrapper kind — functions, methods, class proxies (deprecated_class), instance proxies (deprecated_instance), and modules (deprecated_module).
- Code reading
-
A function
deprecated_instancestored as a class attribute now binds like a method, and only plain functions do.- Instance access passes
selfto the wrapped function; usestaticmethod(deprecated_instance(...))for static-style access. - A
functools.partial, bound method, builtin or Cython binding callable is served unbound and silent instead. A deprecatedpartialclass attribute is therefore no longer bound by Python.
- Instance access passes
-
functools.partial,partialmethodandsingledispatchmethodsources now raiseTypeErrorat decoration. This includes a named partial (given a__name__throughfunctools.update_wrapper) that 0.14 accepted. Wrap the object in a plaindefthat calls it and decorate thatdef. -
An operand after
--is always a path, never the legacy positional version.pydeprecate expiry -- src/pkg 2.0now treats2.0as a second path instead of reading it as the version, and exits2when no such path exists. Pass--version 2.0. - A second positional version on
expiry,allandstatusis deprecated. With two positionals, the second is a path first. It is read as a version only when it names no path or findable module and parses as one; that spelling prints a notice on stderr and stops working in v1.0. Pass--versioninstead; passing both exits2. - The empty
cliextra is removed. Thepydeprecatecommand needs no dependency, so replacepyDeprecate[cli]with the base package, or withpyDeprecate[audit]when you use the audit extras.pip install 'pyDeprecate[cli]'still installs, with pip's warning that the extra does not exist.
-
Mapping errors now include the originating class or function name. Tests that assert complete error strings may need updated expected text.
-
Across the v0.6.x line, backward support for
@deprecatedon a class was restored through delegation todeprecated_class(). Existing class decorators need no rewrite for v0.12; delegation remains permanent and only its informational notice is scheduled for removal. -
Omitting
deprecated_inon a function or method emitsUserWarningat decoration time. Add the version as part of every deprecation lifecycle. ARGS_REMAPwithoutargs_mapping,NOTIFYwithargs_mappingorargs_extra, and invalidtarget=Falsenow warn immediately. These are migration failures, not harmless diagnostics; correct them before v1.0.-
Omitting
targetis the canonical warn-only form. Its v0.12 default isTargetMode.AUTO, which resolves toNOTIFYwhen no mapping is present, so the user-visible result is unchanged. -
CLI scans suppress only warnings from
deprecate.*; third-party warnings are now visible. CI that treats all warnings as errors may start failing on dependencies imported during a scan. -
Audit code sees the supported
ARGS_REMAP + NOTIFYchain asChainType.STACKED, notChainType.TARGET. -
When a caller supplies both deprecated and replacement keyword names, the explicit replacement value now wins regardless of call-site order.
-
Circular callable-target chains now raise a named
RuntimeErrorinstead of ending inRecursionError. -
repr(),str(), equality, and hashing on a target-forwarding proxy now reflect the active target rather than the deprecated source. - In-place operators such as
proxy += 1rebind the name to the unwrapped result. Later uses are silent; avoid in-place operators if the proxy must retain its warning budget. args_mapping,args_extra, andattrs_mappingare copied at decoration time. Mutating the original dict later no longer changes forwarding behavior.- Constructing an
attrs_mapping-only class proxy is now silent; only access to a listed deprecated attribute warns. - Concurrent calls now respect exactly the configured
num_warnsbudget. Tests that accidentally relied on one warning per racing thread will see fewer warnings. -
Recursive audits can change counts and rows in both directions. They now:
- They deduplicate re-exports.
- They include deprecated private and dunder members.
- They warn and skip submodules that fail to import.
- They ignore unrelated foreign objects that raise during metadata probing.
-
@deprecatednow defaults toTargetMode.AUTO. It resolves at decoration time: a function/class withargs_mappingbecomesARGS_REMAP; a source without a mapping becomes warn-only.AUTOis never stored inDeprecationConfig. Do not pass it explicitly because it exists only as the front-door default. - Existing
@deprecateduse on a class remains supported; no code change or decorator rewrite is required. It permanently delegates todeprecated_class()and emits one informationalUserWarningper module-qualified class.stream=Nonesuppresses the notice. Only the notice, not backward support or delegation, is removed in v1.0. message_templateandskip_ifsupplied through@deprecatedon a class now reach the proxy.message_templatewas previously dropped on that path.- Non-callable sources now raise a direct
TypeErrorpointing users todeprecated_instance()instead of failing later on__name__. -
Explicit
target=TargetMode.NOTIFYtogether with a mapping still emitsUserWarning, staysNOTIFY, leaves the mapping inert, and is marked misconfigured. This is unchanged from v0.11.0, and aTypeErrorin v1.0. What changed is that an omittedtargetno longer lands here: it auto-resolves instead. Omittargetto infer remapping, or select the matching remap mode explicitly. -
Griffe's
RuntimeDocstringsextension now scopes its docstring-replacement guard to pyDeprecate's own__deprecation_config__metadata (get_deprecation_config(obj) is not None). This replaces a bare truthiness check on__deprecated__. A foreign object decorated only with the stdlib'swarnings.deprecated/typing_extensions.deprecatedpreviously passed that truthy check too. Such an object has a string-valued__deprecated__and no pyDeprecate metadata. It no longer passes the check, since it was never meant to be replaced. -
v0.14 ships
py.typed, so type checkers now read pyDeprecate's own types instead of treating every object asAny. Runtime behavior is unchanged; only checker output moves. Old: DeprecationProxy[New] = deprecated_class(target=New, ...)(Cls)no longer type-checks. A call-formdeprecated_class(...)alias is typed as the class it forwards to (type[New]with a classtarget, otherwise the wrapped class), so drop the annotation.DeprecationProxy[T]remains the annotation fordeprecated_instance()proxies.- Old names accepted only through
args_mapping/attrs_mappingare reported on call-form aliases ascall-arg/attr-defined. The decorator form already did this under mypy. To keep such call sites type-checking during the migration window, choose either approach:- Keep the old names in a legacy class body (decorator form).
- Wrap the alias in
cast(DeprecationProxy[New], ...);isinstanceagainst the alias then stops type-checking.
- Proxy-only attributes such as
__wrapped__and__deprecation_config__are invisible ontype[New]. Read them withget_deprecation_config(Old)orinspect.unwrap(Old). -
Setting
__deprecated__on a deprecated proxy now keeps the marker on the proxy. Deleting it no longer removes the wrapped object's own marker; reading it after deletion raisesAttributeError.copy.copy,copy.deepcopy, andpicklekeep a PEP 702 message written onto the proxy. -
Calls that need no forwarding preserve the caller's positional and keyword argument form. A call that needs no forwarding, rename or extra argument reaches the source exactly as made.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
*args, which stay positional. - A custom stream that raises no longer leaves warning bookkeeping or emission context stuck. On a deprecated proxy, a warning that fails to deliver does not spend the warning budget. A decorated function still spends it.
- A call forwarded to a callable target is passed by keyword. The exceptions are positional-only parameters and surplus
- Warnings that reported a pyDeprecate frame now point at the caller. Call-time warnings already named the user's call site. The remaining ones, notably the inner warning of a stacked deprecation chain, now carry the caller's line and module too. A warning filter keyed on
module="deprecate"that matched those warnings no longer does. Those warnings therefore surface, and raise under-W error. Key filters on the calling module instead. - Async proxy warnings are emitted when the underlying awaitable or async iterator is obtained. A later failure or exhaustion during
awaitor__anext__still consumes the warning budget.- If the warning itself fails, a coroutine the wrapped call created is closed. A coroutine the wrapped object holds as an attribute, or is itself, is left usable.
next()on a deprecated proxy now warns before the wrapped iterator advances, so a failed warning consumes no item. Calling the proxy also warns first, as@deprecateddoes. Other synchronous operations still warn only after success.- In-place operators and
defaultdictsubscripts keep their effect if delivery fails.
- A custom
streamis called exactly once, with its signature read before the call. A stream that declares**kwargsreceivesstacklevel=and must accept or drop it. Forward it towarnings.warnorlogging.warning;print(msg, **kwargs)raisesTypeError. Declaredef sink(msg)to receive the message alone. A bare(*args, **kwargs)functools.wrapspass-through is judged by the callable it wraps, also when afunctools.partialbinds it. A stream whose only parameter is namedstacklevelreceives the message alone. skip_ifnow covers item and in-place writes. Withskip_ifactive,proxy[key] = value,del proxy[key]and in-place operators write to the wrapped object. The read-only guard does not apply. A fatal proxy (as_exception=True) raisesDeprecatedErrorbefore a subscript, iteration or mapped attribute read touches the wrapped object.- Deprecated generators warn on the first iteration, not at the call. A deprecated generator function keeps
inspect.isgeneratorfunction. A deprecated async-generator function keepsinspect.isasyncgenfunction, so pytestyieldfixtures run their setup and teardown. The warning, thenum_warnsbudget,skip_if, argument binding and anas_exception/as_exceptions()error now resolve on the firstnext()/__anext__(). A generator that is never iterated never warns. Movepytest.warns()andpytest.raises()around the first iteration, and keepas_exceptions()active at that step. - An empty-string
args_mappingvalue keeps the argument. Under@deprecated,args_mapping={"old_arg": ""}now passesold_argthrough under its old name, asdeprecated_classalways did. A**kwargstarget therefore receives it; onlyNonedrops an argument. Map the argument toNoneif you relied on""dropping it. - Proxies carry only the protocols of the wrapped object or its replacement. A deprecated
dictis no longercallable(), anIterator,os.PathLike,AwaitableorAsyncIterable. A protocol the object disables stays disabled.type(proxy) is _DeprecatedProxyis nowFalse; useisinstance(proxy, DeprecationProxy). The generated proxy subclasses cannot be pickled by reference. - Forwarding to a
classmethodchecks the source's shape at decoration. Any receiver name works (klass,mcs).- These source shapes raise
TypeErrorat decoration:- A source with no leading positional parameter raises the error.
- A source with a later parameter named like the target's receiver raises the error.
- A static or plain source given a non-class first argument raises
TypeErrorbefore warning.
- These source shapes raise
- CLI arguments follow
argparse.- Spellings only the Fire-based CLI accepted exit
2:- A quoted literal such as
--version '"0.10"'exits2. - A list literal in
--excludeexits2; pass comma-separated patterns. - A table in
--min-graceexits2; set it inpyproject.toml. --path=pkgexits2.- Short flags such as
-rexit2. - An empty
--report-json=exits2. - Abbreviated option names exit
2. - Before v0.16, a second positional path exits
2; since v0.16 every subcommand takes several paths.
- A quoted literal such as
- A boolean flag given a value accepts only
true,false,1or0. Use the bare flag or--no-<flag>otherwise.
- Spellings only the Fire-based CLI accepted exit
- CLI exit codes changed.
checkandallexit1on misconfigured targets and inner-order@property @deprecatedwrappers, which used to pass. A scan error or internal error exits3instead of1, and--exit-zeromasks neither2nor3.- These inputs exit
2:- A single
.pyfile exits2. - A directory holding several packages exits
2. - A name that is neither a path nor an importable module exits
2.
- A single
- Check how CI steps treat
2and3.
- These inputs exit
deprecated_module(stream=None)warns at the call. An explicitstream=Nonestill delivers throughwarnings.warnbut emits aFutureWarning. In v1.0 it silences the module warning, and thenum_warnsdefault changes from-1to1. Omitstreamfor today's delivery and passnum_warns=-1to keep a warning on every access.-
DeprecationWrapperInfo.empty_mappingandidentity_mappingwarn withFutureWarning. Reading the deprecated aliases now emitsFutureWarningon every access instead ofDeprecationWarning, and raises under fatal mode. Readempty_args_mappingandidentity_args_mappinginstead. -
read_only=Trueproxies block six more methods.sort,reverse,popitem,difference_update,intersection_updateandsymmetric_difference_updatenow raiseAttributeErrorinstead of changing the wrapped list, dict or set. The guarded names go from 10 to 16, and a custom method with one of these names is blocked too. - A proxy with a callable
targetandargs_mappingshares one warning budget per call.deprecated_classanddeprecated_instanceemit one call-level warning per call instead of one per renamed keyword, and its message names the replacement rather than each renamed keyword. A test that counted or matched one warning per renamed keyword now changes. - Audit reports a function bound under several names under its own public name. When an alias used to sort first, the row and its finding id carried the alias. A name-based allowlist,
--ignorepattern or committed snapshot keyed on that alias needs the function's own name instead.
If you hit anything not covered here, open an issue — we are happy to help.