Skip to content

WEB: Sort PDEPs by their number #52072

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 22, 2023
15 changes: 14 additions & 1 deletion web/pandas_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,20 @@ def roadmap_pdeps(context):
) as f:
json.dump(pdeps, f)

for pdep in sorted(pdeps["items"], key=operator.itemgetter("title")):
regex = r"^PDEP-(\d+)"
compiled_pattern = re.compile(regex)

def sort_pdep(pdep: dict) -> int:
title = pdep["title"]
match = compiled_pattern.match(title)
if not match:
msg = f"""Could not find PDEP number in '{title}'. Please make sure to
write the title as: 'PDEP-num: {title}'."""
raise ValueError(msg)

return int(match[1])

for pdep in sorted(pdeps["items"], key=sort_pdep):
context["pdeps"]["Under discussion"].append(
{"title": pdep["title"], "url": pdep["html_url"]}
)
Expand Down