Skip to content

Commit 6b8f581

Browse files
committed
make api_version required
1 parent 202a643 commit 6b8f581

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

spec/API_specification/dataframe_api/typing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ def is_dtype(dtype: Any, kind: str | tuple[str, ...]) -> bool:
149149

150150
class SupportsDataFrameAPI(Protocol):
151151
def __dataframe_consortium_standard__(
152-
self, *, api_version: str | None = None
152+
self, *, api_version: str
153153
) -> DataFrame:
154154
...
155155

156156
class SupportsColumnAPI(Protocol):
157157
def __column_consortium_standard__(
158-
self, *, api_version: str | None = None
158+
self, *, api_version: str
159159
) -> Column:
160160
...
161161

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/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)