MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _get_version

Function _get_version

lib/matplotlib/__init__.py:213–236  ·  view source on GitHub ↗

Return the version string used for __version__.

()

Source from the content-addressed store, hash-verified

211
212
213def _get_version():
214 """Return the version string used for __version__."""
215 # Only shell out to a git subprocess if really needed, i.e. when we are in
216 # a matplotlib git repo but not in a shallow clone, such as those used by
217 # CI, as the latter would trigger a warning from setuptools_scm.
218 root = Path(__file__).resolve().parents[2]
219 if ((root / ".matplotlib-repo").exists()
220 and (root / ".git").exists()
221 and not (root / ".git/shallow").exists()):
222 try:
223 import setuptools_scm
224 except ImportError:
225 pass
226 else:
227 return setuptools_scm.get_version(
228 root=root,
229 dist_name="matplotlib",
230 version_scheme="release-branch-semver",
231 local_scheme="node-and-date",
232 fallback_version=_version.version,
233 )
234 # Get the version from the _version.py file if not in repo or setuptools_scm is
235 # unavailable.
236 return _version.version
237
238
239@_api.caching_module_getattr

Callers 1

__getattr__Class · 0.85

Calls 2

PathClass · 0.85
resolveMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…