Skip to content

Commit 9a9fbcf

Browse files
committed
fixup! Deprecate rest.authorization-url in favor of oauth2-server-uri
1 parent bebaf83 commit 9a9fbcf

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

mkdocs/docs/how-to-release.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ For example, the API with the following deprecation tag should be removed when p
4040

4141
We also have the `deprecation_message` function. We need to change the behavior according to what is noted in the message of that deprecation.
4242

43+
```python
44+
deprecation_message(
45+
deprecated_in="0.1.0",
46+
removed_in="0.2.0",
47+
help_message="The old_property is deprecated. Please use the something_else property instead.",
48+
)
49+
```
50+
4351
## Running a release candidate
4452

4553
Make sure that the version is correct in `pyproject.toml` and `pyiceberg/__init__.py`. Correct means that it reflects the version that you want to release.

pyiceberg/utils/deprecated.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,10 @@ def deprecated(deprecated_in: str, removed_in: str, help_message: Optional[str]
3030
def decorator(func: Callable): # type: ignore
3131
@functools.wraps(func)
3232
def new_func(*args: Any, **kwargs: Any) -> Any:
33-
warnings.simplefilter("always", DeprecationWarning) # turn off filter
34-
35-
warnings.warn(
36-
f"Call to {func.__name__}, deprecated in {deprecated_in}, will be removed in {removed_in}.{help_message}",
37-
category=DeprecationWarning,
38-
stacklevel=2,
39-
)
40-
warnings.simplefilter("default", DeprecationWarning) # reset filter
33+
message = f"Call to {func.__name__}, deprecated in {deprecated_in}, will be removed in {removed_in}.{help_message}"
34+
35+
_deprecation_warning(message)
36+
4137
return func(*args, **kwargs)
4238

4339
return new_func
@@ -46,14 +42,20 @@ def new_func(*args: Any, **kwargs: Any) -> Any:
4642

4743

4844
def deprecation_message(deprecated_in: str, removed_in: str, help_message: Optional[str]) -> None:
49-
"""Mark properties as deprecated.
45+
"""Mark properties or behaviors as deprecated.
5046
51-
Adding this will result in a warning being emitted when the property is used.
47+
Adding this will result in a warning being emitted.
5248
"""
49+
message = f"Deprecated in {deprecated_in}, will be removed in {removed_in}. {help_message}"
50+
51+
_deprecation_warning(message)
52+
53+
54+
def _deprecation_warning(message: str) -> None:
5355
warnings.simplefilter("always", DeprecationWarning) # turn off filter
5456

5557
warnings.warn(
56-
f"Deprecated in {deprecated_in}, will be removed in {removed_in}. {help_message}",
58+
message,
5759
category=DeprecationWarning,
5860
stacklevel=2,
5961
)

0 commit comments

Comments
 (0)