Skip to content

Use towncrier for changelog generation #6974

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

Merged
merged 8 commits into from
Jul 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Thank you for submitting a PR to pylint!
To ease the process of reviewing your PR, do make sure to complete the following boxes.

- [ ] Write a good description on what the PR does.
- [ ] Add an entry to the change log describing the change in
`doc/whatsnew/2/2.15/index.rst` (or ``doc/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.
- [ ] Create a news fragment with `towncrier create <IssueNumber>.<type>` which will be
included in the changelog. `<type>` can be one of: new_check, removed_check, extension,
false_positive, false_negative, bugfix, other, internal. If necessary you can write
details or offer examples on how the new change is supposed to work.
- [ ] If you used multiple emails or multiple names when contributing, add your mails
and preferred name in ``script/.contributors_aliases.json``
-->
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: changelog

on:
pull_request:
types: [opened, synchronize, labeled, unlabeled, reopened]

env:
# Also change CACHE_VERSION in the other workflows
CACHE_VERSION: 20
DEFAULT_PYTHON: "3.10"

jobs:
check-changelog:
if: contains(github.event.pull_request.labels.*.name, 'skip news :mute:') != true
name: Changelog Entry Check
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out code from GitHub
uses: actions/[email protected]
with:
# `towncrier check` runs `git diff --name-only origin/main...`, which
# needs a non-shallow clone.
fetch-depth: 0
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/[email protected]
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Generate partial Python venv restore key
id: generate-python-key
run: >-
echo "::set-output name=key::base-venv-${{ env.CACHE_VERSION }}-${{
hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt')
}}"
- name: Restore Python virtual environment
id: cache-venv
uses: actions/[email protected]
with:
path: venv
key: >-
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
steps.generate-python-key.outputs.key }}
restore-keys: |
${{ runner.os }}-${{ steps.python.outputs.python-version }}-base-venv-${{ env.CACHE_VERSION }}-
- name: Create Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
python -m venv venv
. venv/bin/activate
python -m pip install -U pip setuptools wheel
pip install -U -r requirements_test.txt
pip install -U -r doc/requirements.txt
- name: Emit warning if news fragment is missing
env:
BASE_BRANCH: ${{ github.base_ref }}
run: |
# Fetch the pull request' base branch so towncrier will be able to
# compare the current branch with the base branch.
git fetch --no-tags origin +refs/heads/${BASE_BRANCH}:refs/remotes/origin/${BASE_BRANCH}
. venv/bin/activate
towncrier check --compare-with origin/${{ github.base_ref }}
2 changes: 1 addition & 1 deletion .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
pull_request: ~

env:
CACHE_VERSION: 1
CACHE_VERSION: 20
DEFAULT_PYTHON: "3.10"
PRE_COMMIT_CACHE: ~/.cache/pre-commit

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/primer-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- ".github/workflows/primer-test.yaml"

env:
CACHE_VERSION: 1
CACHE_VERSION: 20

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/primer_comment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- completed

env:
CACHE_VERSION: 1
CACHE_VERSION: 20

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/primer_run_main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:
cancel-in-progress: true

env:
CACHE_VERSION: 1
CACHE_VERSION: 20

jobs:
run-primer:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/primer_run_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ concurrency:
cancel-in-progress: true

env:
CACHE_VERSION: 1
CACHE_VERSION: 20

