Skip to content

versionmgr

Utility functions for managing pyRevit versions.

Examples:

from pyrevit import versionmgr
v = versionmgr.get_pyrevit_version()
v.get_formatted()
'4.10-beta2'

Attributes

mlogger = get_logger(__name__) module-attribute

Functions

get_pyrevit_repo()

Return pyRevit repository.

Returns:

Type Description
RepoInfo

repo wrapper object

Source code in pyrevitlib/pyrevit/versionmgr/__init__.py
def get_pyrevit_repo():
    """Return pyRevit repository.

    Returns:
        (pyrevit.coreutils.git.RepoInfo): repo wrapper object
    """
    try:
        return git.get_repo(HOME_DIR)
    except Exception as repo_err:
        mlogger.debug('Can not create repo from directory: %s | %s',
                      HOME_DIR, repo_err)

get_pyrevit_version()

Return information about active pyRevit version.

Returns:

Type Description
_PyRevitVersion

version wrapper object

Source code in pyrevitlib/pyrevit/versionmgr/__init__.py
def get_pyrevit_version():
    """Return information about active pyRevit version.

    Returns:
        (_PyRevitVersion): version wrapper object
    """
    try:
        return _PyRevitVersion(get_pyrevit_repo().last_commit_hash)
    except Exception as ver_err:
        mlogger.debug('Can not get pyRevit patch number. | %s', ver_err)
        return _PyRevitVersion('')

get_pyrevit_cli_version()

Return version of shipped pyRevit CLI utility.

Returns:

Type Description
str

version string of pyRevit CLI utility binary

Source code in pyrevitlib/pyrevit/versionmgr/__init__.py
def get_pyrevit_cli_version():
    """Return version of shipped pyRevit CLI utility.

    Returns:
        (str): version string of pyRevit CLI utility binary
    """
    return coreutils.get_exe_version(PYREVIT_CLI_PATH)