Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Auto-merge matching PR
uses: actions/github-script@v7
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cache-uv-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
build-cache:
runs-on: ubuntu-latest
env:
UV_VERSION: '0.10.6'
UV_VERSION: '0.10.8'
PYTHON_VERSION: '3.13'
steps:
- name: Checkout repository
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@ jobs:
release:
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
needs: [test, docker-build-and-image-scan]
uses: ./.github/workflows/release.yaml
uses: milsman2/python-app-template/.github/workflows/release.yaml@main
permissions:
contents: write
secrets: inherit

trigger-auto-merge:
needs: release
if: needs.release.result == 'success'
uses: ./.github/workflows/auto-merge-on-release.yml
needs: [release, docker-build-and-image-scan]
uses: milsman2/python-app-template/.github/workflows/auto-merge-on-release.yml@main
permissions:
contents: write
pull-requests: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
permissions:
contents: read
env:
UV_VERSION: '>=0.10.6'
UV_VERSION: '>=0.10.8'
PYTHON_VERSION: '3.13'
steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
dist_artifacts_name: dist
dist_artifacts_dir: dist
lock_file_artifact: uv.lock
UV_VERSION: '>=0.10.6'
UV_VERSION: '>=0.10.8'
PYTHON_VERSION: '3.13'
GITHUB_ACTIONS_AUTHOR_NAME: github-actions
GITHUB_ACTIONS_AUTHOR_EMAIL: actions@users.noreply.github.com
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ruff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
permissions:
contents: read
env:
UV_VERSION: '>=0.10.6'
UV_VERSION: '>=0.10.8'
PYTHON_VERSION: '3.13'

steps:
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies = [
"black>=26.1.0",
"coverage>=7.13.2",
"httpx>=0.28.1",
"isort>=7.0.0",
"isort>=8.0.1",
"loguru>=0.7.3",
"pathlib>=1.0.1",
"prometheus-client>=0.24.1",
Expand All @@ -24,10 +24,10 @@ dependencies = [
]

[project.optional-dependencies]
build = ["uv >= 0.10.6"]
build = ["uv >= 0.10.7"]

[build-system]
requires = ["uv_build >= 0.10.6"]
requires = ["uv_build >= 0.10.7"]
build-backend = "uv_build"

[project.scripts]
Expand Down
4 changes: 2 additions & 2 deletions src/sample_python_app/ui/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""UI package for synthwave terminal display and related components."""

from sample_python_app.ui.display import display_astronomical_data
from sample_python_app.ui.synthwave import synthwave_dashboard, synthwave_display
from sample_python_app.ui.synthwave import synthwave_dashboard

__all__ = ["synthwave_display", "synthwave_dashboard", "display_astronomical_data"]
__all__ = ["synthwave_dashboard", "display_astronomical_data"]
66 changes: 66 additions & 0 deletions src/sample_python_app/ui/astro_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
"""Render an astronomical summary table with figlets and times.

This module builds a two-column Rich table containing large figlet
art for sunrise/sunset, followed by an "Event | Local Time" header
row and the corresponding event times converted to the app timezone.
"""

from pyfiglet import Figlet
from rich.align import Align
from rich.console import Group
from rich.table import Table
from rich.text import Text

from sample_python_app.core import Settings
from sample_python_app.models import AstronomicalData


def build_astro_table(astro: AstronomicalData, settings: Settings):
"""Build a rich Table for the astronomical data.

The table renders large figlets first, then a manual header row
"Event | Local Time" immediately below the figlets so the
column labels appear under the art.
"""
astro_table = Table(show_header=False, box=None)

sunrise_local = astro.sunrise.astimezone(settings.tz)
sun_art = Figlet(font="small", width=60).renderText("SUNRISE")
sun_set_art = Figlet(font="small", width=60).renderText("SUNSET")
sun_text = Text(sun_art, style="bold yellow")
sun_set_text = Text(sun_set_art, style="bold blue")
sunrise_time_art = Figlet(font="mini", width=60).renderText(
sunrise_local.strftime("%I:%M %p")
)
sunset_time_art = Figlet(font="mini", width=60).renderText(
astro.sunset.astimezone(settings.tz).strftime("%I:%M %p")
)
sunrise_time_text = Text(sunrise_time_art, style="bold yellow")
sunset_time_text = Text(sunset_time_art, style="bold blue")

astro_table.add_row(
Align(
Group(Align.center(sun_text), Align.center(sunrise_time_text)),
align="center",
vertical="middle",
),
Align(
Group(Align.center(sun_set_text), Align.center(sunset_time_text)),
align="center",
vertical="middle",
),
)

astro_table.add_row(
Text("Event", style="bold magenta", justify="center"),
Text("Local Time", style="bold magenta", justify="center"),
)

tz = settings.tz
time_fmt = "%I:%M %p %Z"
for name, dt in astro.as_local(tz).items():
label = name.replace("_", " ").title()
value = dt.strftime(time_fmt) if hasattr(dt, "strftime") else str(dt)
astro_table.add_row(f"[bold #ff6ec7]{label}[/]", f"[bold #00eaff]{value}[/]")

return astro_table
38 changes: 38 additions & 0 deletions src/sample_python_app/ui/forecast_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""Module for building a rich Table to display forecast data."""

from rich.table import Table

from sample_python_app.core import Settings
from sample_python_app.models.forecast_geojson import ForecastFeature


def build_forecast_table(forecast: ForecastFeature, settings: Settings, periods=12):
"""Build a rich Table for the hourly forecast data."""
fc_table = Table(show_header=True, header_style="bold magenta", box=None)
fc_table.add_column("Time", style="bold #00eaff")
fc_table.add_column("T", style="bold #ffdd57")
fc_table.add_column("POP", style="bold #ff6ec7")
fc_table.add_column("Wind", style="bold #00ff9e")
fc_table.add_column("Short", style="bold #ffffff")

count = 0
for p in forecast.properties.periods:
if count >= periods:
break
t = p.start_time.astimezone(settings.tz).strftime("%I %p")
temp = (
f"{p.temperature}°{p.temperature_unit or ''}"
if p.temperature is not None
else "-"
)
pop = (
f"{int(p.probability_of_precipitation.value)}%"
if p.probability_of_precipitation
and p.probability_of_precipitation.value is not None
else "-"
)
wind = p.wind_speed or "-"
short = p.short_forecast or ""
fc_table.add_row(t, temp, pop, wind, short)
count += 1
return fc_table
5 changes: 2 additions & 3 deletions src/sample_python_app/ui/header_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def build_header_panel(
The panel itself remains flexible and does not enforce a fixed height.
"""
sunrise_local = astro.sunrise.astimezone(settings.tz)
# Render as three stacked lines: SYNTHWAVE, SUNRISE, then the date
header_main = Figlet(font="slant", width=80).renderText("SYNTHWAVE")
header_main_text = Text(header_main, style="bold magenta")
header_sub = Figlet(font="small", width=80).renderText("SUNRISE")
Expand All @@ -32,10 +31,10 @@ def build_header_panel(
Align.center(header_sub_text),
Align.center(date_text),
)
# Vertically center the header + date within the panel
return Panel(
header_panel = Panel(
Align(content, align="center", vertical="middle"),
title="[bold #ff6ec7]Synthwave[/bold #ff6ec7]",
border_style="#ff00cc",
padding=(0, 1),
)
return header_panel
Loading
Loading