MCPcopy Index your code
hub / github.com/tirth8205/code-review-graph / _get_version

Function _get_version

code_review_graph/cli.py:57–79  ·  view source on GitHub ↗

Get the installed package version. Tries ``importlib.metadata`` first (canonical source from the installed dist-info), falling back to the package's ``__version__`` attribute if metadata is unavailable or corrupt. This matters for editable installs on filesystems where iCloud / OneD

()

Source from the content-addressed store, hash-verified

55
56
57def _get_version() -> str:
58 """Get the installed package version.
59
60 Tries ``importlib.metadata`` first (canonical source from the installed
61 dist-info), falling back to the package's ``__version__`` attribute if
62 metadata is unavailable or corrupt. This matters for editable installs
63 on filesystems where iCloud / OneDrive can leave orphan dist-info dirs
64 behind that confuse importlib.metadata's lookup.
65 """
66 try:
67 v = pkg_version("code-review-graph")
68 if v:
69 return v
70 except PackageNotFoundError as exc:
71 logger.debug("Package metadata unavailable: %s", exc)
72 # Fallback: read __version__ directly from the package.
73 try:
74 from . import __version__ as fallback_version
75 if fallback_version:
76 return fallback_version
77 except ImportError:
78 pass
79 return "dev"
80
81
82def _supports_color() -> bool:

Callers 2

_print_bannerFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected