@@ -2159,31 +2159,6 @@ async def wrapper(*args, **kwargs):
21592159# ============================================================================
21602160
21612161
2162- def exempt_from_compat_check (func : Callable ) -> Callable :
2163- """
2164- Mark a function as exempt from backward compatibility checks.
2165-
2166- Use this decorator for:
2167- - Internal APIs not intended for external use
2168- - Experimental features that may change
2169- - Functions explicitly documented as unstable
2170-
2171- Args:
2172- func: The function to mark as exempt
2173-
2174- Returns:
2175- The original function with an exemption marker
2176-
2177- Example:
2178- @exempt_from_compat_check
2179- def experimental_api():
2180- '''This API may change without notice'''
2181- pass
2182- """
2183- func ._exempt_from_compat_check = True
2184- return func
2185-
2186-
21872162def deprecated (
21882163 version : str ,
21892164 removal_version : Optional [str ] = None ,
@@ -2254,23 +2229,32 @@ def wrapper(*args, **kwargs):
22542229
22552230def internal_api (func : Callable ) -> Callable :
22562231 """
2257- Mark a function as internal API (not for external use).
2232+ Mark a function or class as internal API (not for external use).
2233+
2234+ Use this decorator for:
2235+ - Internal APIs not intended for public consumption
2236+ - Experimental features that may change without notice
2237+ - Implementation details that are not part of the stable API
22582238
2259- This is semantically similar to exempt_from_compat_check but
2260- more explicitly communicates that the function is internal .
2239+ Objects marked with this decorator will be exempt from backward
2240+ compatibility checks .
22612241
22622242 Args:
2263- func: The function to mark as internal
2243+ func: The function or class to mark as internal
22642244
22652245 Returns:
2266- The original function with an internal API marker
2246+ The original function/class with an internal API marker
22672247
22682248 Example:
22692249 @internal_api
22702250 def _internal_helper():
22712251 '''For internal use only'''
22722252 pass
2253+
2254+ @internal_api
2255+ class ExperimentalFeature:
2256+ '''This API may change without notice'''
2257+ pass
22732258 """
22742259 func ._internal_api = True
2275- func ._exempt_from_compat_check = True # Also exempt from checks
22762260 return func
0 commit comments