jobs:
run-primer:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- doc/data/messages/**

env:
CACHE_VERSION: 1
CACHE_VERSION: 20

jobs:
tests-linux:
Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ repos:
language: system
types: [text]
files: ^(doc/whatsnew/\d+\.\d+\.rst)
- id: check-newsfragments
name: Check newsfragments
entry: python3 -m script.check_newsfragments
language: system
types: [text]
files: ^(doc/whatsnew/fragments)
exclude: doc/whatsnew/fragments/_.*.rst
- repo: https://github.com/rstcheck/rstcheck
rev: "v6.0.0.post1"
hooks:
Expand Down
2 changes: 2 additions & 0 deletions .pyenchant_pylint_custom_dict.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ mymodule
mypy
namedtuple
namespace
newsfile
newstyle
nl
nodename
Expand Down Expand Up @@ -320,6 +321,7 @@ tokenizer
toml
tomlkit
toplevel
towncrier
tp
truthness
tryexcept
Expand Down
3 changes: 3 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ build:
os: ubuntu-20.04
tools:
python: "3.8"
jobs:
pre_build:
- towncrier build --yes --date TBA
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ["_build", "data/**"]
exclude_patterns = ["_build", "data/**", "whatsnew/fragments"]

# The reST default role (used for this markup: `text`) to use for all documents.
# default_role = None
Expand Down
12 changes: 9 additions & 3 deletions doc/development_guide/contributor_guide/contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ your patch gets accepted:

- We recommend using Python 3.8 or higher for development of Pylint as it gives
you access to the latest ``ast`` parser.

- Install the dev dependencies, see :ref:`contributor_install`.

- Use our test suite and write new tests, see :ref:`contributor_testing`.
- Add an entry to the change log describing the change in `doc/whatsnew/2/2.15/index.rst`
(or ``doc/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.

.. keep this in sync with the description of PULL_REQUEST_TEMPLATE.md!

- Create a news fragment with `towncrier create <IssueNumber>.<type>` which will be
included in the changelog. `<type>` can be one of: new_check, removed_check, extension,
false_positive, false_negative, bugfix, other, internal. If necessary you can write
details or offer examples on how the new change is supposed to work.

- Document your change, if it is a non-trivial one.

Expand Down
1 change: 1 addition & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Sphinx==5.0.2
sphinx-reredirects<1
myst-parser~=0.18
towncrier~=21.9
furo==2022.6.21
-e .
91 changes: 1 addition & 90 deletions doc/whatsnew/2/2.15/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,93 +14,4 @@ Summary -- Release highlights
* We improved ``pylint``'s handling of namespace packages. More packages should be
linted without resorting to using the ``-recursive=y`` option.


New checkers
============

Added new checker ``missing-timeout`` to warn of default timeout values that could cause
a program to be hanging indefinitely.


Removed checkers
================


Extensions
==========


False positives fixed
=====================

* Don't report ``unsupported-binary-operation`` on Python <= 3.9 when using the ``|`` operator
with types, if one has a metaclass that overloads ``__or__`` or ``__ror__`` as appropriate.

Closes #4951

False negatives fixed
=====================

* Emit ``modified-iterating-list`` and analogous messages for dicts and sets when iterating
literals, or when using the ``del`` keyword.

Closes #6648

* Emit ``using-constant-test`` when testing the truth value of a variable or call result
holding a generator.

Closes #6909

* Emit ``used-before-assignment`` for self-referencing named expressions (``:=``) lacking
prior assignments.

Closes #5653

* Emit ``used-before-assignment`` when calling nested functions before assignment.

Closes #6812

* Emit ``used-before-assignment`` when relying on a name that is reimported later in a function.

Closes #4624

* Emit ``used-before-assignment`` for self-referencing assignments under if conditions.

Closes #6643

* Emit ``nonlocal-without-binding`` when a nonlocal name has been assigned at a later point in the same scope.

Closes #6883

* Rename ``unhashable-dict-key`` to ``unhashable-member`` and emit when creating sets and dicts,
not just when accessing dicts.

Closes #7034, Closes #7055


Other bug fixes
===============


Other Changes
=============

* ``useless-super-delegation`` has been renamed to ``useless-parent-delegation`` in order to be more generic.

Closes #6953

* Update ``astroid`` to 2.12.


Internal changes
================

* ``pylint.testutils.primer`` is now a private API.

Refs #6905

* Fixed an issue where it was impossible to update functional tests output when the existing
output was impossible to parse. Instead of raising an error we raise a warning message and
let the functional test fail with a default value.

Refs #6891
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not check everything but we probably added entries here since we started the MR, we should do a last check before merging. (And also merge relatively fast to avoid this issue of course).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let me know when all review comments are resolved from your point of view and I'll check for completeness again!
Sorry that this topic is dragging itself a bit, I did not find that much time for this in the last few weeks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a humungous and very impactful ticket, thank you for designing it then implementing it 👍

.. towncrier release notes start
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/4624.false_negative
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Emit ``used-before-assignment`` when relying on a name that is reimported later in a function.

Closes #4624
4 changes: 4 additions & 0 deletions doc/whatsnew/fragments/4951.false_positive
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Don't report ``unsupported-binary-operation`` on Python <= 3.9 when using the ``|`` operator
with types, if one has a metaclass that overloads ``__or__`` or ``__ror__`` as appropriate.

Closes #4951
4 changes: 4 additions & 0 deletions doc/whatsnew/fragments/5653.false_negative
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Emit ``used-before-assignment`` for self-referencing named expressions (``:=``) lacking
prior assignments.

Closes #5653
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/6643.false_negative
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Emit ``used-before-assignment`` for self-referencing assignments under if conditions.

Closes #6643
4 changes: 4 additions & 0 deletions doc/whatsnew/fragments/6648.false_negative
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Emit ``modified-iterating-list`` and analogous messages for dicts and sets when iterating
literals, or when using the ``del`` keyword.

Closes #6648
4 changes: 4 additions & 0 deletions doc/whatsnew/fragments/6780.new_check
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Added new checker ``missing-timeout`` to warn of default timeout values that could cause
a program to be hanging indefinitely.

Refs #6780
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/6812.false_negative
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Emit ``used-before-assignment`` when calling nested functions before assignment.

Closes #6812
4 changes: 4 additions & 0 deletions doc/whatsnew/fragments/6883.false_negative
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

Emit ``nonlocal-without-binding`` when a nonlocal name has been assigned at a later point in the same scope.

Closes #6883
5 changes: 5 additions & 0 deletions doc/whatsnew/fragments/6891.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Fixed an issue where it was impossible to update functional tests output when the existing
output was impossible to parse. Instead of raising an error we raise a warning message and
let the functional test fail with a default value.

Refs #6891
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/6905.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
``pylint.testutils.primer`` is now a private API.

Refs #6905
4 changes: 4 additions & 0 deletions doc/whatsnew/fragments/6909.false_negative
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Emit ``using-constant-test`` when testing the truth value of a variable or call result
holding a generator.

Closes #6909
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/6953.other
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
``useless-super-delegation`` has been renamed to ``useless-parent-delegation`` in order to be more generic.

Closes #6953
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/6974.other
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Pylint now uses ``towncrier`` for changelog generation.

Refs #6974
5 changes: 5 additions & 0 deletions doc/whatsnew/fragments/7034.false_negative
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

Rename ``unhashable-dict-key`` to ``unhashable-member`` and emit when creating sets and dicts,
not just when accessing dicts.

Closes #7034, Closes #7055
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/7153.other
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Update ``astroid`` to 2.12.

Refs #7153
Loading