Skip to content

Commit 271b06d

Browse files
authored
Merge branch 'main' into Test_issue_57930
2 parents 564dbbf + 8a53447 commit 271b06d

File tree

2 files changed

+75
-1
lines changed

2 files changed

+75
-1
lines changed

pandas/core/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5009,7 +5009,7 @@ def assign(self, **kwargs) -> DataFrame:
50095009
50105010
Parameters
50115011
----------
5012-
**kwargs : dict of {str: callable or Series}
5012+
**kwargs : callable or Series
50135013
The column names are keywords. If the values are
50145014
callable, they are computed on the DataFrame and
50155015
assigned to the new columns. The callable must not
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# PDEP-17: Backwards compatibility and deprecation policy
2+
3+
- Created: 27 June 2024
4+
- Status: Accepted
5+
- Discussion: [#59125](https://github.com/pandas-dev/pandas/issues/59125)
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+
The main additions to [pandas' current version policy](https://pandas.pydata.org/pandas-docs/version/2.2/development/policies.html) are:
14+
- Deprecated functionality should remain unchanged in at least 2 minor releases before being changed or removed.
15+
- Deprecations should initially use DeprecationWarning, and then be switched to FutureWarning in the last minor release before the major release they are planned to be removed in
16+
17+
## Motivation
18+
19+
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.
20+
21+
This policy will ensure that users have enough time to deal with deprecations while also minimizing disruptions on downstream packages' users.
22+
23+
## Scope
24+
25+
This PDEP covers pandas' approach to backwards compatibility and the deprecation and removal process.
26+
27+
## Background
28+
29+
pandas uses a loose variant of semantic versioning.
30+
A pandas release number is written in the format of ``MAJOR.MINOR.PATCH``.
31+
32+
## General policy
33+
34+
This policy applies to the [public API][1]. Anything not part of the [public API][1] 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 if possible.
38+
- Breaking changes should only occur in major releases.
39+
- No deprecations should be introduced in patch releases.
40+
- Deprecated functionality should remain unchanged in at least 2 minor releases before being changed or removed.
41+
42+
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.
43+
44+
## Deprecation process
45+
46+
Deprecation provides a way to warn developers and give them time to adapt their code to the new functionality before the old behavior is eventually removed.
47+
48+
A deprecation's warning message should:
49+
- Provide information on what is changing.
50+
- Mention how to achieve similar behavior if an alternative is available.
51+
- For large-scale deprecations, it is recommended to 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 last minor release before the major release they are planned to be removed in.
62+
This implementation detail can be ignored by using the appropriate ``PandasDeprecationWarning`` variable, which will be aliased to the proper warning class based on the pandas version.
63+
64+
### Enforcement of deprecations
65+
66+
When one enforces a deprecation, they should:
67+
- Add an entry in the release notes.
68+
- For API changes, replace the ``.. deprecated::`` directive in the documentation with a ``.. versionchanged::`` directive.
69+
70+
### PDEP-17 History
71+
72+
- 27 June 2024: Initial version.
73+
74+
[1]: https://pandas.pydata.org/docs/reference/index.html

0 commit comments

Comments
 (0)