From ffedb219d56bbdefb9fbe3becb5b841f99bfab8c Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Thu, 9 Apr 2020 12:21:37 +0300 Subject: [PATCH] Local modules (except trains) imported from a folder inside the git project should not be logged as "local packages", they should be ignored --- trains/utilities/pigar/__main__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/trains/utilities/pigar/__main__.py b/trains/utilities/pigar/__main__.py index edc6230f..319d05f6 100644 --- a/trains/utilities/pigar/__main__.py +++ b/trains/utilities/pigar/__main__.py @@ -38,9 +38,9 @@ class GenerateReqs(object): candidates = self._filter_modules(modules, local_mods) # make sure we are in candidates - ourselves = self.__module__.split('.') if self.__module__ else None - if ourselves and ourselves[0] not in candidates: - candidates.add(ourselves[0]) + ourselves = self.__module__.split('.')[0]if self.__module__ else None + if ourselves and ourselves not in candidates: + candidates.add(ourselves) logger.info('Check module in local environment.') for name in candidates: @@ -54,6 +54,11 @@ class GenerateReqs(object): # add local modules, so we know what is used but not installed. for name in self._local_mods: if name in modules: + if ourselves and name == ourselves: + from ...version import __version__ + reqs.add(name, __version__, modules[name]) + continue + # if this is a folder of our project, we can safely ignore it if os.path.commonpath([os.path.realpath(self._project_path)]) == \ os.path.commonpath([os.path.realpath(self._project_path),