MCPcopy
hub / github.com/github/spec-kit / get_speckit_version

Function get_speckit_version

src/specify_cli/_assets.py:104–121  ·  view source on GitHub ↗

Get current spec-kit version.

()

Source from the content-addressed store, hash-verified

102
103
104def get_speckit_version() -> str:
105 """Get current spec-kit version."""
106 try:
107 return importlib.metadata.version("specify-cli")
108 except Exception:
109 # Fallback: try reading from pyproject.toml
110 try:
111 import tomllib
112 pyproject_path = _repo_root() / "pyproject.toml"
113 if pyproject_path.exists():
114 with open(pyproject_path, "rb") as f:
115 data = tomllib.load(f)
116 return data.get("project", {}).get("version", "unknown")
117 except Exception:
118 # Intentionally ignore any errors while reading/parsing pyproject.toml.
119 # If this lookup fails for any reason, we fall back to returning "unknown" below.
120 pass
121 return "unknown"

Callers 12

_version_callbackFunction · 0.85
_install_shared_infraFunction · 0.85
versionFunction · 0.85
preset_addFunction · 0.85
initFunction · 0.85
_speckit_versionFunction · 0.85
extension_addFunction · 0.85
extension_updateFunction · 0.85
installMethod · 0.85
installMethod · 0.85

Calls 4

_repo_rootFunction · 0.70
versionMethod · 0.45
loadMethod · 0.45
getMethod · 0.45

Tested by 1