docs/source/contributor-guide/api-health.md
DataFusion is used extensively as a library in other applications and has a large public API. We try to keep the API well maintained and minimize breaking changes to avoid issues for downstream users.
In general, an item is part of the public API if it appears on the docs.rs page.
Breaking public API changes are those that require users to change their code for it to compile and execute, and are listed as "Major Changes" in the SemVer Compatibility Section of the Cargo Book. Common examples of breaking changes include:
foo(a: i32, b: i32) -> foo(a: i32, b: i32, c: i32))pub functiontrait without a default implementationExamples of non-breaking changes include:
#[deprecated])trait with a default implementationWhen possible, we prefer to avoid making breaking API changes. One common way to avoid such changes is to deprecate the old API, as described in the Deprecation Guidelines section below.
If you do want to propose a breaking API change, we must weigh the benefits of the change with the cost (impact on downstream users). It is often frustrating for downstream users to change their applications, and it is even more so if they do not gain improved capabilities.
Examples of good reasons for making a breaking API change include:
Examples of potentially weak reasons for making breaking API changes include:
When making breaking public API changes, please:
api-change label to the PR so we can highlight the changes in the release notes.When a change requires DataFusion users to modify their code as part of an upgrade, please consider documenting it in the version-specific Upgrade Guide.
When deprecating a method:
#[deprecated] and specify the exact DataFusion version in which it was deprecatedThe deprecated version is the next version that introduces the deprecation. For
example, if the current version listed in Cargo.toml is 43.0.0, then the next
version will be 44.0.0.
To mark the API as deprecated, use the #[deprecated(since = "...", note = "...")] attribute.
For example:
#[deprecated(since = "41.0.0", note = "Use new API instead")]
pub fn api_to_deprecated(a: usize, b: usize) {}
Deprecated methods will remain in the codebase for a period of 6 major versions or 6 months, whichever is longer, to provide users ample time to transition away from them.
Please refer to DataFusion releases to plan API migration ahead of time.