From 0af710b30e7f359ece4fb952c3f02a03280f7e17 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 14 Nov 2023 12:36:19 +0000 Subject: [PATCH 1/4] make streamlit use wide mode --- dashboard.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dashboard.py b/dashboard.py index a5aaffb..bd4a13d 100644 --- a/dashboard.py +++ b/dashboard.py @@ -17,6 +17,8 @@ load_dotenv() +st.set_page_config(layout="wide") + def plot_time_series(df, metric_name) -> go.Figure: """ @@ -60,7 +62,14 @@ def plot_time_series(df, metric_name) -> go.Figure: fig.update_layout( title_text=f"{metric_name} (n={len(df)})", hovermode="x", - legend=dict(orientation="h", yanchor="bottom", y=1.02, xanchor="right", x=1), + legend=dict( + orientation="h", + yanchor="bottom", + y=1.02, + xanchor="right", + x=1 + ), + autosize=True ) return fig From c3b769928f468e4483e2be99b7a97cd936403b81 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 14 Nov 2023 12:38:50 +0000 Subject: [PATCH 2/4] Add pre-commit target to Makefile --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2050a4e..95913ae 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ SHELL=/bin/bash .PHONY: dashboard .PHONY: local .PHONY: docker +.PHONY: pre-commit ## start streamlit dashboard dashboard: @@ -16,11 +17,14 @@ local: docker: docker compose up -d --build +## pre-commit +pre-commit: + pre-commit run --all-files + ## setup local development environment and install dependencies dev: pre-commit install - # Self-documenting Makefiles: # https://gist.github.com/klmr/575726c7e05d8780505a .DEFAULT_GOAL := show-help From ad37fbe0dc02d34e460c0baa4343d591daa43cd8 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 14 Nov 2023 12:39:23 +0000 Subject: [PATCH 3/4] pre-commit fixes --- .github/workflows/pre-commit.yaml | 2 +- dashboard.py | 10 ++-------- metrics/examples/hackernews/hn_top_stories_scores.yaml | 1 - metrics/examples/netdata/netdata.yaml | 1 - .../python_ingest_simple/python_ingest_simple.yaml | 1 - metrics/examples/weather/weather.yaml | 1 - .../examples/weather_forecast/weather_forecast.yaml | 1 - metrics/examples/yfinance/yfinance.yaml | 1 - 8 files changed, 3 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index e627fc3..0a13c66 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -32,4 +32,4 @@ jobs: body: | :x: **pre-commit** failed. Please run `pre-commit run --all-files` locally and commit the changes. - Find more information in the repository's CONTRIBUTING.md \ No newline at end of file + Find more information in the repository's CONTRIBUTING.md diff --git a/dashboard.py b/dashboard.py index bd4a13d..b64a38b 100644 --- a/dashboard.py +++ b/dashboard.py @@ -62,14 +62,8 @@ def plot_time_series(df, metric_name) -> go.Figure: fig.update_layout( title_text=f"{metric_name} (n={len(df)})", hovermode="x", - legend=dict( - orientation="h", - yanchor="bottom", - y=1.02, - xanchor="right", - x=1 - ), - autosize=True + legend=dict(orientation="h", yanchor="bottom", y=1.02, xanchor="right", x=1), + autosize=True, ) return fig diff --git a/metrics/examples/hackernews/hn_top_stories_scores.yaml b/metrics/examples/hackernews/hn_top_stories_scores.yaml index e961e6d..979c7a7 100644 --- a/metrics/examples/hackernews/hn_top_stories_scores.yaml +++ b/metrics/examples/hackernews/hn_top_stories_scores.yaml @@ -12,4 +12,3 @@ alert_always: False alert_methods: "email" ingest_fn: > {% include "./examples/hackernews/hn_top_stories_scores.py" %} - diff --git a/metrics/examples/netdata/netdata.yaml b/metrics/examples/netdata/netdata.yaml index d010e2d..29c35c8 100644 --- a/metrics/examples/netdata/netdata.yaml +++ b/metrics/examples/netdata/netdata.yaml @@ -12,4 +12,3 @@ alert_always: False alert_methods: "email" ingest_fn: > {% include "./examples/netdata/netdata.py" %} - diff --git a/metrics/examples/python/python_ingest_simple/python_ingest_simple.yaml b/metrics/examples/python/python_ingest_simple/python_ingest_simple.yaml index e54c9a6..44c0995 100644 --- a/metrics/examples/python/python_ingest_simple/python_ingest_simple.yaml +++ b/metrics/examples/python/python_ingest_simple/python_ingest_simple.yaml @@ -5,4 +5,3 @@ train_cron_schedule: "*/4 * * * *" score_cron_schedule: "*/3 * * * *" ingest_fn: > {% include "./examples/python/python_ingest_simple/ingest.py" %} - diff --git a/metrics/examples/weather/weather.yaml b/metrics/examples/weather/weather.yaml index 1bf7ba7..0bcedea 100644 --- a/metrics/examples/weather/weather.yaml +++ b/metrics/examples/weather/weather.yaml @@ -12,4 +12,3 @@ alert_always: False alert_methods: "email" ingest_fn: > {% include "./examples/weather/ingest_weather.py" %} - diff --git a/metrics/examples/weather_forecast/weather_forecast.yaml b/metrics/examples/weather_forecast/weather_forecast.yaml index 60c65f8..4526515 100644 --- a/metrics/examples/weather_forecast/weather_forecast.yaml +++ b/metrics/examples/weather_forecast/weather_forecast.yaml @@ -11,4 +11,3 @@ alert_always: False alert_methods: "email" ingest_sql: > {% include "./examples/weather_forecast/weather_forecast.sql" %} - diff --git a/metrics/examples/yfinance/yfinance.yaml b/metrics/examples/yfinance/yfinance.yaml index 061e9c0..77f708d 100644 --- a/metrics/examples/yfinance/yfinance.yaml +++ b/metrics/examples/yfinance/yfinance.yaml @@ -12,4 +12,3 @@ alert_always: False alert_methods: "email" ingest_fn: > {% include "./examples/yfinance/yfinance.py" %} - From 68a4bdce7adc3da21d5bd4b4ece357ba399149d6 Mon Sep 17 00:00:00 2001 From: Andrew Maguire Date: Tue, 14 Nov 2023 12:47:46 +0000 Subject: [PATCH 4/4] Remove unused pre-commit hook. --- .pre-commit-config.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4cf8d52..583c9ff 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,9 +19,3 @@ repos: hooks: - id: isort args: ["--profile", "black"] - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.5 - hooks: - - id: ruff - args: ["--ignore", "E501, E711, E712"] # ignore line length and comparison to None, refer full list of codes here: https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes - - id: ruff-format