Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support deprecation of (module level) variables #34

Open
radeklat opened this issue Jul 11, 2018 · 4 comments
Open

Support deprecation of (module level) variables #34

radeklat opened this issue Jul 11, 2018 · 4 comments
Assignees

Comments

@radeklat
Copy link
Contributor

Hi. I just hit and interesting use case that I was not able to solve with this library. There is a module level variable and it's name has changed. Since is is not a function, I cannot decorate it with @deprecated(...).

I searched for possible solutions and found a couple of them in here: https://stackoverflow.com/questions/922550/how-to-mark-a-global-as-deprecated-in-python I liked the second solution with the Deprecated class, becasue it is similar to @deprecated(...) and would allow to have the same interface.

I'm considering making a pull request but would like to check first if there would be an appetite for that.

@briancurtin
Copy link
Owner

I've been thinking about something like this as well as for actual modules themselves, so yeah, I'd like to see what's possible here—go ahead with a PR and I'll do whatever I can to help out. I wonder if it's possible to have one piece of code do what is currently being done as a decorator while also supporting your use-case, though? As in, perhaps the existing deprecated function switches to being implemented as a class to cover both, rather than possibly having two ways to do it (though I'm not sure if that's what you were suggesting).

That answer by Unknown looks like a pretty good starting point for something like this.

@radeklat
Copy link
Contributor Author

That would be ideal if there would be one thing that could do both. But the use cases are incompatible:

@radeklat
Copy link
Contributor Author

It is currently failing on Python2. I'll check why and if it can be fixed.

@radeklat
Copy link
Contributor Author

It is fixed now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants