MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _version_from_pyproject

Function _version_from_pyproject

uncommon_route/version.py:10–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8
9
10def _version_from_pyproject() -> str | None:
11 pyproject_path = Path(__file__).resolve().parents[1] / "pyproject.toml"
12 if not pyproject_path.exists():
13 return None
14 try:
15 with pyproject_path.open("rb") as file:
16 payload = tomllib.load(file)
17 except (OSError, tomllib.TOMLDecodeError):
18 return None
19
20 project = payload.get("project")
21 if not isinstance(project, dict):
22 return None
23 raw_version = project.get("version")
24 if not isinstance(raw_version, str):
25 return None
26 version = raw_version.strip()
27 return version or None
28
29
30def get_version() -> str:

Callers 1

get_versionFunction · 0.85

Calls 3

resolveMethod · 0.45
loadMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected