Skip to content
Python @deprecated decorator to deprecate old python classes, functions or methods.
Python Makefile
Branch: master
Clone or download
Laurent LAPORTE
Laurent LAPORTE Customize the sidebar to add links to the documentation, to the sourc…
…e in GitHub and to the Bug tracker. Add a logo in the sidebar and change the logo in the main page to see the library version.
Latest commit d702821 Feb 22, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Add a GitHub’s code of conduct to the project. Sep 4, 2018
deprecated The :ref:`api` documentation and the :ref:`tutorial` is improved to e… Feb 22, 2020
docs Customize the sidebar to add links to the documentation, to the sourc… Feb 22, 2020
tests Fix #15: The ``@deprecated`` decorator doesn't set a warning filter i… Feb 11, 2020
.bumpversion.cfg Prepare next version 1.2.8 (unreleased) Nov 11, 2019
.editorconfig
.gitignore Support packit for Pull Request tests and sync to Fedora Jul 30, 2019
.packit.yaml Support packit for Pull Request tests and sync to Fedora Jul 30, 2019
.travis.yml Change Travis and Tox configuration to support Python 3.8 Nov 11, 2019
CHANGELOG.rst Customize the sidebar to add links to the documentation, to the sourc… Feb 22, 2020
CONTRIBUTING.rst Change configuration for epub: update de version number in the title … Sep 14, 2018
LICENSE.rst Rename license file ``LICENSE`` -> ``LICENSE.rst``. Jul 8, 2018
MANIFEST.in Add a ``MANIFEST.in`` file to package additional files like "LICENSE.… Jul 8, 2018
Makefile The library "Python-Deprecated" is simply renamed "Deprecated". Nov 20, 2017
README.md Rename license file ``LICENSE`` -> ``LICENSE.rst``. Jul 8, 2018
appveyor.yml Fix an issue with the AppVeyor build: upgrade setuptools version in `… Jul 6, 2019
pyproject.toml Add `Black <https://black.readthedocs.io/en/latest/>`_ configuration … Oct 27, 2019
python-deprecated.spec Prepare next version 1.2.8 (unreleased) Nov 11, 2019
setup.cfg The library "Python-Deprecated" is simply renamed "Deprecated". Nov 20, 2017
setup.py Prepare next version 1.2.8 (unreleased) Nov 11, 2019
tox.ini Change the Tox configuration to test the library with Wrapt 1.12.x. Feb 22, 2020

README.md

Deprecated Decorator

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

Build Status Build status Coverage Status GitHub version GitHub license Documentation Status

Installation

pip install Deprecated

Usage

To use this, decorate your deprecated function with @deprecated decorator:

from deprecated import deprecated


@deprecated
def some_old_function(x, y):
    return x + y

You can also decorate a class or a method:

from deprecated import deprecated


class SomeClass(object):
    @deprecated
    def some_old_method(self, x, y):
        return x + y


@deprecated
class SomeOldClass(object):
    pass

You can give a "reason" message to help the developer to choose another function/class:

from deprecated import deprecated


@deprecated(reason="use another function")
def some_old_function(x, y):
    return x + y

Authors

The authors of this library are: Marcos CARDOSO, and Laurent LAPORTE.

The original code was made in this StackOverflow post by Leandro REGUEIRO, Patrizio BERTONI, and Eric WIESER.

You can’t perform that action at this time.