Hi python-ideas,

The subject is by no means new nor unique, and in fact has been discussed
on python-ideas at least once
<https://mail.python.org/archives/list/python-ideas@python.org/thread/OPY3E4VFGV6KDALYS3YYKIYBNY363WGA/#HBOGGZT2ETWFYX2UN67D52554I2N6UP>
before as well as in python/mypy#2403
<https://github.com/python/mypy/issues/2403>..

However, to date, there seems to be no standard way of deprecating things
declaratively, and ~every major library has its own internal API for that.
For example,

* numpy.deprecate,
* similar decorators in pandas
<https://github.com/pandas-dev/pandas/blob/42adb9f80fb6a048995087276eda2a16ea1cfb66/pandas/util/_decorators.py#L18>
and TensorFlow
<https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/util/deprecation.py>,

* twisted.python.deprecate
<https://twistedmatrix.com/documents/current/api/twisted.python.deprecate.html>,

* warn_about_renamed_method
<https://github.com/django/django/blob/ca9872905559026af82000e46cde6f7dedc897b6/django/utils/deprecation.py#L19>
in Django,
* etc etc.

The proliferation of deprecation APIs itself is not a problem, but it does
make it difficult (if not impossible) for language tooling to consume that
deprecation information and help users of these libraries write better
code.

Imagine, if there was a standard way to flag something as deprecated. That
would allow, for example, an IDE or a linter to statically flag a
particular usage site as problematic and, assuming such information is
available, to suggest an auto-generated fix (see @Deprecated in Kotlin
<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-deprecated/>, for
example).

What do you think? Is anyone interested in discussing this further and
perhaps sketching an API which could work reasonably well for library
authors as well as for tooling?

Cheers,
Sergei
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/EABCXCALZFRDH7CKMUL4YHFBQFOBUWN7/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to