-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
First draft for automatic generation of changelog entries #6875
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
@DudeNr33 This looks very promising! Before delving any deeper, have we considered using existing libraries such as It would require some changes in the way we store changelog entries from |
doc/exts/pylint_changelog.py
Outdated
def _parse_as_rst(self, text: str) -> nodes.document: | ||
parser = Parser() | ||
components = (Parser,) | ||
settings = frontend.OptionParser(components=components).get_default_values() | ||
document = new_document("<rst-doc>", settings=settings) | ||
parser.parse(text, document) | ||
return document |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Figuring out how to do this took hours and a bit of my sanity.
For a library with "doc" in its name, the documentation of docutils
is horrible. 😄 Not to mention the usability.
And to cite a YouTube video of a PyGotham talk:
"Sphinx is weird and crazy and old [...], and it sits on top of something that was old before the thing below it was old before Moses was old."
I "know"
|
Pull Request Test Coverage Report for Build 2490288774
💛 - Coveralls |
pylint_changelog_project = "pylint" | ||
pylint_changelog_token = os.getenv("GITHUB_TOKEN") | ||
pylint_changelog_exclude_labels = [ | ||
"Documentation 📖", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding this: I said in the original issue "If the PR is labelled maintenance, primer or documentation in github then nothing is required". But I also added 'skip news 🔇', because there's some condition to take into account imo. documentation alone should be skipped but what about documentation and bug together or primer and something else ... ? Maybe just one label with clear expectation is better ? We're doing a lot of maintenance/documentation issue that will need to have one more label if we do that though.
I'm thinking about "skip news" or (maintenance, primer or documentation) but only that label with no other, right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I too think that an explicit "skip news" label would be the cleanest way to go.
Same for the "Other changes" section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It must be possible to structure the generated changelog into different sections (not just for release versions, but for topics like false negative, false positive etc.).
+1. maybe using the label from the pull request ?
It must be possible to exclude the "old" versions from the generation (pylint <= 2.15.0), as this would only be waste.
👍
It should be possible to change the structure from one release to the other, without affecting the changelogs for already released versions.
👍 Separating the changlog for each minor version in particular
It must be possible to build the documentation including changelog through CI and readthedocs.
Ideally. But where would we take the changelog entry ? In the commit message ?
I think we also need to be able to create release notes for a patch version. Right now everything is mixed up in 2.15.0, but what will happen when we maintain it and want to release 2.15.1 ?
.. changelog::
:caption: False positives fixed
:query: is:closed is:pr milestone:2.15.0 label:"False Positive 🦟"
With the Sphinx extension from this PR this would be possible, and I think it should be the same for
Commit message is problematic imo, as it is inconvenient to fix if it was forgotten. I would prefer to put it in the description of the PR. We could add something like this in the PR template: --- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -23,6 +23,16 @@ To ease the process of reviewing your PR, do make sure to complete the following
| ✓ | :hammer: Refactoring |
| ✓ | :scroll: Docs |
+## Changelog
+
+<!--
+Provide a short summary of the change, focused on the user-facing aspects.
+This summary will be included in the changelog. Use reStrcturedText formatting.
+-->
+```rst
+ The extension can extract the relevant portion from the PR body using a regex.
That's easy, we would simply copy paste the whole block from 2.15.0 and replace all .. changelog::
:caption: False positives fixed
:query: is:closed is:pr milestone:2.15.1 label:"False Positive 🦟" |
Sounds great !
We're already handling markdown for
Neat. Something to keep in mind when modifying the bump script. |
Yes, it should be possible by using the |
…t changelog entry to display from issue body in markdown format.
…pylint into autogenerate-changelog
## Changelog | ||
|
||
<!-- | ||
Provide a short summary of the change, focused on the user-facing aspects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provide a short summary of the change, focused on the user-facing aspects. | |
Provide a short summary of the change, focused on the user-facing aspects. | |
If the change does not need to be documented ask a maintainer to add the | |
'skip news 🔇' label. |
… sure the PR body contains a changelog entry.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
pylint_changelog Sphinx extension vs. TowncrierTL;DRI noted down some more information regarding the comparison mainly to document it for myself, but I include it if someone wants to read it. Currently our documentation also includes the already merged PRs for the upcoming releases (like 2.15.0 and 2.14.2 at the moment). With Use Case ComparisonLet's consider the following aspects for comparison:
The steps for preparing the next release could probably be automated through the Regarding the handling of backmerges when using
The only difference to our current approach and also to my Pros and Cons
|
🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉 This comment was generated for commit 94bf3af |
Thanks for the extensive review @DudeNr33. Do you have a preference yourself? To me it seems that |
If we can live without "preview" release notes for upcoming patch releases, I would vote for Let's vote for it:
|
Thank you for the state of the art, very interesting !
It's a nice to have but it wasn't intended, we can live without.
Can't we use the milestone directly for this ? Or are we talking about 'skip-news 🔇' ? Wouldn't we need that for towncrier too ? |
The milestone alone is not enough if we want to distinguish sections like "New checkers", "False negatives fixed", etc. But |
It would definitely be nice to be able to choose the section using labels 👍 But towncrier do not need that if I understand correctly ? |
Exactly. |
doc/whatsnew/2/2.15/index.rst
(ordoc/whatsnew/2/2.14/full.rst
if the change needs backporting in 2.14). If necessary you can write
details or offer examples on how the new change is supposed to work.
and preferred name in
script/.contributors_aliases.json
Type of Changes
Changelog
The changelog is now automatically generated from the PR content.
This makes it easier for contributors as merge conflicts of the changelog file are now a thing of the past.
(edited 12.06. to see if the CI check correctly determines a changelog is included in the description)
Description
Refs #6688
This is a first draft for automatically generating the changelog using a custom Sphinx extension, which provides a new directive
.. changelog::
.I discarded the idea of using github-changelog-generator. While it produced good results on one of my own, small repos, I had some problems when running on pylint's repo.
The main idea is:
changelog
directive allows the user to generate a list of issues or pull requests matching the query passed in through the:query:
option.:caption:
option is used as title in the final document.:hide_if_empty:
the whole section will be skipped if no pull requests matching the query were found.conf.py
.This means that we have to apply the appropriate labels to each pull request. We will also have to come up with new labels for things like "new checker", "removed checker", etc.
I want to discuss some open issues and problems before moving forward:
Open issues:
Decision: TBD
Decision: TBD
# Changelog:
section in the PR template and extract this part from the PR body with a regular expression. A CI check could enforce that this section is not removed manually. PR title could still be used as a fallback to make the changelog generation more robust.Decision: TBD
There are also some problems that need to be adressed:
checks.yml
also tries to build the documentation. We can include a secret to store the token to make it accessible in GitHub actions for our main branch, but secrets are not accessible for PRs that originate from forks. Should we simply skip the changelog generation for PR runs?Decision: TBD
PyGithub
is viable. However, there are various other libraries I can take a look at.Decision: TBD
Descision: TBD
Let me know what you think, and if we want to move forward with this or stick to manual creation of the changelog entries!