deprecation


Namedeprecation JSON
Version 2.1.0 PyPI version JSON
download
home_pagehttp://deprecation.readthedocs.io/
SummaryA library to handle automated deprecations
upload_time2020-04-20 14:23:38
maintainerBrian Curtin
docs_urlNone
authorBrian Curtin
requires_python
licenseApache 2
keywords deprecation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            deprecation
===========

.. image:: https://readthedocs.org/projects/deprecation/badge/?version=latest
   :target: http://deprecation.readthedocs.io/en/latest/
   :alt: Documentation Status

.. image:: https://travis-ci.org/briancurtin/deprecation.svg?branch=master
    :target: https://travis-ci.org/briancurtin/deprecation

.. image:: https://codecov.io/gh/briancurtin/deprecation/branch/master/graph/badge.svg
  :target: https://codecov.io/gh/briancurtin/deprecation

The ``deprecation`` library provides a ``deprecated`` decorator and a
``fail_if_not_removed`` decorator for your tests. Together, the two
enable the automation of several things:

1. The docstring of a deprecated method gets the deprecation details
   appended to the end of it. If you generate your API docs direct
   from your source, you don't need to worry about writing your own
   notification. You also don't need to worry about forgetting to
   write it. It's done for you.
2. Rather than having code live on forever because you only deprecated
   it but never actually moved on from it, you can have your tests
   tell you when it's time to remove the code. The ``@deprecated``
   decorator can be told when it's time to entirely remove the code,
   which causes ``@fail_if_not_removed`` to raise an ``AssertionError``,
   causing either your unittest or py.test tests to fail.

See http://deprecation.readthedocs.io/ for the full documentation.

Installation
============

 ::

    pip install deprecation

Usage
=====

 ::

    import deprecation

    @deprecation.deprecated(deprecated_in="1.0", removed_in="2.0",
                            current_version=__version__,
                            details="Use the bar function instead")
    def foo():
        """Do some stuff"""
        return 1

...but doesn't Python ignore ``DeprecationWarning``?
====================================================

