From c0c9148281827320236b04e05419e1b5b60aa3bb Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Fri, 5 Jun 2026 15:02:56 +0200 Subject: [PATCH] cmds.projects.CmdCreateFile: Add subdirs src/python In order to allow Pyright to check the types provided by dependant repositories without installing them, pyrightconfig.json contains a list of paths to their root directories in "extraPaths". These paths are unusable for Pyright, though: For type checking to work, it needs to be pointed to the "jw" namespace package paths within those repos. This commit achieves that by appending the subdirs src/python and tools/python to them, provided they exist. TODO: This fix hardcodes the current project directory structure. Better would be a way to customize that via makefiles, where the paths can be more easily customized. Signed-off-by: Jan Lindemann --- src/python/jw/pkg/cmds/projects/CmdCreateFile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/jw/pkg/cmds/projects/CmdCreateFile.py b/src/python/jw/pkg/cmds/projects/CmdCreateFile.py index 16a0f305..b59576fd 100644 --- a/src/python/jw/pkg/cmds/projects/CmdCreateFile.py +++ b/src/python/jw/pkg/cmds/projects/CmdCreateFile.py @@ -54,7 +54,7 @@ class CmdCreateFile(Cmd): # export extra_paths = [] for m in prereq: - path = self.app.find_dir(m) + path = self.app.find_dir(m, search_subdirs = ['src/python', 'tools/python']) if path is None: log(WARNING, f'No project directory for module "{m}"') continue