Skip to content

Implementing an official and stable deprecation system #1372

@RickyC0626

Description

@RickyC0626

Description of proposed feature

Our current way of deprecating functions and classes could be improved to be more user and developer friendly. Perhaps we can implement a decorator-based system where the developer can input the following information:

  • Version since deprecation
  • Version until deletion
  • Reason for deprecation

How can the new feature be used?

@deprecated(since="0.5.0". until="0.7.0", message="Use Create instead.")
class ShowCreation(Create):
    ...
    
class Animation(object):
    @deprecated(since="0.1.0", until="0.3.0", message="Use animation.interpolate() instead.")
    def update(self, alpha):
        ...

Additional comments

We could also implement helper methods and/or CLI commands that can:

  • List deprecated classes/methods
  • Sort classes/methods by version since deprecation
  • Warn developers if there is any deprecated code that has not been deleted at the expected version
    • i.e. If until="0.6.0" and current version is 0.6.0 or later, a warning will be shown as a reminder to delete the deprecated code

We could deprecate parameters this way as well.

Metadata

Metadata

Labels

new featureEnhancement specifically adding a new feature (feature request should be used for issues instead)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions