Deprecated

Deprecation decorator for Python functions and classes — emits DeprecationWarning or other warnings when deprecated code is called. deprecated features: @deprecated decorator for functions/methods/classes, reason= parameter for migration instructions, version= parameter for when deprecation was introduced, action= parameter for warning category (always/once/default/error/ignore), category= for custom warning class, @deprecated.classic.deprecated for simpler API, wrapt-based transparent wrapping that preserves function signatures, and __deprecated__ attribute for deprecation metadata.

Evaluated Mar 06, 2026 (0d ago) v1.2.x
Homepage ↗ Repo ↗ Developer Tools python deprecated decorator warning api versioning maintenance
⚙ Agent Friendliness
69
/ 100
Can an agent use this?
🔒 Security
91
/ 100
Is it safe for agents?
⚡ Reliability
89
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
88
Error Messages
88
Auth Simplicity
99
Rate Limits
99

🔒 Security

TLS Enforcement
92
Auth Strength
92
Scope Granularity
90
Dep. Hygiene
90
Secret Handling
92

Pure decorator utility with no network calls. No security concerns. Deprecation warnings should not contain sensitive information in reason strings (reason is displayed to end users).

⚡ Reliability

Uptime/SLA
88
Version Stability
90
Breaking Changes
90
Error Recovery
88
AF Security Reliability

Best When

Signaling API deprecations in Python libraries during transition periods — deprecated's wrapt-based transparent wrapper correctly handles all callable types while emitting discoverable warnings.

Avoid When

You want to remove code immediately (just delete it), need hard enforcement (use action='error'), or managing deprecations across non-Python APIs.

Use Cases

  • Agent API versioning — from deprecated import deprecated; @deprecated(reason='Use process_v2() instead. process() will be removed in 3.0.'); def process(data): return process_v2(data) — deprecation notice; agent library migration guides users to new API; DeprecationWarning shows in logs; original function still works during transition
  • Agent version-tagged deprecation — @deprecated(version='2.1.0', reason='Use AsyncAgent class instead.'); class SyncAgent: pass — versioned deprecation; agent changelog integration; users know which version introduced deprecation; version parameter documents timeline
  • Agent warning level control — @deprecated(reason='Use new_method()', action='error'); def old_method(): pass — raise exception instead of warning; agent enforcing migration blocks use of old API with clear error; useful in strict environments where warnings are missed
  • Agent class deprecation — @deprecated(reason='Replaced by AgentV2 with async support'); class OldAgent: def run(self): pass — class-level deprecation; instantiating OldAgent emits warning; all method calls on instance also warned; agent library signals entire class is superseded
  • Agent custom warning class — import warnings; @deprecated(reason='Use new_func()', category=FutureWarning); def old_func(): pass — FutureWarning instead of DeprecationWarning; agent public API uses FutureWarning (shown by default in Python) instead of DeprecationWarning (hidden by default); better visibility for end users

Not For

  • Permanently removing code — deprecated provides warnings but code still runs; for removal, delete the code and update tests
  • Version enforcement — deprecated doesn't prevent old API use (unless action='error'); for hard enforcement remove the function
  • Changelog generation — deprecated is runtime warning only; for structured deprecation tracking use CHANGELOG.md

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

No auth — pure Python decorator utility.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

Deprecated is MIT licensed. Free for all use.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • DeprecationWarning hidden by default in Python — Python suppresses DeprecationWarning unless running in development mode; agent library users won't see deprecations unless they run: python -W default or python -W error; recommend users add: import warnings; warnings.filterwarnings('default', category=DeprecationWarning) in their code; or use FutureWarning (visible by default)
  • action='once' shows warning only at first call site — if old_api() is called from 3 different files, each file sees warning once; action='always' warns on every call; action='error' raises on every call; agent code testing that deprecation fires should use: with pytest.warns(DeprecationWarning): old_api()
  • @deprecated on class warns at instantiation — @deprecated class OldAgent: emits warning when OldAgent() is called; calling methods on the instance doesn't re-warn; agent code checking if warning is emitted must instantiate the class: with pytest.warns(DeprecationWarning): agent = OldAgent()
  • wrapt dependency version — deprecated depends on wrapt; if project also uses wrapt directly, version conflicts can occur; pip install deprecated installs wrapt automatically; check: pip show deprecated to verify wrapt version; avoid pinning different wrapt versions in same project
  • reason and version are display-only — @deprecated(reason='Use X', version='1.2') stores metadata but doesn't enforce version-based removal; agent CI doesn't automatically fail when deprecated code is called in tests; add: warnings.filterwarnings('error', category=DeprecationWarning) in test config to catch deprecated usage
  • Function signature preserved via wrapt — deprecated correctly preserves __doc__, __name__, __signature__ via wrapt wrapping; inspect.signature(deprecated_func) returns original signature; help(deprecated_func) shows original docstring plus deprecation notice; works correctly with IDEs and documentation generators

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Deprecated.

$99

Scores are editorial opinions as of 2026-03-06.

5208
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered