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: highlight functions decorated with @deprecated #171

Open
eddiebergman opened this issue Jun 27, 2024 · 1 comment
Open

feature: highlight functions decorated with @deprecated #171

eddiebergman opened this issue Jun 27, 2024 · 1 comment
Assignees
Labels
feature New feature or request fund Issue priority can be boosted insiders Candidate for Insiders

Comments

@eddiebergman
Copy link

eddiebergman commented Jun 27, 2024

Is your feature request related to a problem? Please describe.

I am maintaining a library where I am using pythons new @deprecated decorated, which is useful as LSP's can pick this up and provide feedback to users that the functions they are using are deprecated. I also need to keep existing documentation around as users may not know what the function does, in order to consider either the recommended alternative or some alternate solution (I need to keep old docstrings visible.

The (minor) problem is I need to duplicate both the recommended alternative in both the docstring and in the @deprecated decorator.

from typing_extensions import deprecated # pre 3.13

@deprecated("Please use `g(value)` instead")  # <- For indicating to people in code
def f(value: int) -> int:
    """
    !!! warning "Deprecated"                   # <- For indicating to people in docs
        Please use `g(value)` instead.
    
    Doubles a value.
    """
    return g(value)

Describe the solution you'd like

I would like to see an explicit indication in the documentation that shows that the function/method is deprecated with the decorator with the inner message as well. I naively would like the exact same as would be produced for above, however this raises some questions such as, what to do if someone already has a !!! warning "Deprecated", should they just be duplicated? What happens if the string in the deprecated block contains markdown/html?

Describe alternatives you've considered

The alternative is just duplication for now. It's relatively minor, but it would be a nice quality of life.

Additional context

PEP 702 – Marking deprecations using the type system
This already seems to be supported for in-editor warnings for at least vs-code but also pyright, which is the open-source version of vs-code's LSP.

Boost priority

  • Boost priority in our backlog through Polar.sh. Higher pledge, higher priority.
  • Minimum pledge by user/organization is $5, minimum amount for boost is $30.
  • View all issues with pledges.
  • We receive the funds once the issue is completed and confirmed by you.
  • Features with the insiders label are released to sponsors first, and tied to a funding goal.
Fund with Polar
@eddiebergman eddiebergman added the feature New feature or request label Jun 27, 2024
@pawamoy
Copy link
Member

pawamoy commented Jun 30, 2024

Hi @eddiebergman, thanks for the feature request 🙂 You might be interested in this Griffe extension: https://mkdocstrings.github.io/griffe-warnings-deprecated/#examples (sponsors only).

@pawamoy pawamoy added the insiders Candidate for Insiders label Aug 20, 2024
@pawamoy pawamoy added the fund Issue priority can be boosted label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request fund Issue priority can be boosted insiders Candidate for Insiders
Projects
None yet
Development

No branches or pull requests

2 participants