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,67 +17,45 @@ are backwards-incompatible API changes.
17
17
18
18
color_changes.rst
19
19
20
- .. _api_whats_new :
21
-
22
- Announce changes, deprecations, and new features
23
- ------------------------------------------------
24
20
25
- When adding or changing the API in a backward in-compatible way, please add the
26
- appropriate :ref: `versioning directive <versioning-directives >` and document it
27
- for the release notes and add the entry to the appropriate folder:
21
+ Add new API and features
22
+ ------------------------
28
23
29
- +-------------------+-----------------------------+----------------------------------------------+
30
- | addition | versioning directive | announcement folder |
31
- +===================+=============================+==============================================+
32
- | new feature | ``.. versionadded:: 3.N `` | :file: `doc/users/next_whats_new/ ` |
33
- +-------------------+-----------------------------+----------------------------------------------+
34
- | API change | ``.. versionchanged:: 3.N `` | :file: `doc/api/next_api_changes/[kind] ` |
35
- +-------------------+-----------------------------+----------------------------------------------+
36
-
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.
41
-
42
- +-----------+--------------------------------------------------+----------------------------------------------+
43
- | stage | required changes | announcement folder |
44
- +===========+==================================================+==============================================+
45
- | introduce | :ref: `introduce deprecation <intro-deprecation >` | :file: `doc/api/next_api_changes/deprecation ` |
46
- +-----------+--------------------------------------------------+----------------------------------------------+
47
- | expire | :ref: `expire deprecation <expire-deprecation >` | :file: `doc/api/next_api_changes/[kind] ` |
48
- +-----------+--------------------------------------------------+----------------------------------------------+
49
-
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.
53
-
54
- API Change Notes
55
- ^^^^^^^^^^^^^^^^
24
+ Every new function, parameter and attribute that is not explicitly marked as
25
+ private (i.e., starts with an underscore) becomes part of Matplotlib's public
26
+ API. As discussed above, changing the existing API is cumbersome. Therefore,
27
+ take particular care when adding new API:
56
28
57
- .. include :: ../api/next_api_changes/README.rst
58
- :start-line: 5
59
- :end-line: 31
29
+ - Mark helper functions and internal attributes as private by prefixing them
30
+ with an underscore.
31
+ - Carefully think about good names for your functions and variables.
32
+ - Try to adopt patterns and naming conventions from existing parts of the
33
+ Matplotlib API.
34
+ - Consider making as many arguments keyword-only as possible. See also
35
+ `API Evolution the Right Way -- Add Parameters Compatibly `__.
60
36
61
- What's new
62
- ^^^^^^^^^^
37
+ __ https://emptysqua.re/blog/api-evolution-the-right-way/#adding-parameters
63
38
64
- .. include :: ../users/next_whats_new/README.rst
65
- :start-line: 5
66
- :end-line: 24
67
39
40
+ .. _deprecation-guidelines :
68
41
69
- Deprecation
70
- -----------
42
+ Deprecate API
43
+ -------------
71
44
72
45
API changes in Matplotlib have to be performed following the deprecation process
73
46
below, except in very rare circumstances as deemed necessary by the development
74
- team. This ensures that users are notified before the change will take effect
75
- and thus prevents unexpected breaking of code.
47
+ team. Generally API deprecation happens in two stages:
48
+
49
+ * **introduce: ** warn users that the API *will * change
50
+ * **expire: ** API *is * changed as described in the introduction period
51
+
52
+ This ensures that users are notified before the change will take effect and thus
53
+ prevents unexpected breaking of code.
76
54
77
55
Rules
78
56
^^^^^
79
- - Deprecations are targeted at the next point. release (e.g. 3.x)
80
- - Deprecated API is generally removed two point-releases after introduction
57
+ - Deprecations are targeted at the next :ref: ` minor release < pr-milestones >` (e.g. 3.x)
58
+ - Deprecated API is generally removed (expired) two point-releases after introduction
81
59
of the deprecation. Longer deprecations can be imposed by core developers on
82
60
a case-by-case basis to give more time for the transition
83
61
- The old API must remain fully functional during the deprecation period
@@ -147,29 +125,44 @@ Expire deprecation
147
125
instead. For removed items that were not in the stub file, only deleting from the
148
126
allowlist is required.
149
127
150
- Adding new API and features
151
- ---------------------------
152
128
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:
129
+ .. redirect-from :: /devel/coding_guide#new-features-and-api-changes
157
130
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 `__.
131
+ .. _api_whats_new :
165
132
166
- __ https://emptysqua.re/blog/api-evolution-the-right-way/#adding-parameters
133
+ Announce new and deprecated API
134
+ -------------------------------
135
+
136
+ When adding or changing the API in a backward in-compatible way, please add the
137
+ appropriate :ref: `versioning directive <versioning-directives >` and document it
138
+ for the release notes and add the entry to the appropriate folder:
139
+
140
+ +-------------------+-----------------------------+----------------------------------------------+
141
+ | | versioning directive | announcement folder |
142
+ +===================+=============================+==============================================+
143
+ | new feature | ``.. versionadded:: 3.N `` | :file: `doc/users/next_whats_new/ ` |
144
+ +-------------------+-----------------------------+----------------------------------------------+
145
+ | API change | ``.. versionchanged:: 3.N `` | :file: `doc/api/next_api_changes/[kind] ` |
146
+ +-------------------+-----------------------------+----------------------------------------------+
147
+
148
+ When deprecating API, please add a notice as described in the
149
+ :ref: `deprecation guidelines <deprecation-guidelines >` and summarized here:
167
150
151
+ +--------------------------------------------------+----------------------------------------------+
152
+ | stage | announcement folder |
153
+ +===========+======================================+==============================================+
154
+ | :ref: `introduce deprecation <intro-deprecation >` | :file: `doc/api/next_api_changes/deprecation ` |
155
+ +-----------+--------------------------------------+----------------------------------------------+
156
+ | :ref: `expire deprecation <expire-deprecation >` | :file: `doc/api/next_api_changes/[kind] ` |
157
+ +-----------+--------------------------------------+----------------------------------------------+
158
+
159
+ Generally the introduction notices can be repurposed for the expiration notice as they
160
+ are expected to be describing the same API changes and removals.
168
161
169
162
.. _versioning-directives :
170
163
171
164
Versioning directives
172
- ---------------------
165
+ ^^^^^^^^^^^^^^^^^^^^^
173
166
174
167
When making a backward incompatible change, please add a versioning directive in
175
168
the docstring. The directives should be placed at the end of a description block.
@@ -209,3 +202,28 @@ For classes and functions, the directive should be placed before the
209
202
*Parameters * section. For parameters, the directive should be placed at the
210
203
end of the parameter description. The patch release version is omitted and
211
204
the directive should not be added to entire modules.
205
+
206
+ Release notes
207
+ ^^^^^^^^^^^^^
208
+
209
+ For both change notes and what's new, please avoid using cross-references in section
210
+ titles as it causes links to be confusing in the table of contents. Instead, ensure that
211
+ a cross-reference is included in the descriptive text.
212
+
213
+ .. _api-change-notes :
214
+
215
+ API change notes
216
+ """"""""""""""""
217
+
218
+ .. include :: ../api/next_api_changes/README.rst
219
+ :start-line: 5
220
+ :end-line: 31
221
+
222
+ .. _whats-new-notes :
223
+
224
+ What's new notes
225
+ """"""""""""""""
226
+
227
+ .. include :: ../users/next_whats_new/README.rst
228
+ :start-line: 5
229
+ :end-line: 24
0 commit comments