From 4e7aedc14cc55274111d72b57c5d228d9cdc7aa4 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Fri, 28 Jun 2024 13:12:53 +0200 Subject: [PATCH] Remove dependency to polars It is just too big (28MB) to have only to validate one code example. Instead we leave the line that uses polars as a comment. Signed-off-by: Leandro Lucarella --- pyproject.toml | 3 --- src/frequenz/sdk/timeseries/_moving_window.py | 7 ++++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 99af72c3c..318730b1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,6 @@ dev-flake8 = [ "pydoclint == 0.4.1", "pydocstyle == 6.3.0", ] -dev-examples = ["polars == 0.20.31"] dev-formatting = ["black == 24.4.2", "isort == 5.13.2"] dev-mkdocs = [ "black == 24.4.2", @@ -83,8 +82,6 @@ dev-pytest = [ "pytest-asyncio == 0.23.7", "time-machine == 2.12.0", "async-solipsism == 0.6", - # For checking docstring code examples - "frequenz-sdk[dev-examples]", "hypothesis == 6.103.1", ] dev = [ diff --git a/src/frequenz/sdk/timeseries/_moving_window.py b/src/frequenz/sdk/timeseries/_moving_window.py index 53d02e481..79e8bd040 100644 --- a/src/frequenz/sdk/timeseries/_moving_window.py +++ b/src/frequenz/sdk/timeseries/_moving_window.py @@ -93,7 +93,6 @@ async def run() -> None: Example: Create a polars data frame from a `MovingWindow` ```python - import polars as pl from datetime import datetime, timedelta, timezone async def send_mock_data(sender: Sender[Sample]) -> None: @@ -118,10 +117,12 @@ async def run() -> None: # wait for one full day until the buffer is filled await asyncio.sleep(60*60*24) - # create a polars series with one full day of data time_start = datetime(2023, 1, 1, tzinfo=timezone.utc) time_end = datetime(2023, 1, 2, tzinfo=timezone.utc) - series = pl.Series("Jan_1", window[time_start:time_end]) + + # You can now create a polars series with one full day of data by + # passing the window slice, like: + # series = pl.Series("Jan_1", window[time_start:time_end]) asyncio.run(run()) ```