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 <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-06-05 15:02:56 +02:00
commit c0c9148281
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -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