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 request: strip Sphinx syntax from sphinx.deprecated warning message #41

Comments

@soxofaan
Copy link
Contributor

soxofaan commented Feb 25, 2021

Say you use the sphinx decorator with Sphinx syntax references like this:

from deprecated.sphinx import deprecated

@deprecated(reason="Use :py:func:`add` instead", version="1.2.3")
def add(x, y):
    return x + y

add(2,3)

the DeprecationWarning will say:

Call to deprecated function (or staticmethod) add. (Use :py:func:`add` instead) -- Deprecated since version 1.2.3.

For a normal user of my library this :py:func: looks weird.
The user typically does not know/care that I use Sphinx as documentation build tool, let alone that they understand this syntax.

Feature request:

Strip this kind of Sphinx syntax from the DeprecationWarning message

@tantale tantale self-assigned this Feb 26, 2021
@tantale tantale added this to To do in Deprecated via automation Feb 26, 2021
@tantale
Copy link
Owner

tantale commented Feb 26, 2021

Hello Stefaan,

If we use some bleach of any kind to clean up the Sphinx warning message, I'm afraid we get side effects…

A ”normal user” of your library should be a developper too, isn't it? So, he can understand weird syntax.

I must consider your request more carefully. In the meanwhile, do you have any suggestion on how to change that, with a PR?

Regards.

soxofaan added a commit to soxofaan/deprecated that referenced this issue Mar 4, 2021
soxofaan added a commit to soxofaan/deprecated that referenced this issue Mar 4, 2021
@soxofaan
Copy link
Contributor Author

soxofaan commented Mar 4, 2021

If we use some bleach of any kind to clean up the Sphinx warning message, I'm afraid we get side effects…

I would only strip :py:func: like construct, not the whole Sphinx syntax set. Can be done with a tight regex, that shouldn't cause much trouble.

I already started a PR here: #42

tantale added a commit that referenced this issue Mar 13, 2021
tantale added a commit that referenced this issue Mar 13, 2021
…: correct the regex used to get rid of the Sphinx cross-referencing syntax (issue #41).
@tantale
Copy link
Owner

tantale commented Mar 13, 2021

🐍 Deprecated v1.2.12 released 🚀!

This was referenced Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment