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.
Reasons for making this change
Aligns with Python style guidance
PEP 8 explicitly advises avoiding trailing whitespace, noting that trailing whitespace is visually indistinguishable and can be confusing, especially when editors or tools auto-trim it.
PEP 8
Matches common linting rules and CI expectations
Popular Python linters and style tools such as pycodestyle/Flake8 (W291) and Ruff flag trailing whitespace as a violation, and many projects treat these warnings as errors in CI. Removing trailing whitespace from Python.gitignore aligns the template with those widely adopted rules.
Reduces noisy diffs caused by modern editors
Editors like Visual Studio Code support files.trimTrailingWhitespace, which trims whitespace on save. When users enable this (often the default recommendation), the current Python.gitignore template results in unintended changes and noisy diffs as soon as the file is saved. Removing trailing whitespace avoids these spurious diffs and makes using the official template smoother.
Links to documentation supporting these rule changes
Flake8 / pycodestyle rule W291: “There should be no whitespace after the final character in a line.”
flake8rules.com
Ruff rule trailing-whitespace (W291), which directly cites PEP 8’s recommendation to avoid trailing whitespace.
Astral Docs
These references together justify removing trailing whitespace as consistent with Python style, tooling, and typical editor behaviour.
Merge and Approval Steps