1
1
.. _api_changes :
2
2
3
- API changes
4
- ===========
3
+ API guidelines
4
+ ==============
5
5
6
6
API consistency and stability are of great value; Therefore, API changes
7
7
(e.g. signature changes, behavior changes, removals) will only be conducted
@@ -17,10 +17,12 @@ are backwards-incompatible API changes.
17
17
18
18
color_changes.rst
19
19
20
+ .. redirect-from :: /devel/coding_guide#new-features-and-api-changes
21
+
20
22
.. _api_whats_new :
21
23
22
- Announce changes, deprecations , and new features
23
- ------------------------------------------------
24
+ Announce new features, API changes , and deprecations
25
+ ----------------------------------------------------
24
26
25
27
When adding or changing the API in a backward in-compatible way, please add the
26
28
appropriate :ref: `versioning directive <versioning-directives >` and document it
@@ -34,10 +36,9 @@ for the release notes and add the entry to the appropriate folder:
34
36
| API change | ``.. versionchanged:: 3.N `` | :file: `doc/api/next_api_changes/[kind] ` |
35
37
+-------------------+-----------------------------+----------------------------------------------+
36
38
37
- API deprecations are first introduced and then expired. During the introduction
38
- period, users are warned that the API *will * change in the future.
39
- During the expiration period, code is changed as described in the notice posted
40
- during the introductory period.
39
+ API deprecations are first introduced and then expired. During the introduction period,
40
+ users are warned that the API *will * change in the future. During the expiration period,
41
+ code *is * changed as described in the notice posted during the introductory period.
41
42
42
43
+-----------+--------------------------------------------------+----------------------------------------------+
43
44
| stage | required changes | announcement folder |
@@ -47,27 +48,95 @@ during the introductory period.
47
48
| expire | :ref: `expire deprecation <expire-deprecation >` | :file: `doc/api/next_api_changes/[kind] ` |
48
49
+-----------+--------------------------------------------------+----------------------------------------------+
49
50
50
- For both change notes and what's new, please avoid using references in section
51
- titles, as it causes links to be confusing in the table of contents. Instead,
52
- ensure that a reference is included in the descriptive text.
51
+ .. _versioning-directives :
52
+
53
+ Versioning directives
54
+ ^^^^^^^^^^^^^^^^^^^^^
55
+
56
+ When making a backward incompatible change, please add a versioning directive in
57
+ the docstring. The directives should be placed at the end of a description block.
58
+ For example::
59
+
60
+ class Foo:
61
+ """
62
+ This is the summary.
63
+
64
+ Followed by a longer description block.
65
+
66
+ Consisting of multiple lines and paragraphs.
67
+
68
+ .. versionadded:: 3.5
69
+
70
+ Parameters
71
+ ----------
72
+ a : int
73
+ The first parameter.
74
+ b: bool, default: False
75
+ This was added later.
76
+
77
+ .. versionadded:: 3.6
78
+ """
79
+
80
+ def set_b(b):
81
+ """
82
+ Set b.
83
+
84
+ .. versionadded:: 3.6
85
+
86
+ Parameters
87
+ ----------
88
+ b: bool
89
+
90
+ For classes and functions, the directive should be placed before the
91
+ *Parameters * section. For parameters, the directive should be placed at the
92
+ end of the parameter description. The patch release version is omitted and
93
+ the directive should not be added to entire modules.
94
+
95
+ Release notes
96
+ ^^^^^^^^^^^^^
53
97
54
- API Change Notes
55
- ^^^^^^^^^^^^^^^^
98
+ For both change notes and what's new, please avoid using references in section titles,
99
+ as it causes links to be confusing in the table of contents. Instead, ensure that a
100
+ reference is included in the descriptive text.
101
+
102
+ API change notes
103
+ """"""""""""""""
56
104
57
105
.. include :: ../api/next_api_changes/README.rst
58
106
:start-line: 5
59
107
:end-line: 31
60
108
61
- What's new
62
- ^^^^^^^^^^
109
+ What's new notes
110
+ """"""""""""""""
63
111
64
112
.. include :: ../users/next_whats_new/README.rst
65
113
:start-line: 5
66
114
:end-line: 24
67
115
68
116
69
- Deprecation
70
- -----------
117
+ Add new API and features
118
+ ------------------------
119
+
120
+ Every new function, parameter and attribute that is not explicitly marked as
121
+ private (i.e., starts with an underscore) becomes part of Matplotlib's public
122
+ API. As discussed above, changing the existing API is cumbersome. Therefore,
123
+ take particular care when adding new API:
124
+
125
+ - Mark helper functions and internal attributes as private by prefixing them
126
+ with an underscore.
127
+ - Carefully think about good names for your functions and variables.
128
+ - Try to adopt patterns and naming conventions from existing parts of the
129
+ Matplotlib API.
130
+ - Consider making as many arguments keyword-only as possible. See also
131
+ `API Evolution the Right Way -- Add Parameters Compatibly `__.
132
+
133
+ __ https://emptysqua.re/blog/api-evolution-the-right-way/#adding-parameters
134
+
135
+
136
+ .. _deprecation-guidelines :
137
+
138
+ Deprecate API
139
+ -------------
71
140
72
141
API changes in Matplotlib have to be performed following the deprecation process
73
142
below, except in very rare circumstances as deemed necessary by the development
@@ -146,66 +215,3 @@ Expire deprecation
146
215
items were never type hinted in the first place and were added to this file
147
216
instead. For removed items that were not in the stub file, only deleting from the
148
217
allowlist is required.
149
-
150
- Adding new API and features
151
- ---------------------------
152
-
153
- Every new function, parameter and attribute that is not explicitly marked as
154
- private (i.e., starts with an underscore) becomes part of Matplotlib's public
155
- API. As discussed above, changing the existing API is cumbersome. Therefore,
156
- take particular care when adding new API:
157
-
158
- - Mark helper functions and internal attributes as private by prefixing them
159
- with an underscore.
160
- - Carefully think about good names for your functions and variables.
161
- - Try to adopt patterns and naming conventions from existing parts of the
162
- Matplotlib API.
163
- - Consider making as many arguments keyword-only as possible. See also
164
- `API Evolution the Right Way -- Add Parameters Compatibly `__.
165
-
166
- __ https://emptysqua.re/blog/api-evolution-the-right-way/#adding-parameters
167
-
168
-
169
- .. _versioning-directives :
170
-
171
- Versioning directives
172
- ---------------------
173
-
174
- When making a backward incompatible change, please add a versioning directive in
175
- the docstring. The directives should be placed at the end of a description block.
176
- For example::
177
-
178
- class Foo:
179
- """
180
- This is the summary.
181
-
182
- Followed by a longer description block.
183
-
184
- Consisting of multiple lines and paragraphs.
185
-
186
- .. versionadded:: 3.5
187
-
188
- Parameters
189
- ----------
190
- a : int
191
- The first parameter.
192
- b: bool, default: False
193
- This was added later.
194
-
195
- .. versionadded:: 3.6
196
- """
197
-
198
- def set_b(b):
199
- """
200
- Set b.
201
-
202
- .. versionadded:: 3.6
203
-
204
- Parameters
205
- ----------
206
- b: bool
207
-
208
- For classes and functions, the directive should be placed before the
209
- *Parameters * section. For parameters, the directive should be placed at the
210
- end of the parameter description. The patch release version is omitted and
211
- the directive should not be added to entire modules.
0 commit comments