python-flake8-builtins
Port variant v14
Summary Python builtins validation tool (3.14)
Package version 3.2.0
Homepage https://github.com/gforcada/flake8-builtins
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v15
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 13 NOV 2026, 13:25:52 UTC
Port created 05 MAR 2024, 06:30:48 UTC
Subpackage Descriptions
single # Flake8 Builtins plugin Check for python builtins being used as variables or parameters. Imagine some code like this: ```python def max_values(list, list2): max = list[0] for x in list: if x > 0: max = x all_values = list() all_values.append(max) max = list2[0] for x in list2: if x > 0: max = x all_values.append(max) return all_values max_values([3, 4, 5,], [5, 6, 7]) ``` The last statement is not returning `[5, 7]` as one would expect, instead is raising this exception:: ```python Traceback (most recent call last): File "test.py", line 17, in max_values([3,4,5], [4,5,6]) File "bla.py", line 6, in max_values all_values = list() TypeError: 'list' object is not callable ``` **Why?** Because `max_value` function's first argument is `list` a Python builtin. Python allows to override them, but although could be useful in some really specific use cases, the general approach is to **not** do that as code then can suddenly break without a clear trace. ## Example Given the following code: ```python def my_method(object, list, dict): max = 5 min = 3 zip = (4, 3) ``` The following warnings are shown (via flake8):: ```shell test.py:1:15: A002 argument "object" is shadowing a python builtin test.py:1:23: A002 argument "list" is shadowing a python builtin test.py:1:29: A002 argument "dict" is shadowing a python builtin test.py:2:5: A001 variable "max" is shadowing a python builtin test.py:3:5: A001 variable "min" is shadowing a python builtin test.py:4:5: A001 variable "zip" is shadowing a python builtin ``` ## Install Install with pip:: ```shell python -m pip install flake8-builtins ``` ## Options One can use `--builtins-ignorelist` option, or configuration option, to ignore a custom list of builtins:: ```shell flake8 --builtins-ignorelist id,copyright *.py ``` ## Requirements - Python 3.11, 3.12, 3.13, 3.14, 3.15 and pypy3 - flake8 ## Rules A001: A variable is shadowing a Python builtin. A002: An argument is shadowing a Python builtin. A003: A class attribute is shadowing a Python builtin.
Configuration Switches (platform-specific settings discarded)
PY314 ON Build using Python 3.14 PY315 OFF Build using Python 3.15
Package Dependencies by Type
Build (only) python314:dev:std
python-pip:single:v14
autoselect-python:single:std
Build and Runtime python314:primary:std
Runtime (only) python-flake8:single:v14
Download groups
main mirror://PYPIWHL/b6/02/c7614f54d3fde51b8a20d91e14b012a01c78c2a481d36b5e8e40535a3d0b
Distribution File Information
192a00630f183b8e7b881e98def18aa20124581dde3a3e7be7a01a6effe3504b 18757 python-src/flake8_builtins-3.2.0-py3-none-any.whl
Ports that require python-flake8-builtins:v14
No other ports depend on this one.