Skip to content

Commit 425aece

Browse files
committed
refactor: Remove Google parser support for Deprecated sections (previously never used)
Also stop mentioning this section in docs. The goal is to deprecate it once the Numpy parser supports custom titles for admonitions.
1 parent 38d8770 commit 425aece

2 files changed

Lines changed: 0 additions & 63 deletions

File tree

docs/reference/docstrings.md

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -303,20 +303,6 @@ Modules:
303303
"""
304304
```
305305

306-
#### Deprecated {#google-section-deprecated}
307-
308-
Deprecated sections allow to document a deprecation that happened at a particular version. They can be used in every docstring.
309-
310-
```python
311-
"""My module.
312-
313-
Deprecated:
314-
1.2: The `foo` attribute is deprecated.
315-
"""
316-
317-
foo: int = 0
318-
```
319-
320306
#### Examples {#google-section-examples}
321307

322308
Examples sections allow to add examples of Python code without the use of markup code blocks. They are a mix of prose and interactive console snippets. They can be used in every docstring.
@@ -1042,22 +1028,6 @@ bar
10421028
"""
10431029
```
10441030

1045-
#### Deprecated {#numpydoc-section-deprecated}
1046-
1047-
Deprecated sections allow to document a deprecation that happened at a particular version. They can be used in every docstring.
1048-
1049-
```python
1050-
"""My module.
1051-
1052-
Deprecated
1053-
----------
1054-
1.2
1055-
The `foo` attribute is deprecated.
1056-
"""
1057-
1058-
foo: int = 0
1059-
```
1060-
10611031
#### Examples {#numpydoc-section-examples}
10621032

10631033
Examples sections allow to add examples of Python code without the use of markup code blocks. They are a mix of prose and interactive console snippets. They can be used in every docstring.
@@ -1444,7 +1414,6 @@ For non-Insiders versions, `default` is returned if specified, else the first pa
14441414

14451415
The sections are easier to deal in that order:
14461416

1447-
- Deprecated (single item, version and text)
14481417
- Raises, Warns (multiple items, no names, single type each)
14491418
- Attributes, Other Parameters, Parameters (multiple items, one name and one optional type each)
14501419
- Returns (multiple items, optional name and/or type each, annotation to split when multiple names)
@@ -1463,7 +1432,6 @@ Functions | ✅ | ✅ | ❌
14631432
Methods |||
14641433
Classes |||
14651434
Modules |||
1466-
Deprecated || ✅[^1]| [❌][issue-section-sphinx-deprecated]
14671435
Examples ||| [❌][issue-section-sphinx-examples]
14681436
Parameters |||
14691437
Other Parameters ||| [❌][issue-section-sphinx-other-parameters]
@@ -1473,8 +1441,6 @@ Yields | ✅ | ✅ | [❌][issue-section-sphinx-yields]
14731441
Receives ||| [❌][issue-section-sphinx-receives]
14741442
Returns |||
14751443

1476-
[^1]: Support for a regular section instead of the RST directive specified in the [Numpydoc styleguide](https://numpydoc.readthedocs.io/en/latest/format.html#deprecation-warning).
1477-
14781444
### Getting annotations/defaults from parent
14791445

14801446
Section | Google | Numpy | Sphinx
@@ -1484,7 +1450,6 @@ Functions | / | / | /
14841450
Methods | / | / | /
14851451
Classes | / | / | /
14861452
Modules | / | / | /
1487-
Deprecated | / | / | /
14881453
Examples | / | / | /
14891454
Parameters |||
14901455
Other Parameters ||| [❌][issue-parent-sphinx-other-parameters]
@@ -1503,7 +1468,6 @@ Functions | [❌][issue-xref-google-func-cls] | [❌][issue-xref-numpy-fu
15031468
Methods | [❌][issue-xref-google-func-cls] | [❌][issue-xref-numpy-func-cls] | /
15041469
Classes | [❌][issue-xref-google-func-cls] | [❌][issue-xref-numpy-func-cls] | /
15051470
Modules | / | / | /
1506-
Deprecated | / | / | /
15071471
Examples | / | / | /
15081472
Parameters ||| [❌][issue-xref-sphinx-parameters]
15091473
Other Parameters ||| [❌][issue-xref-sphinx-other-parameters]
@@ -1519,7 +1483,6 @@ Returns | ✅ | ✅ | [❌][issue-xref-sphinx-returns]
15191483
[issue-parent-sphinx-other-parameters]: https://github.com/mkdocstrings/griffe/issues/34
15201484
[issue-parent-sphinx-receives]: https://github.com/mkdocstrings/griffe/issues/35
15211485
[issue-parent-sphinx-yields]: https://github.com/mkdocstrings/griffe/issues/36
1522-
[issue-section-sphinx-deprecated]: https://github.com/mkdocstrings/griffe/issues/6
15231486
[issue-section-sphinx-examples]: https://github.com/mkdocstrings/griffe/issues/7
15241487
[issue-section-sphinx-other-parameters]: https://github.com/mkdocstrings/griffe/issues/27
15251488
[issue-section-sphinx-receives]: https://github.com/mkdocstrings/griffe/issues/8

src/_griffe/docstrings/google.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
DocstringSectionAdmonition,
2020
DocstringSectionAttributes,
2121
DocstringSectionClasses,
22-
DocstringSectionDeprecated,
2322
DocstringSectionExamples,
2423
DocstringSectionFunctions,
2524
DocstringSectionModules,
@@ -693,30 +692,6 @@ def _read_examples_section(
693692
return DocstringSectionExamples(sub_sections), new_offset
694693

695694

696-
def _read_deprecated_section(
697-
docstring: Docstring,
698-
*,
699-
offset: int,
700-
**options: Any,
701-
) -> tuple[DocstringSectionDeprecated | None, int]:
702-
text, new_offset = _read_block(docstring, offset=offset, **options)
703-
704-
# check the presence of a name and description, separated by a semi-colon
705-
try:
706-
version, text = text.split(":", 1)
707-
except ValueError:
708-
docstring_warning(docstring, new_offset, f"Could not parse version, text at line {offset}")
709-
return None, new_offset
710-
711-
version = version.lstrip()
712-
description = text.lstrip()
713-
714-
return (
715-
DocstringSectionDeprecated(version=version, text=description),
716-
new_offset,
717-
)
718-
719-
720695
def _is_empty_line(line: str) -> bool:
721696
return not line.strip()
722697

@@ -734,7 +709,6 @@ def _is_empty_line(line: str) -> bool:
734709
DocstringSectionKind.returns: _read_returns_section,
735710
DocstringSectionKind.yields: _read_yields_section,
736711
DocstringSectionKind.receives: _read_receives_section,
737-
DocstringSectionKind.deprecated: _read_deprecated_section,
738712
}
739713

740714
_sentinel = object()

0 commit comments

Comments
 (0)