harshil21 · GitHub

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.

Read the original on github.com ↗