Open simonw opened 10 months ago
I can fall back on their releases dates from the PyPI packages table here: https://datasette.io/content/pypi_releases?_sort=md5_digest&package__startswith=datasette-sqlite-
I can fix this SQL view: https://datasette.io/content/plugins
CREATE VIEW plugins AS select
repos.name as name,
repos.full_name as full_name,
users.login as owner,
repos.description as description,
plugin_repos.extra_search as extra_search,
plugin_repos.tags as tags,
repos.stargazers_count,
pypi_versions.name as tag_name,
max(pypi_releases.upload_time) as latest_release_at,
repos.created_at as created_at,
datasette_repos.openGraphImageUrl,
datasette_repos.usesCustomOpenGraphImage,
(
select
sum(downloads)
from
stats
where
stats.package = repos.name
and stats.date > date('now', '-7 days')
) as downloads_this_week,
(
select
count(*)
from
plugin_repos
where
repo = repos.full_name
) as is_plugin,
(
select
count(*)
from
tool_repos
where
repo = repos.full_name
) as is_tool
from
datasette_repos
join repos on datasette_repos.id = repos.node_id
left join pypi_releases on pypi_releases.package = repos.name
left join pypi_versions on pypi_releases.version = pypi_versions.id
join users on users.id = repos.owner
join plugin_repos on plugin_repos.repo = datasette_repos.nameWithOwner
group by
repos.id
order by
latest_release_at desc;
Huh... max(pypi_releases.upload_time) as latest_release_at,
- it's using the pypi_releases
table already.
Here's the problem:
left join pypi_releases on pypi_releases.package = repos.name
This fails because in the case of Alex's datasette-sqlite-lines
plugin lives in a repo called sqlite-lines
.
Yeah, the problem is that the datasette_repos
table at https://datasette.io/content/datasette_repos/R_kgDOHPAsug has rows like:
But the package name doesn't match that repo name.
... and the repo name is the thing used in this YAML file: https://github.com/simonw/datasette.io/blob/99430d79e0179fdf2ea510b6afcce1179fd196da/plugin_repos.yml#L355-L384
Two possible solutions:
.yml
file to use (or at least include) the package name.'datasette-' || package_name
as well.I'm going to try that nasty hack first.
from
datasette_repos
join repos on datasette_repos.id = repos.node_id
left join pypi_releases on (
pypi_releases.package = repos.name or pypi_releases.package = 'datasette-' || repos.name
)
left join pypi_versions on pypi_releases.version = pypi_versions.id
join users on users.id = repos.owner
join plugin_repos on plugin_repos.repo = datasette_repos.nameWithOwner
Currently: https://datasette.io/plugins sorts by "most recent release" by default, which means that plugins that don't use GitHub releases show up at the bottom of the page: