-
-
Notifications
You must be signed in to change notification settings - Fork 624
Normalize the changelog style and introduce sphinx extlink roles #2202
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
Conversation
This changes the link format and does some regex-based rewriting of the changelog to try to normalize the format a bit. The conversion script was: ```python import re with open("CHANGELOG.md") as f: content = f.read() issue_link_pattern = re.compile( r"\[#(\d+)]\(https://github.com/jazzband/pip-tools/issues/(\d+)\)" ) pr_link_pattern = re.compile( r"\[#(\d+)]\(https://github.com/jazzband/pip-tools/pull/(\d+)\)" ) user_thanks_pattern = re.compile(r"Thanks(\s+)@([\w-]+)") user_ref_pattern = re.compile(r"(\s+)@([\w-]+)") date_pattern = re.compile( r"^(\d{2} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4})$", flags=re.MULTILINE, ) redent_user_thanks_pattern = re.compile(r"([^\s]) Thanks {user}") trim_newline_link_pattern = re.compile("\n\\s+(\\({(pr|issue)}`\\d+`\\)\\.?)\n") content = issue_link_pattern.sub(r"{issue}`\1`", content) content = pr_link_pattern.sub(r"{pr}`\1`", content) content = user_thanks_pattern.sub(r"Thanks {user}`\2`", content) content = user_ref_pattern.sub(r"\1{user}`\2`", content) content = redent_user_thanks_pattern.sub("\\1\n Thanks {user}", content) content = trim_newline_link_pattern.sub(" \\1\n", content) content = date_pattern.sub(r"*\1*", content) with open("NEW_CHANGELOG.md", "w") as f: f.write(content) ```
- put backticks around commands, flags, and command fragments (e.g., filenames) - fix PR and issue links not previously captured - normalize the "Thanks" line style -- no trailing period, no extra words
@sirosen could you integrate |
Yep, happily done! I like Looks like the linkcheck lint is bothered by routing through the sponsors redirects, but that should be easy to handle with |
Ah, I tried fixing the redirects and now I get rate limited by GitHub (which is fair!); I see other projects are just skipping validation of the GitHub links and I'll configure the same for us. |
Yeah, I've actually put sphinx-issues into the towncrier issue, but it's the last item in there 😂 |
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
These links are too numerous in the changelog and result in rate limiting when `linkcheck` is run. Also, several users have changed their usernames in the years since their contributions, so checking those links fails. (And although we could update old changelog items, it's not clear that we should.)
14c8c91
to
e072fb9
Compare
This is an early preparatory move for using towncrier.
Configuring it well (e.g., as in
cheroot
) will probably involve integrating these link styles into our templates, which we can only do if we have these link styles available.This change is broken into two commits.
The first is the addition of
sphinx.ext.extlinks
+ config + an automated rewrite of the changelog to normalize a lot ofstylistic elements and use
{issue}
style and similar.123
The second is a "manual fixup" (mostly done with editor commands and a bit of manual review) and is separated out to make the changes more visible in review.
The goal here is just to get some stylistic uniformity, especially for the really old changelog entries, so that editor highlighting won't be confused and we'll have a clearer claim to a consistent style.
In this phase, I'm more interested in having a consistent style than in exactly what that style is.
I can make small adjustments if anything is objectionable, but I'd rather save further rewrites (e.g., "should we replace those
Thanks $USER
lines with anAUTHORS
file?") for future discussion and debate.For review of how this renders, here's the result before and after on two different chunks of the changelog:
Contributor checklist
Included tests for the changes.N/AMaintainer checklist
backwards incompatible
,feature
,enhancement
,deprecation
,bug
,dependency
,docs
orskip-changelog
as they determine changelog listing.