MCPcopy Create free account
hub / github.com/dask/dask / get_versions

Function get_versions

dask/dataframe/dask_expr/_version.py:669–718  ·  view source on GitHub ↗

Get version information or return default if unable to do so.

()

Source from the content-addressed store, hash-verified

667
668
669def get_versions() -> dict[str, Any]:
670 """Get version information or return default if unable to do so."""
671 # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have
672 # __file__, we can work backwards from there to the root. Some
673 # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which
674 # case we can only use expanded keywords.
675
676 cfg = get_config()
677 verbose = cfg.verbose
678
679 try:
680 return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, verbose)
681 except NotThisMethod:
682 pass
683
684 try:
685 root = os.path.realpath(__file__)
686 # versionfile_source is the relative path from the top of the source
687 # tree (where the .git directory might live) to this file. Invert
688 # this to find the root from __file__.
689 for _ in cfg.versionfile_source.split("/"):
690 root = os.path.dirname(root)
691 except NameError:
692 return {
693 "version": "0+unknown",
694 "full-revisionid": None,
695 "dirty": None,
696 "error": "unable to find root of source tree",
697 "date": None,
698 }
699
700 try:
701 pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
702 return render(pieces, cfg.style)
703 except NotThisMethod:
704 pass
705
706 try:
707 if cfg.parentdir_prefix:
708 return versions_from_parentdir(cfg.parentdir_prefix, root, verbose)
709 except NotThisMethod:
710 pass
711
712 return {
713 "version": "0+unknown",
714 "full-revisionid": None,
715 "dirty": None,
716 "error": "unable to compute version",
717 "date": None,
718 }

Callers

nothing calls this directly

Calls 7

splitMethod · 0.80
get_configFunction · 0.70
get_keywordsFunction · 0.70
git_pieces_from_vcsFunction · 0.70
renderFunction · 0.70
versions_from_parentdirFunction · 0.70

Tested by

no test coverage detected