Skip to content

Commit 8b6daaf

Browse files
alambjonahgao
andauthored
Minor: improve the Deprecation / API health guidelines (#13701)
* Minor: improve the Deprecation / API health policy * prettier * Update docs/source/library-user-guide/api-health.md Co-authored-by: Jonah Gao <[email protected]> * Add version guidance and make more copy/paste friendly * prettier * better * rename to guidelines --------- Co-authored-by: Jonah Gao <[email protected]>
1 parent 03e39da commit 8b6daaf

File tree

2 files changed

+47
-6
lines changed

2 files changed

+47
-6
lines changed

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,8 @@ DataFusion enforces MSRV policy using a [MSRV CI Check](https://github.com/searc
140140

141141
## DataFusion API evolution policy
142142

143-
Public methods in Apache DataFusion are subject to evolve as part of the API lifecycle.
144-
Deprecated methods will be phased out in accordance with the [policy](https://datafusion.apache.org/library-user-guide/api-health.html), ensuring the API is stable and healthy.
143+
Public methods in Apache DataFusion evolve over time: while we try to maintain a
144+
stable API, we also improve the API over time. As a result, we typically
145+
deprecate methods before removing them, according to the [api health policy].
146+
147+
[api health policy]: https://datafusion.apache.org/library-user-guide/api-health.html

docs/source/library-user-guide/api-health.md

+42-4
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,51 @@
1919

2020
# API health policy
2121

22-
To maintain API health, developers must track and properly deprecate outdated methods.
22+
DataFusion is used extensively as a library and has a large public API, thus it
23+
is important that the API is well maintained. In general, we try to minimize
24+
breaking API changes, but they are sometimes necessary.
25+
26+
When possible, rather than making breaking API changes, we prefer to deprecate
27+
APIs to give users time to adjust to the changes.
28+
29+
## Breaking Changes
30+
31+
In general, a function is part of the public API if it appears on the [docs.rs page]
32+
33+
Breaking public API changes are those that _require_ users to change their code
34+
for it to compile, and are listed as "Major Changes" in the [SemVer
35+
Compatibility Section of the cargo book]. Common examples of breaking changes:
36+
37+
- Adding new required parameters to a function (`foo(a: i32, b: i32)` -> `foo(a: i32, b: i32, c: i32)`)
38+
- Removing a `pub` function
39+
- Changing the return type of a function
40+
41+
When making breaking public API changes, please add the `api-change` label to
42+
the PR so we can highlight the changes in the release notes.
43+
44+
[docs.rs page]: https://docs.rs/datafusion/latest/datafusion/index.html
45+
[semver compatibility section of the cargo book]: https://doc.rust-lang.org/cargo/reference/semver.html#change-categories
46+
47+
## Deprecation Guidelines
48+
2349
When deprecating a method:
2450

25-
- clearly mark the API as deprecated and specify the exact DataFusion version in which it was deprecated.
26-
- concisely describe the preferred API, if relevant
51+
- Mark the API as deprecated using `#[deprecated]` and specify the exact DataFusion version in which it was deprecated
52+
- Concisely describe the preferred API to help the user transition
53+
54+
The deprecated version is the next version which contains the deprecation. For
55+
example, if the current version listed in [`Cargo.toml`] is `43.0.0` then the next
56+
version will be `44.0.0`.
57+
58+
[`cargo.toml`]: https://github.com/apache/datafusion/blob/main/Cargo.toml
59+
60+
To mark the API as deprecated, use the `#[deprecated]` attribute like this:
61+
62+
```rust
63+
#[deprecated(since = "...", note = "...")]
64+
```
2765

28-
API deprecation example:
66+
For example:
2967

3068
```rust
3169
#[deprecated(since = "41.0.0", note = "Use SessionStateBuilder")]

0 commit comments

Comments
 (0)