If an object is deprecated in Python 3.12, to be removed in Python 3.14, should we decorate it like this? (1)
@deprecated("Will be removed in Python 3.14")classFoo: ...Like this? (2)
@deprecated("Deprecated in Python 3.12; will be removed in Python 3.14")classFoo: ...Or like this? (3)
ifsys.version_info>= (3, 12):
@deprecated("Will be removed in Python 3.14")classFoo: ...
else:
classFoo: ...For somebody who uses Python 3.8, it might be surprising if a type checker started emitting warnings about an object being deprecated if the runtime only emits a DeprecationWarning on Python 3.12+. For that user, Python 3.14 will be a long way away; they might not even be able to switch to the newer way of doing things yet (perhaps the "replacement idiom" only exists on Python 3.9+). For us in typeshed, however, (3) is obviously the most tedious option for us to maintain, as it will mean more branches.
Thoughts?
If an object is deprecated in Python 3.12, to be removed in Python 3.14, should we decorate it like this? (1)
Like this? (2)
Or like this? (3)
For somebody who uses Python 3.8, it might be surprising if a type checker started emitting warnings about an object being deprecated if the runtime only emits a
DeprecationWarningon Python 3.12+. For that user, Python 3.14 will be a long way away; they might not even be able to switch to the newer way of doing things yet (perhaps the "replacement idiom" only exists on Python 3.9+). For us in typeshed, however, (3) is obviously the most tedious option for us to maintain, as it will mean more branches.Thoughts?