MCPcopy
hub / github.com/NVIDIA/TensorRT-LLM / get_project_info

Function get_project_info

scripts/generate_lock_file.py:58–81  ·  view source on GitHub ↗
(path: str)

Source from the content-addressed store, hash-verified

56
57
58def get_project_info(path: str):
59 path_project = re.sub(rf"^{os.getcwd()}\/?", "", path)
60 name = "unknown-package"
61 version = "0.1.0"
62 if not path_project:
63 name = "tensorrt-llm"
64 import importlib.util
65
66 # get trtllm version from tensorrt_llm/version.py
67 module_path = os.path.join("tensorrt_llm", "version.py")
68 spec = importlib.util.spec_from_file_location("trtllm_version",
69 module_path)
70 if spec and spec.loader:
71 version_module = importlib.util.module_from_spec(spec)
72 spec.loader.exec_module(version_module)
73 version = version_module.__version__
74 else:
75 matches = re.match(r"^(?:([\w\-]+)?\/)?([\w\-]+)$", path_project)
76 if matches:
77 if matches.group(1):
78 name = f"{matches.group(2)}-{matches.group(1)}"
79 else:
80 name = matches.group(2)
81 return {"name": name, "version": version}
82
83
84def generate_metadata_json():

Callers 1

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected