PyCQA / PyCQA/pycodestyle

Check if dunder variables are defined *after* imports

Open
#615 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.2k
Forks
754
PR merge metrics
No merged PRs in 30d

Description

PEP 8 mandates that dunder variables be specified after docstring and __future__ imports but before other imports (or other code). With #613, the old check was relaxed not to complain in the case that PEP 8 endorses, but pycodestyle should additionally complain if this is exactly not the case.

(via https://github.com/PyCQA/pycodestyle/pull/523)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pycodestyle’s single Python file by locating the existing dunder-variable/import check changed by #613. Review how the current check handles module-level dunder names, then verify behavior against the PEP 8 ordering described here. Done means the checker reports dunder variables placed after ordinary imports or other code while preserving the endorsed ordering.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.