Skip to content

Commit 52df591

Browse files
committed
Deprecate docstring and update references
1 parent 089cc48 commit 52df591

36 files changed

+208
-203
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Module ``docstring`` deprecated
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
The module ``matplotlib.docstring`` is considered internal and public access
5+
is deprecated.

doc/api/prev_api_changes/api_changes_3.5.0/removals.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ The following class methods have been removed:
214214
- ``Colorbar.on_mappable_changed`` and ``Colorbar.update_bruteforce``; use
215215
``Colorbar.update_normal()`` instead
216216
- ``docstring.Substitution.from_params`` has been removed; directly assign to
217-
``params`` of `.Substitution` instead
217+
``params`` of ``docstring.Substitution`` instead
218218
- ``DraggableBase.artist_picker``; set the artist's picker instead
219219
- ``DraggableBase.on_motion_blit``; use `.DraggableBase.on_motion` instead
220220
- ``FigureCanvasGTK3._renderer_init``

doc/devel/documenting_mpl.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -684,14 +684,14 @@ are:
684684
2. as automated as possible so that as properties change, the docs
685685
are updated automatically.
686686

687-
The ``@docstring.interpd`` decorator implements this. Any function accepting
687+
The ``@_docstring.interpd`` decorator implements this. Any function accepting
688688
`.Line2D` pass-through ``kwargs``, e.g., `matplotlib.axes.Axes.plot`, can list
689689
a summary of the `.Line2D` properties, as follows:
690690

691691
.. code-block:: python
692692
693693
# in axes.py
694-
@docstring.interpd
694+
@_docstring.interpd
695695
def plot(self, *args, **kwargs):
696696
"""
697697
Some stuff omitted
@@ -726,7 +726,7 @@ gets interpolated into the docstring.
726726

727727
Note that this scheme does not work for decorating an Artist's ``__init__``, as
728728
the subclass and its properties are not defined yet at that point. Instead,
729-
``@docstring.interpd`` can be used to decorate the class itself -- at that
729+
``@_docstring.interpd`` can be used to decorate the class itself -- at that
730730
point, `.kwdoc` can list the properties and interpolate them into
731731
``__init__.__doc__``.
732732

lib/matplotlib/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106

107107
# cbook must import matplotlib only within function
108108
# definitions, so it is safe to import from it here.
109-
from . import _api, _version, cbook, docstring, rcsetup
109+
from . import _api, _version, cbook, _docstring, rcsetup
110110
from matplotlib.cbook import sanitize_sequence
111111
from matplotlib._api import MatplotlibDeprecationWarning
112112
from matplotlib.rcsetup import validate_backend, cycler
@@ -593,7 +593,7 @@ def gen_candidates():
593593
_deprecated_remain_as_none = {}
594594

595595

596-
@docstring.Substitution(
596+
@_docstring.Substitution(
597597
"\n".join(map("- {}".format, sorted(rcsetup._validators, key=str.lower)))
598598
)
599599
class RcParams(MutableMapping, dict):

lib/matplotlib/_enums.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"""
1212

1313
from enum import Enum, auto
14-
from matplotlib import docstring
14+
from matplotlib import _docstring
1515

1616

1717
class _AutoStringNameEnum(Enum):
@@ -181,5 +181,5 @@ def demo():
181181
+ ", ".join([f"'{cs.name}'" for cs in CapStyle]) \
182182
+ "}"
183183

184-
docstring.interpd.update({'JoinStyle': JoinStyle.input_description,
184+
_docstring.interpd.update({'JoinStyle': JoinStyle.input_description,
185185
'CapStyle': CapStyle.input_description})

0 commit comments

Comments
 (0)