Skip to content

Commit fc12020

Browse files
authored
make api_version required (#295)
1 parent 4ac1291 commit fc12020

File tree

4 files changed

+16
-17
lines changed

4 files changed

+16
-17
lines changed

spec/API_specification/dataframe_api/typing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,13 @@ def date(self, year: int, month: int, day: int) -> Scalar:
154154

155155
class SupportsDataFrameAPI(Protocol):
156156
def __dataframe_consortium_standard__(
157-
self, *, api_version: str | None = None
157+
self, *, api_version: str
158158
) -> DataFrame:
159159
...
160160

161161
class SupportsColumnAPI(Protocol):
162162
def __column_consortium_standard__(
163-
self, *, api_version: str | None = None
163+
self, *, api_version: str
164164
) -> Column:
165165
...
166166

spec/API_specification/examples/02_plotting.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ def group_by_and_plot(
1414
y_any: SupportsColumnAPI,
1515
color_any: SupportsColumnAPI,
1616
) -> None:
17-
x = x_any.__column_consortium_standard__()
18-
y = y_any.__column_consortium_standard__()
19-
color = color_any.__column_consortium_standard__()
17+
x = x_any.__column_consortium_standard__(api_version='2023-10.beta')
18+
y = y_any.__column_consortium_standard__(api_version='2023-10.beta')
19+
color = color_any.__column_consortium_standard__(api_version='2023-10.beta')
2020

2121
namespace = x.__column_namespace__()
2222

spec/API_specification/examples/tpch/q5.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ def query(
3131
nation_raw: SupportsDataFrameAPI,
3232
region_raw: SupportsDataFrameAPI,
3333
) -> SupportsDataFrameAPI:
34-
customer = customer_raw.__dataframe_consortium_standard__()
35-
orders = orders_raw.__dataframe_consortium_standard__()
36-
lineitem = lineitem_raw.__dataframe_consortium_standard__()
37-
supplier = supplier_raw.__dataframe_consortium_standard__()
38-
nation = nation_raw.__dataframe_consortium_standard__()
39-
region = region_raw.__dataframe_consortium_standard__()
34+
customer = customer_raw.__dataframe_consortium_standard__(api_version='2023-10.beta')
35+
orders = orders_raw.__dataframe_consortium_standard__(api_version='2023-10.beta')
36+
lineitem = lineitem_raw.__dataframe_consortium_standard__(api_version='2023-10.beta')
37+
supplier = supplier_raw.__dataframe_consortium_standard__(api_version='2023-10.beta')
38+
nation = nation_raw.__dataframe_consortium_standard__(api_version='2023-10.beta')
39+
region = region_raw.__dataframe_consortium_standard__(api_version='2023-10.beta')
4040

4141
namespace = customer.__dataframe_namespace__()
4242

spec/purpose_and_scope.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,20 +260,19 @@ For example, pandas has ``pandas.DataFrame.__dataframe_consortium_standard__`` a
260260
The signatures should be (note: docstring is optional):
261261
```python
262262
def __dataframe_consortium_standard__(
263-
self, *, api_version: str | None = None
263+
self, *, api_version: str
264264
) -> Any:
265265

266266
def __column_consortium_standard__(
267-
self, *, api_version: str | None = None
267+
self, *, api_version: str
268268
) -> Any:
269269
```
270270
`api_version` is
271271
a string representing the version of the dataframe API specification
272272
to be returned, in ``'YYYY.MM'`` form, for example, ``'2023.04'``.
273-
If it is ``None``, it should return the namespace corresponding to
274-
latest version of the dataframe API specification. If the given
275-
version is invalid or not implemented for the given module, an
276-
error should be raised. Default: ``None``.
273+
If the given version is invalid or not implemented for the given module,
274+
an error should be raised. It is suggested to use the earliest API
275+
version required for maximum compatibility.
277276

278277
For some examples, please check https://github.com/data-apis/dataframe-api/tree/main/spec/examples.
279278

0 commit comments

Comments
 (0)