-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python: Introduce feature decorator to allow for experimental and release candidate decorator usage #10691
Merged
moonbox3
merged 6 commits into
microsoft:main
from
moonbox3:update-experimental-decorator
Feb 27, 2025
Merged
Python: Introduce feature decorator to allow for experimental and release candidate decorator usage #10691
moonbox3
merged 6 commits into
microsoft:main
from
moonbox3:update-experimental-decorator
Feb 27, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TaoChenOSU
reviewed
Feb 26, 2025
TaoChenOSU
approved these changes
Feb 26, 2025
alliscode
approved these changes
Feb 27, 2025
TaoChenOSU
approved these changes
Feb 27, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
This change is required to improve the flexibility and maintainability of our feature annotation system. Previously, separate decorators (e.g.,
experimental_function
andexperimental_class
) were used to mark experimental features, resulting in code duplication and limiting our ability to handle additional feature stages. As our SDK evolves, we need a unified approach that can support multiple stages—such as experimental, release candidate, and future states—while also allowing version information for release candidate features to be centrally managed.Description
This PR refactors our feature decorators by introducing a unified
stage
decorator that updates the docstring and attaches metadata for both functions and classes. Two convenience decorators,experimental
andrelease_candidate
, are built on top ofstage
:experimental
decorator marks features as experimental and sets anis_experimental
attribute.release_candidate
decorator supports multiple usage patterns (with or without parentheses and with an optional version parameter) to mark features as release candidate and sets anis_release_candidate
attribute.This unified approach reduces duplication, simplifies the codebase, and lays the groundwork for easily extending feature stages in the future.
This decorator supports the following usage patterns:
@experimental
(for both classes and functions)@release_candidate
(no parentheses)@release_candidate()
(empty parentheses)@release_candidate("1.21.3-rc1")
(positional version)@release_candidate(version="1.21.3-rc1")
(keyword version)Contribution Checklist