-
Notifications
You must be signed in to change notification settings - Fork 44
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
Move docs to docstrings and generate documentation with sphinx-autodoc #367
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0a1b259
Copy documentation from api.rst to docstrings
Priyansh121096 beee6c8
Use autodoc in api.rst
Priyansh121096 aeec609
Use bools instead of strs
Priyansh121096 ba07319
os.path -> pathlib
Priyansh121096 ddf282b
Merge branch 'innobi:main' into fix-docs
Priyansh121096 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,55 +1,5 @@ | ||
API Reference | ||
============= | ||
|
||
.. py:function:: frame_to_hyper(df: pd.DataFrame, database: Union[str, pathlib.Path], *, table: Union[str, tableauhyperapi.Name, tableauhyperapi.TableName], table_mode: str = "w", not_null_columns: Optional[Iterable[str]] = None, json_columns: Optional[Iterable[str]] = None, geo_columns: Optional[Iterable[str]] = None) -> None: | ||
|
||
Convert a DataFrame to a .hyper extract. | ||
|
||
:param df: Data to be written out. | ||
:param database: Name / location of the Hyper file to write to. | ||
:param table: Table to write to. | ||
:param table_mode: The mode to open the table with. Default is "w" for write, which truncates the file before writing. Another option is "a", which will append data to the file if it already contains information. | ||
:param not_null_columns: Columns which should be considered "NOT NULL" in the target Hyper database. By default, all columns are considered nullable | ||
:param json_columns: Columns to be written as a JSON data type | ||
:param geo_columns: Columns to be written as a GEOGRAPHY data type | ||
:param process_params: Parameters to pass to the Hyper Process constructor. | ||
|
||
.. py:function:: frame_from_hyper(source: Union[str, pathlib.Path, tab_api.Connection], *, table: Union[str, tableauhyperapi.Name, tableauhyperapi.TableName], return_type: Literal["pandas", "pyarrow", "polars"] = "pandas") | ||
|
||
Extracts a DataFrame from a .hyper extract. | ||
|
||
:param source: Name / location of the Hyper file to be read or Hyper-API connection. | ||
:param table: Table to read. | ||
:param return_type: The type of DataFrame to be returned | ||
:param process_params: Parameters to pass to the Hyper Process constructor. | ||
|
||
|
||
.. py:function:: frames_to_hyper(dict_of_frames: Dict[Union[str, tableauhyperapi.Name, tableauhyperapi.TableName], pd.DataFrame], database: Union[str, pathlib.Path], *, table_mode: str = "w", not_null_columns: Optional[Iterable[str]] = None, json_columns: Optional[Iterable[str]] = None, geo_columns: Optional[Iterable[str]] = None,) -> None: | ||
|
||
Writes multiple DataFrames to a .hyper extract. | ||
|
||
:param dict_of_frames: A dictionary whose keys are valid table identifiers and values are dataframes | ||
:param database: Name / location of the Hyper file to write to. | ||
:param table_mode: The mode to open the table with. Default is "w" for write, which truncates the file before writing. Another option is "a", which will append data to the file if it already contains information. | ||
:param not_null_columns: Columns which should be considered "NOT NULL" in the target Hyper database. By default, all columns are considered nullable | ||
:param json_columns: Columns to be written as a JSON data type | ||
:param geo_columns: Columns to be written as a GEOGRAPHY data type | ||
:param process_params: Parameters to pass to the Hyper Process constructor. | ||
|
||
.. py:function:: frames_from_hyper(source: Union[str, pathlib.Path, tab_api.Connection], *, return_type: Literal["pandas", "pyarrow", "polars"] = "pandas") -> dict: | ||
|
||
Extracts tables from a .hyper extract. | ||
|
||
:param source: Name / location of the Hyper file to be read or Hyper-API connection. | ||
:param return_type: The type of DataFrame to be returned | ||
:param process_params: Parameters to pass to the Hyper Process constructor. | ||
|
||
|
||
.. py:function:: frame_from_hyper_query(source: Union[str, pathlib.Path, tab_api.Connection], query: str, *, return_type: Literal["pandas", "polars", "pyarrow"] = "pandas",) | ||
|
||
Executes a SQL query and returns the result as a pandas dataframe | ||
|
||
:param source: Name / location of the Hyper file to be read or Hyper-API connection. | ||
:param query: SQL query to execute. | ||
:param return_type: The type of DataFrame to be returned | ||
:param process_params: Parameters to pass to the Hyper Process constructor. | ||
.. automodule:: pantab | ||
:members: |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to do this without having to change
sys.path
? Also, I think it would be better if you used a path relative to this file instead of the current working directory of the the shell, so something like:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@WillAyd there's two standard ways to work with autodoc as per the official docs.
The latter just seemed less frictional to me as an outside contributor and hence I went ahead with it. I'm not sure if there's a CI workflow to publish the docs or if they're automatically generated. If it's the former and I can assume that the package will be installed in the environment before the docs are generated, I can remove the
sys.path.insert
. Both workflows are perfectly standard however.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is all handled by readthedocs.com, which looks for changes to this repo and republishes the docs when pushes are made to main. If you sign up for an account there I'd be happy to add you to the project; its probably helpful for what you are trying to do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. "Priyansh121096" is my readthedocs username.