Skip to content

Commit

Permalink
add red ball if no update date is known
Browse files Browse the repository at this point in the history
  • Loading branch information
raoulcollenteur committed Sep 25, 2024
1 parent 3719428 commit 2d4de1a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
19 changes: 11 additions & 8 deletions generate_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def format_date(date_str):
date_obj = datetime.fromisoformat(date_str.replace("Z", "+00:00"))
return date_obj.strftime("%y-%m-%d")
except ValueError:
return date_str
return "no date"


def is_date_old(date_str):
Expand Down Expand Up @@ -50,10 +50,10 @@ def generate_list():
for category, packages in categories.items():
file.write(f"## {category}\n")
file.write(
"| Project Name | Description (Longer Header to Widen Column) | PyPI Conda | Docs | CI | Paper |\n"
"| Name | Description | PyPI Conda | Docs | CI | Paper |\n"
)
file.write(
"| ------------ | ------------------------------------------ | ---------- | ---- | -- | --------- |\n"
"| ---- | ------------------------------------------ | ---------- | ---- | -- | ----- |\n"
)
for package_name, package in packages:
description = package["description"]
Expand All @@ -66,11 +66,14 @@ def generate_list():
last_update = package.get("last_update", "")

if version or last_update:
formatted_date = format_date(last_update)
if is_date_old(last_update):
formatted_date = f"🔴 {formatted_date}"
elif is_date_recent(last_update):
formatted_date = f"🟢 {formatted_date}"
if last_update:
formatted_date = format_date(last_update)
if is_date_old(last_update):
formatted_date = f"🔴 {formatted_date}"
elif is_date_recent(last_update):
formatted_date = f"🟢 {formatted_date}"
else:
formatted_date = "🔴 No date"
description += (
f" (Version: {version}, Last Update: {formatted_date})"
)
Expand Down
4 changes: 2 additions & 2 deletions list.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
"description": "EXP-HYDRO is a catchment scale hydrological model that operates at a daily time-step. It takes as inputs the daily values of precipitation, air temperature, and potential evapotranspiration, and simulates daily streamflow at the catchment outlet.",
"url": "https://github.com/sopanpatil/exp-hydro",
"category": "Hydrological Models",
"docs": "",
"docs": "https://sopanpatil.github.io/exp-hydro/",
"CI": 0,
"last_update": "",
"pypi": "",
"doi_software": "",
"doi_paper": "",
"doi_paper": "https://doi.org/10.1002/hyp.11199",
"conda": "",
"version": ""
},
Expand Down

0 comments on commit 2d4de1a

Please sign in to comment.