INNER CODE UNIT · Python
packages_to_exclude
huggingface/large_language_model_training_playbook · debug/NicerTrace.py:50
packages_to_exclude = set(packages) - set(packages_to_include)
dirs_to_exclude = [
f"{self.site_packages_dir}/{dir}" for dir in sorted(packages_to_exclude) if not dir.endswith("-info")
]
# note, no way to exclude python core packages in this situation because
# sysconfig.get_paths()'s' purelib is a subset of stdlib :(, so excluding only site-packages
kwargs["ignoredirs"] = dirs_to_exclude
# not packages, but final module names like Image from Image.py
# mods_to_exclude = []
# print("\n".join(kwargs["ignoredirs"]))
super().__init__(*args, **kwargs)
self.log_pids = log_pids
def strip_py_dirs(self, path):
"""strips python path prefix like /.../site-packages, and /.../lib/python3.8 if any matches"""