From b479662201b14135723515d4ae501951c1fe4a2d Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Fri, 4 Sep 2026 11:33:10 +0200 Subject: [PATCH] pyproject.toml: Make ruff aware of MicroPython builtins. This commit updates the project-wide configuration for `ruff`, in order to not let it flag usages of MicroPython-specific types and keywords when performing code checks. The tool currently has an exceptions list that covers almost all Python code that ships with MicroPython, however code placed in `ports//modules` (or elsewhere) by users for customisation purposes will end up raising errors for otherwise valid MicroPython-flavoured code. Changes only let `ruff` assume that it knows about the existence of the `micropython` module (used without an initial import) for decorators (eg. `native`, `viper`, `asm_...`, etc.), Viper pointer types (`ptr`, `ptr8`, `ptr16`, `ptr32`), the unsigned integer return type (`uint`), the `const` constructor, and the `execfile` builtin. For code that is placed elsewhere, these rules won't apply, so it might be an option to add further configuration instructions in the "getting started" documentation files. Signed-off-by: Alessandro Gatti --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 736fd3a62..68dd2815d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,7 @@ extend-exclude = [ ] line-length = 99 target-version = "py38" # enable use of walrus operator +builtins = ["ptr", "ptr8", "ptr16", "ptr32", "uint", "micropython", "const", "execfile"] [tool.ruff.lint] select = [