Skip to content
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

Add python types #10

Merged
merged 1 commit into from
May 28, 2024
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
54 changes: 54 additions & 0 deletions arro3-core/python/arro3/core/_rust.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from typing import Self
from numpy.typing import NDArray

from .types import ArrowArrayExportable, ArrowSchemaExportable, ArrowStreamExportable

class Array:
def __array__(self) -> NDArray: ...
def __arrow_c_array__(self, requested_schema) -> object: ...
def __eq__(self) -> bool: ...
def __len__(self) -> bool: ...
@classmethod
def from_arrow(cls, input: ArrowArrayExportable) -> Self: ...
def to_numpy(self) -> NDArray: ...

class ChunkedArray:
def __array__(self) -> NDArray: ...
def __arrow_c_stream__(self, requested_schema) -> object: ...
def __eq__(self) -> bool: ...
def __len__(self) -> bool: ...
@classmethod
def from_arrow(cls, input: ArrowStreamExportable) -> Self: ...
def to_numpy(self) -> NDArray: ...

class Field:
def __arrow_c_schema__(self) -> object: ...
def __eq__(self) -> bool: ...
@classmethod
def from_arrow(cls, input: ArrowSchemaExportable) -> Self: ...

class RecordBatch:
def __arrow_c_array__(self, requested_schema) -> object: ...
def __eq__(self) -> bool: ...
@classmethod
def from_arrow(cls, input: ArrowArrayExportable) -> Self: ...

class RecordBatchReader:
def __arrow_c_stream__(self, requested_schema) -> object: ...
@classmethod
def from_arrow(cls, input: ArrowStreamExportable) -> Self: ...
def schema(self) -> Schema: ...

class Schema:
def __arrow_c_schema__(self) -> object: ...
def __eq__(self) -> bool: ...
@classmethod
def from_arrow(cls, input: ArrowSchemaExportable) -> Self: ...

class Table:
def __arrow_c_stream__(self, requested_schema) -> object: ...
def __eq__(self) -> bool: ...
def __len__(self) -> bool: ...
@classmethod
def from_arrow(cls, input: ArrowStreamExportable) -> Self: ...
def schema(self) -> Schema: ...
Empty file.
23 changes: 23 additions & 0 deletions arro3-core/python/arro3/core/types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from __future__ import annotations

from typing import Protocol, Tuple


class ArrowSchemaExportable(Protocol):
"""An Arrow or GeoArrow schema or field."""

def __arrow_c_schema__(self) -> object: ...


class ArrowArrayExportable(Protocol):
"""An Arrow or GeoArrow array or RecordBatch."""

def __arrow_c_array__(
self, requested_schema: object | None = None
) -> Tuple[object, object]: ...


class ArrowStreamExportable(Protocol):
"""An Arrow or GeoArrow ChunkedArray or Table."""

def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
Loading