Skip to content

make api_version required #295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spec/API_specification/dataframe_api/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ def is_dtype(dtype: Any, kind: str | tuple[str, ...]) -> bool:

class SupportsDataFrameAPI(Protocol):
def __dataframe_consortium_standard__(
self, *, api_version: str | None = None
self, *, api_version: str
) -> DataFrame:
...

class SupportsColumnAPI(Protocol):
def __column_consortium_standard__(
self, *, api_version: str | None = None
self, *, api_version: str
) -> Column:
...

Expand Down
6 changes: 3 additions & 3 deletions spec/API_specification/examples/02_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ def group_by_and_plot(
y_any: SupportsColumnAPI,
color_any: SupportsColumnAPI,
) -> None:
x = x_any.__column_consortium_standard__()
y = y_any.__column_consortium_standard__()
color = color_any.__column_consortium_standard__()
x = x_any.__column_consortium_standard__(api_version='2023-10.beta')
y = y_any.__column_consortium_standard__(api_version='2023-10.beta')
color = color_any.__column_consortium_standard__(api_version='2023-10.beta')

namespace = x.__column_namespace__()

Expand Down
12 changes: 6 additions & 6 deletions spec/API_specification/examples/tpch/q5.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ def query(
nation_raw: SupportsDataFrameAPI,
region_raw: SupportsDataFrameAPI,
) -> SupportsDataFrameAPI:
customer = customer_raw.__dataframe_consortium_standard__()
orders = orders_raw.__dataframe_consortium_standard__()
lineitem = lineitem_raw.__dataframe_consortium_standard__()
supplier = supplier_raw.__dataframe_consortium_standard__()
nation = nation_raw.__dataframe_consortium_standard__()
region = region_raw.__dataframe_consortium_standard__()
customer = customer_raw.__dataframe_consortium_standard__(api_version='2023-10.beta')
orders = orders_raw.__dataframe_consortium_standard__(api_version='2023-10.beta')
lineitem = lineitem_raw.__dataframe_consortium_standard__(api_version='2023-10.beta')
supplier = supplier_raw.__dataframe_consortium_standard__(api_version='2023-10.beta')
nation = nation_raw.__dataframe_consortium_standard__(api_version='2023-10.beta')
region = region_raw.__dataframe_consortium_standard__(api_version='2023-10.beta')

namespace = customer.__dataframe_namespace__()

Expand Down
11 changes: 5 additions & 6 deletions spec/purpose_and_scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,20 +260,19 @@ For example, pandas has ``pandas.DataFrame.__dataframe_consortium_standard__`` a
The signatures should be (note: docstring is optional):
```python
def __dataframe_consortium_standard__(
self, *, api_version: str | None = None
self, *, api_version: str
) -> Any:

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

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

Expand Down