From 60bd4b461b9050dc37903c3aed67dc123e64b645 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Fri, 10 Jul 2026 19:06:32 +0200 Subject: [PATCH 1/2] cmds.projects.CmdCreateFile: Add self to extra_paths pyrightconfig.json as generated by CmdCreateFile, doesn't contain the repository's own Python source location in "extra_paths", fix that. Signed-off-by: Jan Lindemann --- src/python/jw/pkg/cmds/projects/CmdCreateFile.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/python/jw/pkg/cmds/projects/CmdCreateFile.py b/src/python/jw/pkg/cmds/projects/CmdCreateFile.py index ce714b62..e57c37e2 100644 --- a/src/python/jw/pkg/cmds/projects/CmdCreateFile.py +++ b/src/python/jw/pkg/cmds/projects/CmdCreateFile.py @@ -19,12 +19,17 @@ class Fmt(Enum): class CmdCreateFile(Cmd): # export - def __jw_required(self, module: str | None = None) -> list[str]: + def __jw_required( + self, + *, + module: str | None = None, + include_self: bool = False, + ) -> list[str]: if module is None: module = self.app.args.module if module is None: raise Exception('Can\'t get required packages without module name') - return pkg_relations( + ret = pkg_relations( self.app, rel_type = 'requires', flavours = ['run'], @@ -37,6 +42,9 @@ class CmdCreateFile(Cmd): # export hide_self = False, hide_jw_pkg = False, ) + if include_self and module not in ret: + ret = [module, *ret] + return ret def __render( self, @@ -65,7 +73,7 @@ class CmdCreateFile(Cmd): # export def render_pyright(self, module: str, extra_fields: RenderValues) -> str: extra_paths = [] - for m in self.__jw_required(): + for m in self.__jw_required(include_self = True): 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}"') -- 2.55.0 From 11ccaef832f7e0143cdedc0ae569258a8feb4168 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Thu, 9 Jul 2026 09:21:36 +0200 Subject: [PATCH 2/2] cmds.projects.CmdPythonpath: Reverse PYTHONPATH CmdPythonpath, AKA pythonpath, prints a PYTHONPATH which runs from root first to dependency leaves last. This works now but doesn't give local overrides the advantage it should. Fix that. Signed-off-by: Jan Lindemann --- src/python/jw/pkg/cmds/projects/CmdPythonpath.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/jw/pkg/cmds/projects/CmdPythonpath.py b/src/python/jw/pkg/cmds/projects/CmdPythonpath.py index 1b02a83b..b7012c05 100644 --- a/src/python/jw/pkg/cmds/projects/CmdPythonpath.py +++ b/src/python/jw/pkg/cmds/projects/CmdPythonpath.py @@ -55,4 +55,4 @@ class CmdPythonpath(Cmd): # export path = f'{args.path_component_prefix}{path}' out.append(path) if out: - print(args.delimiter.join(out)) + print(args.delimiter.join(reversed(out))) -- 2.55.0