Skip to content

Conversation

@njlester
Copy link

@njlester njlester commented Dec 11, 2025

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

  • Confirm that you've read the contribution guidelines and ensured your PR aligns
  • Ensure CI is passing
  • Get a review and Approval from one of the maintainers

@njlester njlester marked this pull request as ready for review December 11, 2025 02:43
@njlester njlester requested a review from a team as a code owner December 11, 2025 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant