-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render API docstrings in
.py
files as html (#98)
This does the following: - Ensure the package in `spec/API_specification/dataframe_api/` is importable - Ensure all docstrings for objects/methods are rendered in the html docs via `autodoc` - Add a description for operators supported by the dataframe object (and a few TODOs) - Adds Sphinx templates for styling the html rendered versions of methods and attributes properly (taken over from the array-api repo). The Sphinx templates help with better styling of methods/attrs - Adds some infrastructure for static typing that we may need. So far only the `Scalar` class needed a `TypeVar`, but there should be more to do there.
- Loading branch information
Showing
16 changed files
with
387 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
*.swp | ||
_build | ||
__pycache__ | ||
spec/API_specification/generated/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.. _column-object: | ||
|
||
Column object | ||
============= | ||
|
||
A conforming implementation of the dataframe API standard must provide and | ||
support a column object having the following attributes and methods. | ||
|
||
------------------------------------------------- | ||
|
||
Methods | ||
------- | ||
TODO | ||
|
||
.. | ||
NOTE: please keep the methods in alphabetical order | ||
.. currentmodule:: dataframe_api | ||
|
||
.. autosummary:: | ||
:toctree: generated | ||
:template: property.rst | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
""" | ||
Types for type annotations used in the dataframe API standard. | ||
The type variables should be replaced with the actual types for a given | ||
library, e.g., for Pandas TypeVar('DataFrame') would be replaced with pd.DataFrame. | ||
""" | ||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass | ||
from typing import ( | ||
Any, | ||
List, | ||
Literal, | ||
Optional, | ||
Sequence, | ||
Tuple, | ||
TypeVar, | ||
Union, | ||
Protocol, | ||
) | ||
from enum import Enum | ||
|
||
array = TypeVar("array") | ||
Scalar = TypeVar("Scalar") | ||
device = TypeVar("device") | ||
dtype = TypeVar("dtype") | ||
SupportsDLPack = TypeVar("SupportsDLPack") | ||
SupportsBufferProtocol = TypeVar("SupportsBufferProtocol") | ||
PyCapsule = TypeVar("PyCapsule") | ||
# ellipsis cannot actually be imported from anywhere, so include a dummy here | ||
# to keep pyflakes happy. https://github.com/python/typeshed/issues/3556 | ||
ellipsis = TypeVar("ellipsis") | ||
|
||
_T_co = TypeVar("_T_co", covariant=True) | ||
|
||
|
||
class NestedSequence(Protocol[_T_co]): | ||
def __getitem__(self, key: int, /) -> Union[_T_co, NestedSequence[_T_co]]: | ||
... | ||
|
||
def __len__(self, /) -> int: | ||
... | ||
|
||
|
||
__all__ = [ | ||
"Any", | ||
"DataFrame", | ||
"List", | ||
"Literal", | ||
"NestedSequence", | ||
"Optional", | ||
"PyCapsule", | ||
"SupportsBufferProtocol", | ||
"SupportsDLPack", | ||
"Tuple", | ||
"Union", | ||
"Sequence", | ||
"array", | ||
"device", | ||
"dtype", | ||
"ellipsis", | ||
"Enum", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.