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

[FEATURE] Add version deprecated information to PTB raised warnings #4261

Closed
harshil21 opened this issue May 18, 2024 · 2 comments · Fixed by #4262
Closed

[FEATURE] Add version deprecated information to PTB raised warnings #4261

harshil21 opened this issue May 18, 2024 · 2 comments · Fixed by #4262

Comments

@harshil21
Copy link
Member

harshil21 commented May 18, 2024

What kind of feature are you missing? Where do you notice a shortcoming of PTB?

We can slightly increase the information provided in warnings by adding which version the feature was deprecated in.

Describe the solution you'd like

Python's warn() accepts instances of UserWarning, so we can customize the message without repeating the phrase "Deprecated in NEXT.VERSION" everywhere.

Steps:

  1. Add an argument version and message to PTBDeprecationWarning.
  2. Override __str__ to add the phrase "Depreacted in {self.version}: {self.message}"

Our call will now look like:

PTBDeprecationWarning("NEXT.VERSION", "msg")

Describe alternatives you've considered

Simply add the version information in the warning message, but then we'll have to keep repeating ourselves.

Additional context

We can also do the same for PTBUserWarning and PTBRuntimeWarning.

@Poolitzer
Copy link
Member

@harshil21 We would need several version classes, no? We can deprecate in different (minor) versions before they vanish

@harshil21
Copy link
Member Author

We would need several version classes, no?

edited comment to better reflect what I meant

@github-actions github-actions bot locked and limited conversation to collaborators May 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants