Skip to content

Commit bbe15b9

Browse files
committed
PDEP-17: Backwards compatibility and deprecation policy
1 parent 0320b3c commit bbe15b9

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# PDEP-17: Backwards compatibility and deprecation policy
2+
3+
- Created: June 2024
4+
- Status: Under discussion
5+
- Discussion:
6+
- Author: [Abdulaziz Aloqeely](https://github.com/Aloqeely)
7+
- Revision: 1
8+
9+
## Abstract
10+
11+
This PDEP defines pandas' backwards compatibility and deprecation policy.
12+
13+
## Motivation
14+
15+
Having a clear backwards compatibility and deprecation policy is crucial to having a healthy ecosystem. We want to ensure users can rely on pandas being stable while still allowing the library to evolve.
16+
17+
This policy will ensure that users have enough time to deal with deprecations while also minimizing disruptions on downstream packages' users.
18+
19+
## Scope
20+
21+
This PDEP covers pandas' approach to backwards compatibility and the deprecation and removal process.
22+
23+
The decision making process for deprecating features is out of scope for this PDEP.
24+
25+
## Background
26+
27+
pandas uses a loose variant of semantic versioning.
28+
A pandas release number is written in the format of ``MAJOR.MINOR.PATCH``.
29+
30+
For the purposes of this PDEP, the last minor release before a major release will be referred to as the 'final minor version'.
31+
32+
## General policy
33+
34+
This policy applies to the public API. Anything not part of the public API or is marked as "Experimental" may be changed or removed at anytime.
35+
36+
- Breaking backwards compatibility should benefit more than it harms users.
37+
- Breaking changes should go through a deprecation cycle before being implemented.
38+
- Breaking changes should only occur in major releases.
39+
- No deprecations should be introduced in patch releases.
40+
41+
Some bug fixes may require breaking backwards compatibility. In these cases, a deprecation cycle is not necessary. However, bug fixes which have a large impact on users might be treated as a breaking change. Whether or not a change is a bug fix or an API breaking change is a judgement call.
42+
43+
## Deprecation process
44+
45+
Whenever there are plans to break backwards compatibility, a deprecation must be introduced. The deprecation will preserve the existing behavior while emitting a warning that the behavior will be changing in a future version.
46+
47+
A deprecation's warning message should:
48+
- Provide information on what is changing.
49+
- Mention how to achieve similar behavior if an alternative is available.
50+
- Include the version in which the deprecation will be enforced.
51+
- For large-scale deprecations, it is recommended include a reason for the deprecation, alongside a discussion link to get user feedback.
52+
53+
Additionally, when one introduces a deprecation, they should:
54+
- Use the appropriate warning class. More info on this can be found below.
55+
- Add the GitHub issue/PR number as a comment above the warning line.
56+
- Add an entry in the release notes.
57+
- Mention that the functionality is deprecated in the documentation using the ``.. deprecated::`` directive.
58+
59+
### Which warning class to use
60+
61+
Deprecations should initially use ``DeprecationWarning``, and then be switched to ``FutureWarning`` for broader visibility in the final minor version before the major release they are planned to be removed in.
62+
This implementation detail can be ignored by using the appropriate ``PandasDeprecationWarning`` variable.
63+
64+
Not all deprecations have to use ``DeprecationWarning`` but all deprecations should eventually transition to ``FutureWarning``, i.e. deprecations in the final minor version which are planned to be removed in the major release after will immediately use ``FutureWarning``.
65+
66+
It is recommended to not introduce large-scale deprecations in the final minor version which are planned to be removed in the major release after, since that will immediately be using a loud ``FutureWarning`` with not much time between deprecation and removal. Instead, a ``DeprecationWarning`` should be used, and the removal should be scheduled for a later major release.
67+
68+
### Support window for the final minor version
69+
70+
Defining a release policy is not part of this PDEP's scope, but, the final minor version plays a special role in deprecations, since:
71+
- It is the version where deprecations planned for removal in the next major release get switched from a ``DeprecationWarning`` to a more visible ``FutureWarning``.
72+
- ``FutureWarning`` deprecations released in it will immediately be removed in the next major release.
73+
74+
And so, this document recommends a minimum of 6 months between the final minor version and the next major release.
75+
76+
### Enforcement of deprecations
77+
78+
When one enforces a deprecation, they should:
79+
- Add an entry in the release notes.
80+
- Replace the ``.. deprecated::`` directive in the documentation with a ``.. versioncchanged::`` directive.
81+
82+
### PDEP-17 History
83+
84+
- June 2024: Initial version.

0 commit comments

Comments
 (0)