def to_requirements(self): r = Requirements() for mod in self._modules: if is_installable_module(mod): r.add(get_module_as_requirement(get_base_module(mod))) elif is_local_module(mod): r.add(CustomRequirement.from_module(mod)) return r
def to_requirements(self): r = Requirements() for mod in list(sys.modules.values()): if not self._should_ignore(mod) and is_local_module(mod): r.add(CustomRequirement.from_module(mod)) # add imports of this local module for obj in mod.__dict__.values(): self._add_requirement(obj) for mod in self._modules: r.add(get_module_as_requirement(get_base_module(mod))) return r