docs: add a deprecation policy to the contributing guide#4051
docs: add a deprecation policy to the contributing guide#4051maxrjones wants to merge 5 commits into
Conversation
Closes zarr-developers#2924. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4051 +/- ##
=======================================
Coverage 93.50% 93.50%
=======================================
Files 90 90
Lines 11981 11981
=======================================
Hits 11203 11203
Misses 778 778 🚀 New features to boost your workflow:
|
|
|
||
| #### How long a deprecation lasts | ||
|
|
||
| A deprecated API must remain available, emitting its warning, for **at least 6 months and at least one minor release** before it is removed. These are minimums, not targets: for widely-used API, prefer a longer cycle, and communicate the upcoming removal beyond the warning itself (for example, in release notes or a migration guide). |
There was a problem hiding this comment.
I would note that effver means we can do this, but that this is not real semver. This is actually not immediately stated anywhere in this doc AFAICT but this new section of the doucment really sharpens the need i.e., "breaking changes are allowed on the minor / patch if needed/warranted"
| 1. **Emit a warning at runtime.** Raise `zarr.errors.ZarrDeprecationWarning` for an API that will be *removed*. Use `zarr.errors.ZarrFutureWarning` instead when behavior will *change* rather than disappear (for example, a default value that will change), since `FutureWarning` is shown to end users by default. The [`typing_extensions.deprecated`](https://typing-extensions.readthedocs.io/en/latest/#deprecated) decorator is the preferred way to deprecate whole functions, methods, and classes. When calling `warnings.warn` directly, set `stacklevel` so the warning points at the caller's code rather than zarr internals. | ||
| 2. **Write an actionable message.** The warning message must state the release the deprecation first appeared in, the planned removal (a specific version if known, otherwise "a future release"), and the migration path -- what the user should do instead. A deprecation warning with no replacement guidance is incomplete. | ||
| 3. **Document it.** Mark the deprecation in the docstring (via the `deprecated` decorator or a "Deprecated" admonition) so it appears in the rendered API documentation, and update any affected user-guide prose. | ||
| 4. **Add a changelog entry.** Add a `removal` changelog fragment in `changes/` (for example, `changes/1234.removal.md`) so the deprecation is announced under "Deprecations and Removals" in the release notes. When the API is finally removed, add a second `removal` fragment for that release. |
There was a problem hiding this comment.
What about for changed, not deprecated, behavior i.e., what you state in point 1?
|
|
||
| Our versioning policy (above) commits us to minimizing the effort users spend upgrading. A deprecation cycle is the main tool we use to honor that commitment: rather than removing or changing public behavior abruptly, we first ship a release that keeps the old behavior working while warning that it is going away, and only remove it in a later release. This section defines when a deprecation cycle is required, how to decide whether a removal is worth it, and the concrete steps a deprecation must follow. | ||
|
|
||
| This policy governs the user-facing Python API of `zarr-python`: importable names, function and method signatures, and observable runtime behavior. It does not govern the Zarr data format, whose compatibility is described under [Data format compatibility](#data-format-compatibility) above, nor the `zarr.experimental` namespace, which is governed by the [Experimental API policy](#experimental-api-policy) below. Private API (names prefixed with `_`, and anything not documented as public) may change at any time without a deprecation cycle. |
There was a problem hiding this comment.
This should be clear to include exceptions as well IMO I get that counts as "runtime behavior" but it may not come to people's minds
Closes #2924.
This PR adds a deprecation policy to the contributing guide, so there's a shared framework all contributors and maintainers can apply rather than re-deriving one for each PR. Making it a public doc also gives users visibility into how we handle breaking changes.
The policy is consistent with our EffVer versioning and covers scope, decision framework, mechanics, minimum period, and exceptions to the policy.
TODO:
docs/user-guide/*.mdchanges/