numpy / numpydoc

Numpy's Sphinx extensions
https://numpydoc.readthedocs.io/
Other
302 stars 161 forks source link

Validation rule GL09 failing #573

Open pp-mo opened 3 months ago

pp-mo commented 3 months ago

I can't work out how to satisfy GL09 when including a deprecation notice.

Demonstration

For example:

file "sample_code.py"

def my_func_wrong():
    """Compute my function.

    What it does in more detail.

    .. deprecated:: v0.1
        This function is listed for future removal.
    """
    pass

def my_func_right():
    """Compute my function.

    .. deprecated:: v0.1
        This function is listed for future removal.

    What it does in more detail.
    """
    pass

produces ...

+-----------------------------------------------+---------------------------+---------+---------------------------------------------+
| file                                          | item                      | check   | description                                 |
+===============================================+===========================+=========+=============================================+
| lib/iris/experimental/ugrid/sample_code.py:1  | sample_code.my_func_wrong | GL09    | Deprecation warning should precede extended |
|                                               |                           |         | summary                                     |
+-----------------------------------------------+---------------------------+---------+---------------------------------------------+
| lib/iris/experimental/ugrid/sample_code.py:11 | sample_code.my_func_right | GL09    | Deprecation warning should precede extended |
|                                               |                           |         | summary                                     |
+-----------------------------------------------+---------------------------+---------+---------------------------------------------+

Expected

I think the form in "my_func_right" ought to pass OK.

Workaround

For now, in the Iris project, we are putting all our "deprecated" sections within a "Notes" section, and have been since we since we adopted numpydoc-validation in pre-commit. For example here But this feels like a kluge.

rossbar commented 3 months ago

Thanks for reporting - this seems like a bug in the validator. I agree that my_func_right should be passing the validation.

pp-mo commented 3 months ago

Thanks for reporting - this seems like a bug in the validator. I agree that my_func_right should be passing the validation.

Thanks for such a fast response ! It's useful just to have that confirmed (as my grasp of RST is a bit shaky TBH)