From af8113686196dcd44980b14262c99be480ca88bc Mon Sep 17 00:00:00 2001 From: Krzysztof Rudnicki Date: Mon, 3 Aug 2026 16:38:20 +0200 Subject: [PATCH] Give pylint the repo root, so a script outside the package lints on its own pylint infers sys.path from the files it is handed, so a file in scripts/ resolves its package imports only when a package file happens to be in the same batch -- passing or failing by what else was staged. Sibling repos hit exactly that in CI today. An init-hook puts the repo root on the path unconditionally. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01BsXnTHyuuCUZsqetTaajcF --- pyproject.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 42f1d44..e4d7e2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,6 +91,12 @@ color_output = true exclude = [".venv/"] [tool.pylint.main] +# The repo root on the path, so a file outside the package (scripts/) can be +# linted on its own. pylint otherwise infers the path from the files it is +# given, so a script resolved its package imports only when a package file +# happened to be in the same batch -- passing or failing by what else was +# staged. +init-hook = "import sys; sys.path.insert(0, '.')" analyse-fallback-blocks = true persistent = true jobs = 0