skillfed

deprecat

Python @deprecat decorator to deprecate old python classes, functions or methods.

deprecat v2.1.3 350.8K downloads/30d#7,327 on PyPI16
Permissive license MIT DORMANT released

What it is and what it does

deprecat is a lightweight decorator library for marking Python functions, methods, and classes as deprecated. When a user calls a deprecated target, the decorator emits a standard DeprecationWarning with a custom reason and version number, helping library maintainers signal API changes without breaking existing code.

The package includes a Sphinx integration that automatically injects deprecation notices into docstrings, making the deprecation visible in generated documentation. It supports deprecating individual keyword arguments as well, allowing fine-grained control over which parts of an API are being phased out. The single runtime dependency is wrapt, and installation is straightforward.

Use it for:

  • Signal to users that a function or method will be removed in a future version, with a custom reason and target version.
  • Automatically inject deprecation warnings into Sphinx-generated API documentation without manual docstring edits.
  • Deprecate specific keyword arguments in a function while keeping the function itself active.
  • Emit warnings when a class is instantiated to guide users toward a replacement class.
  • Track and communicate API changes across library versions in a standardized, Python-native way.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a Python decorator to mark functions, methods, and classes as deprecated, emitting warnings to users and optionally modifying docstrings for Sphinx documentation.

Yes, if you are maintaining a library and need a simple, zero-configuration way to emit deprecation warnings. The package is stable, has no vulnerabilities, and requires only one lightweight dependency. Maintenance is dormant, but the decorator pattern itself is stable and unlikely to need updates. Not recommended if you need active support or expect frequent maintenance.

Install

deprecat on PyPI

pip

pip install deprecat

uv

uv add deprecat

poetry

poetry add deprecat

Installing deprecat

Before you install

Low install friction with a single runtime dependency (wrapt). Maintenance is dormant—last commit 2024-07-24—but marked Production/Stable with no known vulnerabilities, so usable for straightforward deprecation tasks.

License in practice

MIT license (permissive) means you can use, modify, and distribute this package freely in commercial or open-source projects with minimal restrictions.

Quickstart

pip install deprecat

from deprecat import deprecat

@deprecat(reason="use new_function instead", version='2.0')
def old_function(x):
    return x * 2

old_function(5)  # Emits DeprecationWarning

Requires Python >=3.6; wrapt must be installed (handled automatically by pip).

Verify before relying

  • Whether the package handles all edge cases in Python 3.10 and 3.9 given dormant maintenance status.
  • Performance impact of the wrapt dependency in high-throughput code paths.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 1 — wrapt
Maintenance dormant — 751 days since the last release
Last repo commit
First released
Downloads 350,821/month — #7,327 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: deprecat-2.1.3-py2.py3-none-any.whl

Keywords: deprecate, deprecated, deprecation, warning, warn, decorator

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Tags

deprecation decorator pythonmark function deprecateddeprecation warningpython deprecate decoratorclass method deprecationsphinx deprecationdeprecation management
api-lifecycledocumentation-integration

More Python Modules packages