Return plugins and hooks in predictable order

This commit is contained in:
Simon Willison 2022-01-19 21:14:04 -08:00
commit e1770766ce
3 changed files with 23 additions and 24 deletions

View file

@ -764,13 +764,14 @@ class Datasette:
should_show_all = all
if not should_show_all:
ps = [p for p in ps if p["name"] not in DEFAULT_PLUGINS]
ps.sort(key=lambda p: p["name"])
return [
{
"name": p["name"],
"static": p["static_path"] is not None,
"templates": p["templates_path"] is not None,
"version": p.get("version"),
"hooks": list(set(p["hooks"])),
"hooks": list(sorted(set(p["hooks"]))),
}
for p in ps
]