classification
Title: Move deprecated abc module decorators to separate section in docs
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Darren.Dale, John Hagen, benjamin.peterson, daniel.urban, docs@python, dsdale24, eric.araujo, eric.snow, inada.naoki, ncoghlan, python-dev, stutzbach
Priority: normal Keywords: patch

Created on 2016-12-06 13:43 by John Hagen, last changed 2018-02-21 14:05 by inada.naoki. This issue is now closed.

Files
File name Uploaded Description Edit
bpo-28886_3.7.patch harshul1610, 2017-02-19 15:07 review
Pull Requests
URL Status Linked Edit
PR 176 merged harshul1610, 2017-02-19 15:04
PR 5787 merged miss-islington, 2018-02-21 04:31
PR 5788 merged miss-islington, 2018-02-21 04:32
Messages (6)
msg282548 - (view) Author: John Hagen (John Hagen) * Date: 2016-12-06 13:43
In the abc module (https://docs.python.org/3/library/abc.html) the following decorators have been deprecated since Python 3.3:

- abstractclassmethod
- abstractstaticmethod
- abstractproperty

But if you run the following example code using Python 3.5.2 with -Werror, no DeprecationWarnings are thrown. Throwing DeprecationWarnings will help make it more clear that these properties should not be used. PyCharm, for example, will strikethrough the usage of methods that throw DeprecationWarning so that even new users will be notified quickly even if they don't run with -Werror.


import abc


class Base(abc.ABC):
    @abc.abstractclassmethod
    def abstract_class(cls):
        pass

    @abc.abstractstaticmethod
    def abstract_static():
        pass

    @abc.abstractproperty
    def abstract_property(self):
        pass


class Child(Base):
    @classmethod
    def abstract_class(cls):
        print('Abstract class method')

    @staticmethod
    def abstract_static():
        print('Abstract static method')

    @property
    def abstract_property(self):
        return 'Abstract property'


child = Child()
child.abstract_class()
child.abstract_static()
print(child.abstract_property)
msg282569 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-12-06 20:00
Not all features deprecated in the source should be deprecated in the code. May be reasons for not doing this in the code.

Adding the deprecation in maintained releases can introduce a regression. It seems to me that these decorators are not broken. They is just other, more preferable way to write the same, with the combination of other decorators.
msg282582 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2016-12-07 00:52
Right, these are in the "Don't use them in new code, but we have absolutely no plans to actually remove them" documentation-only category of deprecation warning.

However, I'm converting this to a documentation enhancement request, as the documentation could make that status clearer by moving them to a separate "Legacy builtin decorator subclasses" section at the end of https://docs.python.org/3/library/abc.html

Then that section can *start* with the information on simply applying the builtin decorators on top of the abc.abstractproperty() decorator, before moving on to document the available subclasses.
msg312459 - (view) Author: Inada Naoki (inada.naoki) * (Python committer) Date: 2018-02-21 04:30
New changeset 52c6b89796a7ec391db20281e05b256f57e97b35 by INADA Naoki (Harshul jain) in branch 'master':
bpo-28886: doc: Move deprecated abc decorators to separate section (GH-176)
https://github.com/python/cpython/commit/52c6b89796a7ec391db20281e05b256f57e97b35
msg312461 - (view) Author: Inada Naoki (inada.naoki) * (Python committer) Date: 2018-02-21 05:24
New changeset 7452f6d8fa3ffe5dab20f7e4244851a6eca397be by INADA Naoki (Miss Islington (bot)) in branch '3.7':
bpo-28886: doc: Move deprecated abc decorators to separate section (GH-176)
https://github.com/python/cpython/commit/7452f6d8fa3ffe5dab20f7e4244851a6eca397be
msg312462 - (view) Author: Inada Naoki (inada.naoki) * (Python committer) Date: 2018-02-21 05:24
New changeset 0150dc589439a9a78c80c2aa8d7d6c5d3bba1d6d by INADA Naoki (Miss Islington (bot)) in branch '3.6':
bpo-28886: doc: Move deprecated abc decorators to separate section (GH-176)
https://github.com/python/cpython/commit/0150dc589439a9a78c80c2aa8d7d6c5d3bba1d6d
History
Date User Action Args
2018-02-21 14:05:22inada.naokisetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-02-21 05:24:39inada.naokisetmessages: + msg312462
2018-02-21 05:24:24inada.naokisetmessages: + msg312461
2018-02-21 04:32:09miss-islingtonsetpull_requests: + pull_request5569
2018-02-21 04:31:10miss-islingtonsetstage: needs patch -> patch review
pull_requests: + pull_request5568
2018-02-21 04:30:04inada.naokisetnosy: + inada.naoki
messages: + msg312459
2017-02-19 15:07:10harshul1610setfiles: + bpo-28886_3.7.patch
keywords: + patch
2017-02-19 15:04:06harshul1610setpull_requests: + pull_request141
2016-12-07 05:36:04serhiy.storchakasetnosy: - serhiy.storchaka
2016-12-07 00:52:50ncoghlansetassignee: docs@python
type: behavior -> enhancement
components: + Documentation, - Library (Lib)
title: Deprecated abstract base class (abc) decorators do not raise DeprecationWarning -> Move deprecated abc module decorators to separate section in docs
nosy: + docs@python

messages: + msg282582
stage: needs patch
2016-12-06 20:00:38serhiy.storchakasetnosy: + stutzbach, dsdale24, python-dev, eric.snow, serhiy.storchaka, ncoghlan, daniel.urban, eric.araujo, Darren.Dale, benjamin.peterson
messages: + msg282569
2016-12-06 13:43:37John Hagencreate