From 514aeb61c8ab5df96fceeedc85295716d5130a8b Mon Sep 17 00:00:00 2001 From: Lorin Dawson <22798188+R7L208@users.noreply.github.com> Date: Tue, 1 Oct 2024 17:23:58 -0600 Subject: [PATCH] Update Docs Dependencies (#411) * update requirements file for docs build to add missing dependencies * add newlines after show and select method docstrings in tsdf class * add indentation to newline in params so doc-utils recognizes it as param definiton * helpful script to get latest dbr environment it's very difficult to use within tox because of how envs are handled * move doc requirments to common requirements folder * update tox.ini for doc build * remove get_latest_dbr_env.sh --- .../requirements/docs.txt | 2 +- python/tempo/tsdf.py | 8 +++++--- python/tox.ini | 15 ++++++++++++--- 3 files changed, 18 insertions(+), 7 deletions(-) rename docs/requirements.txt => python/requirements/docs.txt (93%) diff --git a/docs/requirements.txt b/python/requirements/docs.txt similarity index 93% rename from docs/requirements.txt rename to python/requirements/docs.txt index b96f09f0..a13dbc03 100644 --- a/docs/requirements.txt +++ b/python/requirements/docs.txt @@ -3,4 +3,4 @@ sphinx-copybutton sphinx sphinx-design sphinx-panels -furo \ No newline at end of file +furo diff --git a/python/tempo/tsdf.py b/python/tempo/tsdf.py index f5c0a86f..4cb4d8c6 100644 --- a/python/tempo/tsdf.py +++ b/python/tempo/tsdf.py @@ -389,7 +389,7 @@ def select(self, *cols: Union[str, List[str]]) -> "TSDF": pyspark.sql.DataFrame.select() method's equivalent for TSDF objects :param cols: str or list of strs column names (string). If one of the column names is '*', that - column is expanded to include all columns in the current :class:`TSDF`. + column is expanded to include all columns in the current :class:`TSDF`. ## Examples .. code-block:: python @@ -399,6 +399,7 @@ def select(self, *cols: Union[str, List[str]]) -> "TSDF": [Row(name='Alice', age=2), Row(name='Bob', age=5)] """ + # The columns which will be a mandatory requirement while selecting from TSDFs seq_col_stub = [] if bool(self.sequence_col) is False else [self.sequence_col] mandatory_cols = [self.ts_col] + self.partitionCols + seq_col_stub @@ -581,8 +582,8 @@ def show( :param n: Number of rows to show. (default: 20) :param truncate: If set to True, truncate strings longer than 20 chars by default. - If set to a number greater than one, truncates long strings to length truncate - and align cells right. + If set to a number greater than one, truncates long strings to length truncate + and align cells right. :param vertical: If set to True, print output rows vertically (one line per column value). ## Example to show usage: @@ -603,6 +604,7 @@ def show( # Call show method here phone_accel_tsdf.show() """ + # validate k <= n if k > n: raise ValueError(f"Parameter k {k} cannot be greater than parameter n {n}") diff --git a/python/tox.ini b/python/tox.ini index 3d236e34..3141ffb8 100644 --- a/python/tox.ini +++ b/python/tox.ini @@ -61,10 +61,19 @@ commands = python setup.py clean bdist_wheel [testenv:build-docs] -description = build distribution -allowlist_externals = make +description = build documentation +basepython = py3.10 +skipdist = true +skip_install = true +allowlist_externals = + make deps = - -r ../docs/requirements.txt + -rrequirements/docs.txt +; TODO: making this dynamic is difficult in tox, so for now we will just use the latest version + ; We should have a top-level makefile that orchestrates this which allows better environment prep and execution of + ; shell scripts prior to tox execution. it'll also create a stable interface for migrating to hatch in the future + ; since the make commands would not change + -rrequirements/dbr143.txt semver commands = make --directory ../docs html