sopel-irc / sopel.chat

Website for Sopel
https://sopel.chat
Other
0 stars 11 forks source link

Independent generation of `latest.json` file #50

Closed dgw closed 4 months ago

dgw commented 5 months ago

The script loads the most recent releases from PyPI now, instead of being part of the changelog script (since the changelog won't necessarily include dev builds, prereleases, etc.). The unstable version is no longer just an alias to the current stable version if there is a newer prerelease.

Leans on packaging.version to do the heavy lifting (parsing version specifiers into sortable Version objects). Fortunately we already get packaging and requests for free when installing _sopel to document it and its plugins.

I expect the first PR build to fail. It's an old branch from before #48 and there are some things I need to fixup anyway.

dgw commented 5 months ago

Indeed, the first PR build did fail. But I have performed the fixups I needed to, rebased the branch, and now it works.

To illustrate the patch a bit better, here is the old latest.json as of

{
    "version": "8.0.0",
    "unstable": "8.0.0",
    "release_notes": "https://sopel.chat/changelog/8.0.0/"
}

And with this patch, that turns into:

{
    "version": "8.0.0",
    "unstable": "8.0.0",
    "release_notes": "https://sopel.chat/changelog/8.0.0/",
    "unstable_notes": "https://github.com/sopel-irc/sopel/releases/v8.0.0"
}

The unstable_notes item now exists, something the previous code didn't bother doing. It points to the relevant release tag on GitHub since prerelease versions don't appear in the NEWS file (and the site's /changelog/ section therefore won't have them).

dgw commented 4 months ago

One of the suggestions—the one to avoid break—ironically broke the control flow, but that should be fixed. I'll request a re-review now and head off into the hot STL evening for the night's Activities™. 🌆

The only downside to using json.dump() is that the output is now all one line (but I'm sure I can tweak that if I check the stdlib docs later):

{"version": "8.0.0", "unstable": "8.0.0", "release_notes": "https://sopel.chat/changelog/8.0.0/", "unstable_notes": "https://github.com/sopel-irc/sopel/releases/v8.0.0"}
SnoopJ commented 4 months ago

The only downside to using json.dump() is that the output is now all one line (but I'm sure I can tweak that if I check the stdlib docs later):

Passing indent will take care of that, I usually do indent=4 but any non-None value should work

dgw commented 4 months ago

Hmm, I did my pushes in the wrong order and confused the heck out of GitHub. All of the feedback here was folded into a squashed commit, 81876cf6812dffdf508720263f789d8212ac5ac6, and then merged to master via cf6d998a3d01a89d585bcb76c4a89df3314914e0, but I did the merge "locally" (in Gitpod) and pushed master first. GH thinks the PR has no content, instead of detecting that its HEAD was merged. Oops. ☹️

Thanks for the review @SnoopJ (and @Exirel, the silent partner on IRC)