MCPcopy Create free account
hub / github.com/NanGePlus/LightRAGTest / retrieve_metadata

Function retrieve_metadata

LightRAG/setup.py:14–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12
13# Retrieving metadata from __init__.py
14def retrieve_metadata():
15 vars2find = ["__author__", "__version__", "__url__"]
16 vars2readme = {}
17 try:
18 with open("./lightrag/__init__.py") as f:
19 for line in f.readlines():
20 for v in vars2find:
21 if line.startswith(v):
22 line = (
23 line.replace(" ", "")
24 .replace('"', "")
25 .replace("'", "")
26 .strip()
27 )
28 vars2readme[v] = line.split("=")[1]
29 except FileNotFoundError:
30 raise FileNotFoundError("Metadata file './lightrag/__init__.py' not found.")
31
32 # Checking if all required variables are found
33 missing_vars = [v for v in vars2find if v not in vars2readme]
34 if missing_vars:
35 raise ValueError(
36 f"Missing required metadata variables in __init__.py: {missing_vars}"
37 )
38
39 return vars2readme
40
41
42# Reading dependencies from requirements.txt

Callers 1

setup.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected