Adding include_prereleases flag and ignoring draft releases - #14
Open
djpugh wants to merge 1 commit into
Open
Conversation
|
djpugh
added a commit
that referenced
this pull request
Aug 5, 2026
* fix: support ghapi 2.x and skip draft releases Two independent faults, both of which fail the whole docs build. ghapi 2.0 made operation calls asynchronous by default, so `paged(...)` yields an async generator and iterating it raises "'async_generator' object is not iterable". The same release added a `sync` flag selecting a synchronous transport; `_make_api` sets it when the installed signature declares it, so ghapi 1.x is unaffected. Draft releases were not filtered. A draft is unpublished, so GitHub returns no `published_at` -- ghapi surfaces that as an empty AttrDict, which reached `datetime.fromisoformat` and raised "argument must be str". Drafts also have an empty name, so they could only ever render as a broken, dateless entry. They are now skipped, and a published release somehow lacking a timestamp is warned about and skipped rather than failing the build. The date coercion now branches on the value's type rather than the Python version. The version check remains only for choosing how to parse a string, since fromisoformat cannot handle a trailing Z before 3.11. Verified end to end: nskit's docs build previously failed on both faults and now completes, rendering four releases with dates and excluding the draft. * feat: add include_prereleases option (supersedes #14) Folds in #14's prerelease flag, with three corrections. The filter reads `release.prerelease`. #14 spelt it `prelease`, and since a missing key on ghapi's AttrDict is falsy, the flag would have silently never filtered anything while appearing to work. The option is wired through. #14 added it to PluginConfig and to get_releases_as_markdown, but extension.py plucks each option individually and was not updated, so the config never reached the call. Naming is consistent: `include_prereleases` everywhere, rather than a plural config key against a singular function parameter. Drafts remain excluded regardless of the flag, since they are unpublished and carry no timestamp. The shared test fixtures now set `prerelease` explicitly, for the same reason the existing comment gives for `draft`: a bare MagicMock returns a truthy mock for any unset attribute, so an unset flag silently empties the result. One test drives the filter through an AttrDict so a misspelt attribute raises instead of quietly passing -- which is what let #14's typo through. * fix: use sync_paged on ghapi 2.x paged() is an async generator on 2.x even with sync=True, so iterating it raised "async_generator object is not iterable". * test: match mkdocs fail-fast config validation Config._validate breaks on the first error, so only one is ever reported; each option is now checked individually instead. * ci: audit with pip-audit instead of pipenv check pipenv check delegates to safety, which prompts to install itself and needs an API key, so it fails with EOFError on CI. Also add lxml, which mypy needs for its cobertura report. * test: set draft/prerelease on functional release mocks An unset MagicMock attribute is truthy, so every mocked release looked like a draft prerelease and was filtered out of the built changelog. * test: drop webbrowser.open from functional tests Launching a browser held the temp file open, so cleanup failed on Windows with WinError 32. * ci: unbreak 3.8/3.9 test jobs and the licence scan argcomplete 3.7.1 does not import on 3.8/3.9, so nox never started. pip 26.2 dropped an internal pip-tools relies on, so use uv to compile.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Pull request type
Please check the type of change your PR introduces:
Have you updated the appropriate files
Please check that you have (if appropriate):
README.mdpre-commit run --all-fileswith no errorsWhat is the current behavior?
Issue: #13
What is the new behavior?
Other information