Yes, by default since 2.7—and for good reason [#]_ —and this works fine
with that.

1. It often makes sense for you to run your tests with a ``-W`` flag or
   the ``PYTHONWARNINGS`` environment variable so you catch warnings
   in development and handle them appropriately. The warnings raised by
   this library show up there, as they're subclasses of the built-in
   ``DeprecationWarning``. See the `Command Line
   <https://docs.python.org/2/using/cmdline.html#cmdoption-W>`_
   and `Environment Variable
   <https://docs.python.org/2/using/cmdline.html#envvar-PYTHONWARNINGS>`_
   documentation for more details.
2. Even if you don't enable those things, the behavior of this library
   remains the same. The docstrings will still be updated and the tests
   will still fail when they need to. You'll get the benefits regardless
   of what Python cares about ``DeprecationWarning``.

----

.. [#] Exposing application users to ``DeprecationWarning``\s that are
       emitted by lower-level code needlessly involves end-users in
       "how things are done." It often leads to users raising issues
       about warnings they're presented, which on one hand is done
       rightfully so, as it's been presented to them as some sort of
       issue to resolve. However, at the same time, the warning could
       be well known and planned for. From either side, loud
       ``DeprecationWarning``\s can be seen as noise that isn't
       necessary outside of development.



            

Raw data

            {
    "_id": null,
    "home_page": "http://deprecation.readthedocs.io/",
    "name": "deprecation",
    "maintainer": "Brian Curtin",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "brian@python.org",
    "keywords": "deprecation",
    "author": "Brian Curtin",
    "author_email": "brian@python.org",
    "download_url": "https://files.pythonhosted.org/packages/5a/d3/8ae2869247df154b64c1884d7346d412fed0c49df84db635aab2d1c40e62/deprecation-2.1.0.tar.gz",
    "platform": "",
    "description": "deprecation\n===========\n\n.. image:: https://readthedocs.org/projects/deprecation/badge/?version=latest\n   :target: http://deprecation.readthedocs.io/en/latest/\n   :alt: Documentation Status\n\n.. image:: https://travis-ci.org/briancurtin/deprecation.svg?branch=master\n    :target: https://travis-ci.org/briancurtin/deprecation\n\n.. image:: https://codecov.io/gh/briancurtin/deprecation/branch/master/graph/badge.svg\n  :target: https://codecov.io/gh/briancurtin/deprecation\n\nThe ``deprecation`` library provides a ``deprecated`` decorator and a\n``fail_if_not_removed`` decorator for your tests. Together, the two\nenable the automation of several things:\n\n1. The docstring of a deprecated method gets the deprecation details\n   appended to the end of it. If you generate your API docs direct\n   from your source, you don't need to worry about writing your own\n   notification. You also don't need to worry about forgetting to\n   write it. It's done for you.\n2. Rather than having code live on forever because you only deprecated\n   it but never actually moved on from it, you can have your tests\n   tell you when it's time to remove the code. The ``@deprecated``\n   decorator can be told when it's time to entirely remove the code,\n   which causes ``@fail_if_not_removed`` to raise an ``AssertionError``,\n   causing either your unittest or py.test tests to fail.\n\nSee http://deprecation.readthedocs.io/ for the full documentation.\n\nInstallation\n============\n\n ::\n\n    pip install deprecation\n\nUsage\n=====\n\n ::\n\n    import deprecation\n\n    @deprecation.deprecated(deprecated_in=\"1.0\", removed_in=\"2.0\",\n                            current_version=__version__,\n                            details=\"Use the bar function instead\")\n    def foo():\n        \"\"\"Do some stuff\"\"\"\n        return 1\n\n...but doesn't Python ignore ``DeprecationWarning``?\n====================================================\n\nYes, by default since 2.7\u2014and for good reason [#]_ \u2014and this works fine\nwith that.\n\n1. It often makes sense for you to run your tests with a ``-W`` flag or\n   the ``PYTHONWARNINGS`` environment variable so you catch warnings\n   in development and handle them appropriately. The warnings raised by\n   this library show up there, as they're subclasses of the built-in\n   ``DeprecationWarning``. See the `Command Line\n   <https://docs.python.org/2/using/cmdline.html#cmdoption-W>`_\n   and `Environment Variable\n   <https://docs.python.org/2/using/cmdline.html#envvar-PYTHONWARNINGS>`_\n   documentation for more details.\n2. Even if you don't enable those things, the behavior of this library\n   remains the same. The docstrings will still be updated and the tests\n   will still fail when they need to. You'll get the benefits regardless\n   of what Python cares about ``DeprecationWarning``.\n\n----\n\n.. [#] Exposing application users to ``DeprecationWarning``\\s that are\n       emitted by lower-level code needlessly involves end-users in\n       \"how things are done.\" It often leads to users raising issues\n       about warnings they're presented, which on one hand is done\n       rightfully so, as it's been presented to them as some sort of\n       issue to resolve. However, at the same time, the warning could\n       be well known and planned for. From either side, loud\n       ``DeprecationWarning``\\s can be seen as noise that isn't\n       necessary outside of development.\n\n\n",
    "bugtrack_url": null,
    "license": "Apache 2",
    "summary": "A library to handle automated deprecations",
    "version": "2.1.0",
    "split_keywords": [
        "deprecation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "3627168774d8dae8233dff15ff58d3c1",
                "sha256": "a10811591210e1fb0e768a8c25517cabeabcba6f0bf96564f8ff45189f90b14a"
            },
            "downloads": -1,
            "filename": "deprecation-2.1.0-py2.py3-none-any.whl",
            "has_sig": true,
            "md5_digest": "3627168774d8dae8233dff15ff58d3c1",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 11178,
            "upload_time": "2020-04-20T14:23:36",
            "upload_time_iso_8601": "2020-04-20T14:23:36.581193Z",
            "url": "https://files.pythonhosted.org/packages/02/c3/253a89ee03fc9b9682f1541728eb66db7db22148cd94f89ab22528cd1e1b/deprecation-2.1.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "6b79c6572fb241e3cecbbd7d539bb66b",
                "sha256": "72b3bde64e5d778694b0cf68178aed03d15e15477116add3fb773e581f9518ff"
            },
            "downloads": -1,
            "filename": "deprecation-2.1.0.tar.gz",
            "has_sig": true,
            "md5_digest": "6b79c6572fb241e3cecbbd7d539bb66b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 173788,
            "upload_time": "2020-04-20T14:23:38",
            "upload_time_iso_8601": "2020-04-20T14:23:38.738331Z",
            "url": "https://files.pythonhosted.org/packages/5a/d3/8ae2869247df154b64c1884d7346d412fed0c49df84db635aab2d1c40e62/deprecation-2.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-04-20 14:23:38",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "deprecation"
}
        
Elapsed time: 0.01281s