versionfinder.versioninfo module¶
-
class
versionfinder.versioninfo.
VersionInfo
(pip_version=None, pip_url=None, pip_requirement=None, pkg_resources_version=None, pkg_resources_url=None, git_tag=None, git_commit=None, git_remotes=None, git_is_dirty=None)[source]¶ Bases:
object
Class describing
VersionFinder
result; the discovered information about the version and source of an installed package.-
as_dict
¶ Return the constructor arguments as a dictionary (effectively the kwargs to the constructor).
Returns: dict of constructor arguments Return type: dict
-
git_commit
¶ Return the hex SHA of the current git commit that the distribution is installed at, or None if not installed via git.
Returns: git commit hex SHA Return type: str
orNone
-
git_is_dirty
¶ Return True if the distribution is installed via git and has uncommitted changes or untracked files in the repo; Return False if the distribution is installed via git and does not have uncommitted changes or untracked files in the repo; return None if the distribution is not installed via git.
Returns: whether or not the git repo has uncommitted changes or untracked files Return type: bool
orNone
-
git_remote
¶ If the distribution is installed via git, return the first URL of the ‘origin’ remote if one is configured for the repo, or else the first URL of the lexicographically-first remote, or else None.
Returns: origin or first remote URL Return type: str
orNone
-
git_remotes
¶ If the distribution is installed via git, return a dict of all remotes configured on the git repository; keys are the remote name and values are the remote’s first URL. If not installed via git, return None.
Returns: dict of git remotes, name (str) to first URL (str) Return type: dict
orNone
-
git_str
¶ If the distribution is not installed via git, return an empty string.
If the distribution is installed via git and pip recognizes the git source, return the pip requirement string specifying the git URL and commit, with an ‘*’ appended if
git_is_dirty()
is True.Otherwise, return a string of the form:
url@ref[*]Where URL is the remote URL, ref is the tag name if the repo is checked out to a commit that matches a tag or else the commit hex SHA, and ‘*’ is appended if
git_is_dirty()
is True.Returns: description of the git repo remote and state Return type: str
-
git_tag
¶ Return the name of the git that that the distribution is installed at, or None if there is no tag matching the current commit, or if not installed via git.
Returns: current git tag Return type: str
orNone
-
long_str
¶ Return a long version and installation specifier string of the form:
If
git_str()
== ‘’:SHORT_STRotherwise:
SHORT_STR (GIT_STR)Where
SHORT_STR
isshort_str()
andGIT_STR
isgit_str()
.Returns: long version/installation specifier string Return type: str
-
pip_requirement
¶ Return the pip requirement for the current installation of the distribution, or None if the distribution cannot be found with pip.
Returns: pip requirement string Return type: str
orNone
-
pip_url
¶ Return the pip distribution “Home-page”, or None if the distribution cannot be found with pip.
Returns: pip distribution Home-page/URL Return type: str
orNone
-
pip_version
¶ Return the pip distribution version, or None if the distribution cannot be found with pip.
Returns: pip distribution version Return type: str
orNone
-
pkg_resources_url
¶ Return the pkg_resources distribution “Home-page”, or None if the distribution cannot be found with pkg_resources.
Returns: pkg_resources distribution Home-page/URL Return type: str
orNone
-
pkg_resources_version
¶ Return the pkg_resources distribution version, or None if the distribution cannot be found with pkg_resources.
Returns: pkg_resources distribution version Return type: str
orNone
-
short_str
¶ Return a string of the form “ver <url>” where ver is the distribution version and URL is the distribution Home-Page url, or ‘’ if neither can be found.
Returns: version and URL Return type: str
-