Skip to content

Agent-Hellboy/pdeprecator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pdeprecator

  • This library provides a decorator deprecated_params that allows you to deprecate certain parameters in your class methods or function.
https://img.shields.io/pypi/v/pdeprecator https://pepy.tech/badge/pdeprecator https://coveralls.io/repos/github/Agent-Hellboy/pdeprecator/badge.svg?branch=master

Installation

For stable version
  • pip install pdeprector
For developement

Example

# Example usage
class MyClass:
    @deprecated_params({"old_param": "new_param"})
    def __init__(self, new_param):
        self.new_param = new_param


# Usage
obj = MyClass(old_param="value")
print(obj.new_param)

Warning: Deprecating a parameter name change contradicts the
open-closed principle of SOLID, although
it's not an inflexible rule.

Warning

- It's recommended to write new functions or classes with a v2
  suffix instead of using this deprecated library.

- If possible, migrate to the newer version with v2 suffix.
  However, if migration is not feasible at the moment,
  you can continue using this library with caution.



You should do following
from deprecated import deprecated

# Deprecate a function
@deprecated(reason="Use function_v2 instead")
def function():
   pass

def function_v2():
   # New implementation for function_v2
   pass

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages