Skip to content

Commit afbc33f

Browse files
committed
fixup! Add new standards for deprecating APIs
1 parent 05f97bc commit afbc33f

File tree

12 files changed

+59
-56
lines changed

12 files changed

+59
-56
lines changed

Diff for: mkdocs/docs/contributing.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Optionally, include a recommendation to guide users toward an alternative featur
186186
```python
187187
from pyiceberg.utils._deprecations import deprecated
188188

189-
@deprecated("1.5.0", "2.0.0", topic="Use `new_function` instead.")
189+
@deprecated("1.5.0", "2.0.0", addendum="Use `new_function` instead.")
190190
def old_function():
191191
pass
192192
```
@@ -281,7 +281,7 @@ def some_function():
281281
# some logic
282282

283283
if condition:
284-
deprecated.topic("1.5.0", "2.0.0", topic="The <TOPIC>")
284+
deprecated.topic("1.5.0", "2.0.0", addendum="The <TOPIC>")
285285

286286
# more logic
287287
```

Diff for: pyiceberg/catalog/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ def drop_view(self, identifier: Union[str, Identifier]) -> None:
633633
@deprecated(
634634
deprecate_in="0.8.0",
635635
remove_in="0.9.0",
636-
topic="Please refer to the table using only its namespace and its table name.",
636+
addendum="Please refer to the table using only its namespace and its table name.",
637637
)
638638
def identifier_to_tuple_without_catalog(self, identifier: Union[str, Identifier]) -> Identifier:
639639
"""Convert an identifier to a tuple and drop this catalog's name from the first element.
@@ -664,7 +664,7 @@ def _identifier_to_tuple_without_catalog(self, identifier: Union[str, Identifier
664664
deprecate_in="0.8.0",
665665
remove_in="0.9.0",
666666
prefix="Support for parsing catalog level identifier in Catalog identifiers",
667-
topic="Please refer to the table using only its namespace and its table name.",
667+
addendum="Please refer to the table using only its namespace and its table name.",
668668
)
669669
identifier_tuple = identifier_tuple[1:]
670670
return identifier_tuple
@@ -787,7 +787,7 @@ def __init__(self, name: str, **properties: str):
787787
deprecate_in="0.8.0",
788788
remove_in="0.9.0",
789789
prefix=f"The property {DEPRECATED_BOTOCORE_SESSION}",
790-
topic="and will be removed.",
790+
addendum="and will be removed.",
791791
)
792792

793793
def create_table_transaction(

Diff for: pyiceberg/catalog/rest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def auth_url(self) -> str:
322322
deprecate_in="0.8.0",
323323
remove_in="0.9.0",
324324
prefix=f"The property {AUTH_URL}",
325-
topic=f"Please use {OAUTH2_SERVER_URI} instead",
325+
addendum=f"Please use {OAUTH2_SERVER_URI} instead",
326326
)
327327

328328
self._warn_oauth_tokens_deprecation()
@@ -343,7 +343,7 @@ def _warn_oauth_tokens_deprecation(self) -> None:
343343
deprecate_in="0.8.0",
344344
remove_in="1.0.0",
345345
prefix="Default OAuth2 endpoint",
346-
topic="Iceberg REST client is missing the OAuth2 server URI "
346+
addendum="Iceberg REST client is missing the OAuth2 server URI "
347347
f"configuration and defaults to {self.uri}{Endpoints.get_token}. "
348348
"This automatic fallback will be removed in a future Iceberg release."
349349
f"It is recommended to configure the OAuth2 endpoint using the '{OAUTH2_SERVER_URI}'"

Diff for: pyiceberg/cli/console.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@
4040
deprecated.constant(
4141
deprecate_in="0.8.0",
4242
remove_in="0.9.0",
43-
topic="Use TableProperties.MAX_SNAPSHOT_AGE_MS_DEFAULT instead.",
43+
addendum="Use TableProperties.MAX_SNAPSHOT_AGE_MS_DEFAULT instead.",
4444
constant="DEFAULT_MAX_SNAPSHOT_AGE_MS",
4545
value=TableProperties.MAX_SNAPSHOT_AGE_MS_DEFAULT,
4646
)
4747

4848
deprecated.constant(
4949
deprecate_in="0.8.0",
5050
remove_in="0.9.0",
51-
topic="Use TableProperties.MIN_SNAPSHOTS_TO_KEEP_DEFAULT instead.",
51+
addendum="Use TableProperties.MIN_SNAPSHOTS_TO_KEEP_DEFAULT instead.",
5252
constant="DEFAULT_MIN_SNAPSHOTS_TO_KEEP",
5353
value=TableProperties.MIN_SNAPSHOTS_TO_KEEP_DEFAULT,
5454
)

Diff for: pyiceberg/expressions/parser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def _(result: ParseResults) -> Reference:
9494
deprecate_in="0.8.0",
9595
remove_in="0.9.0",
9696
prefix="Parsing expressions with table name",
97-
topic="Only provide field names in the row_filter.",
97+
addendum="Only provide field names in the row_filter.",
9898
)
9999
# TODO: Once this is removed, we will no longer take just the last index of parsed column result
100100
# And introduce support for parsing filter expressions with nested fields.

Diff for: pyiceberg/io/fsspec.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def _gs(properties: Properties) -> AbstractFileSystem:
177177
deprecate_in="0.8.0",
178178
remove_in="0.9.0",
179179
prefix=f"The property {GCS_ENDPOINT}",
180-
topic=f"please use {GCS_SERVICE_HOST} instead",
180+
addendum=f"please use {GCS_SERVICE_HOST} instead",
181181
)
182182
return GCSFileSystem(
183183
project=properties.get(GCS_PROJECT_ID),
@@ -202,7 +202,7 @@ def _adls(properties: Properties) -> AbstractFileSystem:
202202
deprecate_in="0.8.0",
203203
remove_in="0.9.0",
204204
prefix=f"The property {property_name}",
205-
topic="Please use properties that start with adls.",
205+
addendum="Please use properties that start with adls.",
206206
)
207207

208208
return AzureBlobFileSystem(

Diff for: pyiceberg/io/pyarrow.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ def _initialize_fs(self, scheme: str, netloc: Optional[str] = None) -> FileSyste
411411
deprecate_in="0.8.0",
412412
remove_in="0.9.0",
413413
prefix=f"The property {GCS_ENDPOINT}",
414-
topic=f"please use {GCS_SERVICE_HOST} instead",
414+
addendum=f"please use {GCS_SERVICE_HOST} instead",
415415
)
416416
url_parts = urlparse(endpoint)
417417
gcs_kwargs["scheme"] = url_parts.scheme
@@ -1532,7 +1532,7 @@ def _record_batches_from_scan_tasks_and_deletes(
15321532
@deprecated(
15331533
deprecate_in="0.8.0",
15341534
remove_in="0.9.0",
1535-
topic="Use ArrowScan.to_table instead.",
1535+
addendum="Use ArrowScan.to_table instead.",
15361536
)
15371537
def project_table(
15381538
tasks: Iterable[FileScanTask],
@@ -1631,7 +1631,7 @@ def project_table(
16311631
@deprecated(
16321632
deprecate_in="0.8.0",
16331633
remove_in="0.9.0",
1634-
topic="Use ArrowScan.to_record_batches instead.",
1634+
addendum="Use ArrowScan.to_record_batches instead.",
16351635
)
16361636
def project_batches(
16371637
tasks: Iterable[FileScanTask],

Diff for: pyiceberg/table/__init__.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ def refresh(self) -> Table:
785785
@deprecated(
786786
deprecate_in="0.8.0",
787787
remove_in="0.9.0",
788-
topic="Please use Table.name() function instead.",
788+
addendum="Please use Table.name() function instead.",
789789
)
790790
def identifier(self) -> Identifier:
791791
"""Return the identifier of this table.
@@ -1540,7 +1540,7 @@ def _parquet_files_to_data_files(table_metadata: TableMetadata, file_paths: List
15401540
@deprecated(
15411541
deprecate_in="0.8.0",
15421542
remove_in="0.9.0",
1543-
topic="pyiceberg.table.Move has been changed to private class pyiceberg.table.update.schema._Move",
1543+
addendum="pyiceberg.table.Move has been changed to private class pyiceberg.table.update.schema._Move",
15441544
)
15451545
def Move(*args: Any, **kwargs: Any) -> _Move:
15461546
return _Move(*args, **kwargs)
@@ -1549,7 +1549,7 @@ def Move(*args: Any, **kwargs: Any) -> _Move:
15491549
@deprecated(
15501550
deprecate_in="0.8.0",
15511551
remove_in="0.9.0",
1552-
topic="pyiceberg.table.MoveOperation has been changed to private class pyiceberg.table.update.schema._MoveOperation",
1552+
addendum="pyiceberg.table.MoveOperation has been changed to private class pyiceberg.table.update.schema._MoveOperation",
15531553
)
15541554
def MoveOperation(*args: Any, **kwargs: Any) -> _MoveOperation:
15551555
return _MoveOperation(*args, **kwargs)
@@ -1558,7 +1558,7 @@ def MoveOperation(*args: Any, **kwargs: Any) -> _MoveOperation:
15581558
@deprecated(
15591559
deprecate_in="0.8.0",
15601560
remove_in="0.9.0",
1561-
topic="pyiceberg.table.DeleteFiles has been changed to private class pyiceberg.table.update.snapshot._DeleteFiles",
1561+
addendum="pyiceberg.table.DeleteFiles has been changed to private class pyiceberg.table.update.snapshot._DeleteFiles",
15621562
)
15631563
def DeleteFiles(*args: Any, **kwargs: Any) -> _DeleteFiles:
15641564
return _DeleteFiles(*args, **kwargs)
@@ -1567,7 +1567,7 @@ def DeleteFiles(*args: Any, **kwargs: Any) -> _DeleteFiles:
15671567
@deprecated(
15681568
deprecate_in="0.8.0",
15691569
remove_in="0.9.0",
1570-
topic="pyiceberg.table.FastAppendFiles has been changed to private class pyiceberg.table.update.snapshot._FastAppendFiles",
1570+
addendum="pyiceberg.table.FastAppendFiles has been changed to private class pyiceberg.table.update.snapshot._FastAppendFiles",
15711571
)
15721572
def FastAppendFiles(*args: Any, **kwargs: Any) -> _FastAppendFiles:
15731573
return _FastAppendFiles(*args, **kwargs)
@@ -1576,7 +1576,7 @@ def FastAppendFiles(*args: Any, **kwargs: Any) -> _FastAppendFiles:
15761576
@deprecated(
15771577
deprecate_in="0.8.0",
15781578
remove_in="0.9.0",
1579-
topic="pyiceberg.table.MergeAppendFiles has been changed to private class pyiceberg.table.update.snapshot._MergeAppendFiles",
1579+
addendum="pyiceberg.table.MergeAppendFiles has been changed to private class pyiceberg.table.update.snapshot._MergeAppendFiles",
15801580
)
15811581
def MergeAppendFiles(*args: Any, **kwargs: Any) -> _MergeAppendFiles:
15821582
return _MergeAppendFiles(*args, **kwargs)
@@ -1585,7 +1585,7 @@ def MergeAppendFiles(*args: Any, **kwargs: Any) -> _MergeAppendFiles:
15851585
@deprecated(
15861586
deprecate_in="0.8.0",
15871587
remove_in="0.9.0",
1588-
topic="pyiceberg.table.OverwriteFiles has been changed to private class pyiceberg.table.update.snapshot._OverwriteFiles",
1588+
addendum="pyiceberg.table.OverwriteFiles has been changed to private class pyiceberg.table.update.snapshot._OverwriteFiles",
15891589
)
15901590
def OverwriteFiles(*args: Any, **kwargs: Any) -> _OverwriteFiles:
15911591
return _OverwriteFiles(*args, **kwargs)

Diff for: pyiceberg/table/name_mapping.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def _field_by_name(self) -> Dict[str, MappedField]:
7878
@deprecated(
7979
deprecate_in="0.8.0",
8080
remove_in="0.9.0",
81-
topic="Please use `apply_name_mapping` instead",
81+
addendum="Please use `apply_name_mapping` instead",
8282
)
8383
def find(self, *names: str) -> MappedField:
8484
name = ".".join(names)

Diff for: pyiceberg/table/update/__init__.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,11 @@ class AddSchemaUpdate(IcebergBaseModel):
9191
last_column_id: Optional[int] = Field(
9292
alias="last-column-id",
9393
default=None,
94-
deprecated=deprecation_notice(
95-
deprecated_in="0.9.0",
96-
removed_in="0.10.0",
97-
help_message="last-field-id is handled internally, and should not be part of the update.",
94+
deprecated=deprecated.message(
95+
deprecate_in="0.9.0",
96+
remove_in="0.10.0",
97+
prefix="last-column-id",
98+
addendum="This property is handled internally, and should not be part of the update.",
9899
),
99100
)
100101

@@ -105,7 +106,7 @@ class AddSchemaUpdate(IcebergBaseModel):
105106
deprecate_in="0.8.0",
106107
remove_in="0.9.0",
107108
prefix="initial_change",
108-
topic="CreateTableTransaction can work without this field",
109+
addendum="CreateTableTransaction can work without this field",
109110
),
110111
)
111112

@@ -128,7 +129,7 @@ class AddPartitionSpecUpdate(IcebergBaseModel):
128129
deprecate_in="0.8.0",
129130
remove_in="0.9.0",
130131
prefix="initial_change",
131-
topic="CreateTableTransaction can work without this field",
132+
addendum="CreateTableTransaction can work without this field",
132133
),
133134
)
134135

@@ -151,7 +152,7 @@ class AddSortOrderUpdate(IcebergBaseModel):
151152
deprecate_in="0.8.0",
152153
remove_in="0.9.0",
153154
prefix="initial_change",
154-
topic="CreateTableTransaction can work without this field",
155+
addendum="CreateTableTransaction can work without this field",
155156
),
156157
)
157158

0 commit comments

Comments
 (0)