Skip to content

Commit 01cfcb0

Browse files
authored
Merge pull request matplotlib#30562 from timhoffm/doc-boilerplate
DOC: improve description of boilerplate.py
2 parents 22a9c55 + c85328a commit 01cfcb0

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

lib/matplotlib/pyplot.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
# Note: The first part of this file can be modified in place, but the latter
2-
# part is autogenerated by the boilerplate.py script.
1+
# Note: The first part of this file is hand-written and must be edited
2+
# in-place. The second part, starting with
3+
# ### REMAINING CONTENT GENERATED BY boilerplate.py ###
4+
# is generated by the script boilerplate.py. It must not be edited here
5+
# because all changes will be overwritten by the next run of the script.
6+
# For more information see the description in boilerplate.py.
37

48
"""
59
`matplotlib.pyplot` is a state-based interface to matplotlib. It provides

tools/boilerplate.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
"""
22
Script to autogenerate pyplot wrappers.
33
4-
When this script is run, the current contents of pyplot are
5-
split into generatable and non-generatable content (via the magic header
6-
:attr:`PYPLOT_MAGIC_HEADER`) and the generatable content is overwritten.
7-
Hence, the non-generatable content should be edited in the pyplot.py file
8-
itself, whereas the generatable content must be edited via templates in
9-
this file.
4+
pyplot.py consists of two parts: a hand-written part at the top, and an
5+
automatically generated part at the bottom, starting with the comment
6+
7+
### REMAINING CONTENT GENERATED BY boilerplate.py ###
8+
9+
This script generates the automatically generated part of pyplot.py. It
10+
consists of colormap setter functions and wrapper functions for methods
11+
of Figure and Axes. Whenever the API of one of the wrapped methods changes,
12+
this script has to be rerun to keep pyplot.py up to date.
13+
14+
The test ``lib/matplotlib/test_pyplot.py::test_pyplot_up_to_date`` checks
15+
that the autogenerated part of pyplot.py is up to date. It will fail in the
16+
case of an API mismatch and remind the developer to rerun this script.
1017
"""
1118

1219
# Although it is possible to dynamically generate the pyplot functions at

0 commit comments

Comments
 (0)