You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PLR2004 does not care if magic value in comparison is a major version number against sys.implementation.version #25588
When reporting astral-sh/ty#3640, I noticed ruff emitted PLR2004 when I checked sys.implementation.version[0] against a number like 3. It would be unreasonable to require assigning 3 to a name such as PY3 before using it. The YTT rules do not concern this usage, so I think it is just PLR2004 that may need to be changed.
I can certainly see your point, but I'm not sure we should start adding exceptions like this to the rule. I think it's fine to use a noqa here or add 3 to the configuration option once #18961 lands.
Activity
ntBre commentedon Jun 3, 2026
I can certainly see your point, but I'm not sure we should start adding exceptions like this to the rule. I think it's fine to use a
noqahere or add 3 to the configuration option once #18961 lands.MichaReiser commentedon Jun 3, 2026
Ruff has the same issue with
sys.version. I'd be fine adding an exception forsys.versionand maybesys.implementation.version, if it's not too hardjonathandung commentedon Jun 3, 2026
The allow_magic_values config option seems promising.
[`pylint`] Exempt Python version comparisons (`PLR2004`) (#25743)