When modifying, deprecating, or replacing APIs, ensure a smooth transition experience for developers by following these practices: 1. **Add deprecation warnings** when removing or changing public APIs to alert users:
When modifying, deprecating, or replacing APIs, ensure a smooth transition experience for developers by following these practices:
@deprecated(
"`isinstance(treespec, LeafSpec)` is deprecated, "
"use `isinstance(treespec, TreeSpec)` and `treespec.is_leaf()` instead.",
category=FutureWarning,
)
class LeafSpec(TreeSpec):
# ...
Provide clear migration paths in deprecation messages and documentation that show exactly how to transition from old APIs to new ones.
Manage public exports by updating __all__
lists to remove deprecated items, preventing new code from adopting soon-to-be-removed APIs.
Ensure interoperability between old and new implementations during transition periods, allowing gradual migration without breaking existing code.
Following these practices helps maintain trust with developers using your libraries and reduces friction during necessary API evolution.
Enter the URL of a public GitHub repository